Skip to content

Commit 0575b90

Browse files
Add files for testing AVR relocations
1 parent b0df2e9 commit 0575b90

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

elf/avr/avr_relocs.elf

2.42 KB
Binary file not shown.

src/avr/avr_relocs.s

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
.section .text
2+
.global _start
3+
.weak sym ; ensuring relocations are emitted
4+
5+
_start:
6+
nop
7+
8+
ldi r16, lo8(sym) ; R_AVR_LO8_LDI (6)
9+
ldi r16, hi8(sym) ; R_AVR_HI8_LDI (7)
10+
ldi r16, hh8(sym) ; R_AVR_HH8_LDI (8)
11+
12+
.reloc ., R_AVR_MS8_LDI, sym
13+
ldi r16, 0 ; R_AVR_MS8_LDI (35)
14+
15+
ldi r16, lo8(-(sym)) ; R_AVR_LO8_LDI_NEG (9)
16+
ldi r16, hi8(-(sym)) ; R_AVR_HI8_LDI_NEG (10)
17+
ldi r16, hh8(-(sym)) ; R_AVR_HH8_LDI_NEG (11)
18+
19+
ldi r16, lo8(pm(sym)) ; R_AVR_LO8_LDI_PM (12)
20+
ldi r16, hi8(pm(sym)) ; R_AVR_HI8_LDI_PM (13)
21+
ldi r16, hh8(pm(sym)) ; R_AVR_HH8_LDI_PM (14)
22+
23+
ldi r16, lo8(-(pm(sym))) ; R_AVR_LO8_LDI_PM_NEG (15)
24+
ldi r16, hi8(-(pm(sym))) ; R_AVR_HI8_LDI_PM_NEG (16)
25+
ldi r16, hh8(-(pm(sym))) ; R_AVR_HH8_LDI_PM_NEG (17)
26+
27+
28+
rjmp sym ; R_AVR_13_PCREL (3)
29+
30+
clz
31+
breq sym ; R_AVR_7_PCREL (2)
32+
33+
call sym ; R_AVR_CALL (18)
34+
35+
36+
.section .data
37+
38+
.long sym ; R_AVR_32 (1)
39+
.word sym ; R_AVR_16 (4)
40+
.word pm(sym) ; R_AVR_16_PM (5)
41+
.byte sym ; R_AVR_8 (27)
42+
43+
/* Forced Relocations */
44+
.reloc ., R_AVR_8_LO8, sym
45+
.byte 0 ; R_AVR_8_LO8 (28)
46+
47+
.reloc ., R_AVR_8_HI8, sym
48+
.byte 0 ; R_AVR_8_HI8 (29)
49+
50+
.reloc ., R_AVR_8_HLO8, sym
51+
.byte 0 ; R_AVR_8_HLO8 (30)
52+
53+
54+
.section .text
55+
56+
.reloc ., R_AVR_6, sym
57+
std Z+0, r16
58+
59+
.reloc ., R_AVR_6_ADIW, sym
60+
adiw r24, 0
61+
62+
.reloc ., R_AVR_DIFF8, sym
63+
.byte 0
64+
.reloc ., R_AVR_DIFF16, sym
65+
.word 0
66+
.reloc ., R_AVR_DIFF32, sym
67+
.long 0

0 commit comments

Comments
 (0)