2016-11-10 07:46:25 +08:00
|
|
|
; RUN: llvm-mc -filetype=obj -triple=avr %s -mattr=avr6 | llvm-objdump -r - | FileCheck %s
|
|
|
|
|
|
|
|
; CHECK: RELOCATION RECORDS FOR
|
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
.global bar
|
2017-12-09 16:01:28 +08:00
|
|
|
bar:
|
|
|
|
jmp bar
|
|
|
|
|
2019-11-19 21:56:29 +08:00
|
|
|
; CHECK: R_AVR_LDI SYMBOL+0x3
|
2016-11-10 07:46:25 +08:00
|
|
|
ldi r21, SYMBOL+3
|
|
|
|
|
2020-05-17 12:46:32 +08:00
|
|
|
; CHECK: R_AVR_6 SYMBOL+0x4
|
|
|
|
ldd r8, Y+SYMBOL+4
|
|
|
|
|
2016-11-10 07:46:25 +08:00
|
|
|
; CHECK-NEXT: R_AVR_6_ADIW FOO
|
|
|
|
adiw r24, FOO
|
|
|
|
|
2019-11-19 21:56:29 +08:00
|
|
|
; CHECK-NEXT: R_AVR_16 BAR+0x2
|
2016-11-10 07:46:25 +08:00
|
|
|
lds r8, BAR+2
|
|
|
|
|
|
|
|
; CHECK-NEXT: R_AVR_PORT5 foo
|
|
|
|
sbic foo, 1
|
|
|
|
|
2019-11-19 21:56:29 +08:00
|
|
|
; CHECK-NEXT: R_AVR_PORT6 Bar+0x2
|
2016-11-10 07:46:25 +08:00
|
|
|
in r30, Bar+2
|
|
|
|
|
2019-11-19 21:56:29 +08:00
|
|
|
; CHECK-NEXT: R_AVR_CALL foo+0x3
|
2016-11-10 07:46:25 +08:00
|
|
|
call foo+3
|
|
|
|
|
2019-11-19 21:56:29 +08:00
|
|
|
; CHECK-NEXT: R_AVR_13_PCREL foo-0xa
|
2016-11-10 07:46:25 +08:00
|
|
|
rjmp foo-10
|
|
|
|
|
2019-11-19 21:56:29 +08:00
|
|
|
; CHECK-NEXT: R_AVR_7_PCREL foo+0x2
|
2016-11-10 07:46:25 +08:00
|
|
|
brcs foo+2
|
|
|
|
|
2019-11-19 21:56:29 +08:00
|
|
|
; CHECK-NEXT: R_AVR_LO8_LDI bar+0x3
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_LO8_LDI abc
|
|
|
|
; CHECK-NEXT: R_AVR_LO8_LDI abc
|
2016-11-10 07:46:25 +08:00
|
|
|
ldi r24, lo8(bar+3)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r16, +lo8(abc)
|
|
|
|
ldi r16, lo8(+(abc))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HI8_LDI abc
|
|
|
|
; CHECK-NEXT: R_AVR_HI8_LDI abc
|
2016-11-10 07:46:25 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HI8_LDI abc
|
|
|
|
ldi r30, hi8(abc)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r16, +hi8(abc)
|
|
|
|
ldi r16, hi8(+(abc))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_LO8_LDI_NEG abc
|
2016-11-10 07:46:25 +08:00
|
|
|
; CHECK-NEXT: R_AVR_LO8_LDI_NEG abc
|
|
|
|
ldi r16, -lo8(abc)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r16, lo8(-(abc))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HI8_LDI_NEG abc
|
2016-11-10 07:46:25 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HI8_LDI_NEG abc
|
|
|
|
ldi r16, -hi8(abc)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r16, hi8(-(abc))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI foo
|
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI foo
|
2016-11-10 07:46:25 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI foo
|
|
|
|
ldi r16, hh8(foo)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r16, +hh8(foo)
|
|
|
|
ldi r16, hh8(+(foo))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo
|
2016-11-10 07:46:25 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo
|
|
|
|
ldi r16, -hh8(foo)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r16, hh8(-(foo))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI foo
|
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI foo
|
2016-11-10 07:46:25 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI foo
|
|
|
|
ldi r24, hlo8(foo)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r24, +hlo8(foo)
|
|
|
|
ldi r24, hlo8(+(foo))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo
|
2016-11-10 07:46:25 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo
|
|
|
|
ldi r24, -hlo8(foo)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r24, hlo8(-(foo))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_MS8_LDI bar
|
|
|
|
; CHECK-NEXT: R_AVR_MS8_LDI bar
|
2016-11-10 07:46:25 +08:00
|
|
|
; CHECK-NEXT: R_AVR_MS8_LDI bar
|
|
|
|
ldi r24, hhi8(bar)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r24, +hhi8(bar)
|
|
|
|
ldi r24, hhi8(+(bar))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_MS8_LDI_NEG bar
|
2016-11-10 07:46:25 +08:00
|
|
|
; CHECK-NEXT: R_AVR_MS8_LDI_NEG bar
|
|
|
|
ldi r24, -hhi8(bar)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r24, hhi8(-(bar))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_LO8_LDI_PM foo
|
|
|
|
; CHECK-NEXT: R_AVR_LO8_LDI_PM foo
|
2016-11-10 07:46:25 +08:00
|
|
|
; CHECK-NEXT: R_AVR_LO8_LDI_PM foo
|
|
|
|
ldi r17, pm_lo8(foo)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r25, +pm_lo8(foo)
|
|
|
|
ldi r25, pm_lo8(+(foo))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
|
|
|
; CHECK-NEXT: R_AVR_HI8_LDI_PM bar
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HI8_LDI_PM foo
|
|
|
|
; CHECK-NEXT: R_AVR_HI8_LDI_PM foo
|
2016-11-10 07:46:25 +08:00
|
|
|
ldi r22, pm_hi8(bar)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r25, +pm_hi8(foo)
|
|
|
|
ldi r25, pm_hi8(+(foo))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI_PM baz
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI_PM foo
|
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI_PM foo
|
2016-11-10 07:46:25 +08:00
|
|
|
ldi r25, pm_hh8(baz)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r25, +pm_hh8(foo)
|
|
|
|
ldi r25, pm_hh8(+(foo))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_LO8_LDI_PM_NEG foo
|
|
|
|
; CHECK-NEXT: R_AVR_LO8_LDI_PM_NEG foo
|
2016-11-10 07:46:25 +08:00
|
|
|
ldi r25, -pm_lo8(foo)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r25, pm_lo8(-(foo))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HI8_LDI_PM_NEG foo
|
|
|
|
; CHECK-NEXT: R_AVR_HI8_LDI_PM_NEG foo
|
2016-11-10 07:46:25 +08:00
|
|
|
ldi r25, -pm_hi8(foo)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r25, pm_hi8(-(foo))
|
2016-11-10 07:46:25 +08:00
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI_PM_NEG foo
|
|
|
|
; CHECK-NEXT: R_AVR_HH8_LDI_PM_NEG foo
|
2016-11-10 07:46:25 +08:00
|
|
|
ldi r25, -pm_hh8(foo)
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r25, pm_hh8(-(foo))
|
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_LO8_LDI_GS foo
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r17, lo8(gs(foo))
|
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK-NEXT: R_AVR_HI8_LDI_GS foo
|
2017-12-09 16:01:28 +08:00
|
|
|
ldi r18, hi8(gs(foo))
|
|
|
|
|
|
|
|
; CHECK-NEXT: R_AVR_16
|
|
|
|
.short foo
|
|
|
|
|
|
|
|
; CHECK-NEXT: R_AVR_16_PM
|
|
|
|
.short gs(foo)
|
|
|
|
|
|
|
|
; CHECK-NEXT: R_AVR_8
|
|
|
|
.byte foo
|
|
|
|
|
|
|
|
; CHECK-NEXT: R_AVR_8_LO8
|
|
|
|
.byte lo8(foo)
|
|
|
|
|
|
|
|
; CHECK-NEXT: R_AVR_8_HI8
|
|
|
|
.byte hi8(foo)
|
|
|
|
|
|
|
|
; CHECK-NEXT: R_AVR_8_HLO8
|
|
|
|
.byte hlo8(foo)
|
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK: R_AVR_DIFF8
|
2017-12-09 16:01:28 +08:00
|
|
|
.byte foo - bar
|
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK: R_AVR_DIFF16
|
2017-12-09 16:01:28 +08:00
|
|
|
.short foo - bar
|
|
|
|
|
2017-12-11 19:01:27 +08:00
|
|
|
; CHECK: R_AVR_DIFF32
|
2017-12-09 16:01:28 +08:00
|
|
|
.long foo - bar
|