[PATCH] D37615: [ELF] Implement the relocations of AVR for LLD
Leslie Zhai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 12 22:42:11 PDT 2017
xiangzhai updated this revision to Diff 114972.
xiangzhai added a comment.
Add testcase for tinyAVR <http://www.atmel.com/products/microcontrollers/avr/tinyavr.aspx> about `R_AVR_LDS_STS_16`:
$ avr-gcc -mmcu=attiny40 -o tiny-avr.o -c tiny-avr.s
$ avr-readelf -r tiny-avr.o
Relocation section '.rela.text' at offset 0xa4 contains 2 entries:
Offset Info Type Sym.Value Sym. Name + Addend
00000000 00000121 R_AVR_LDS_STS_16 00000000 .text + 2
00000002 00000103 R_AVR_13_PCREL 00000000 .text + 2
Relocated by avr-ld:
Memory access is limited to the address range 0x40...0xbf. so use 0x40 as high address:
$ avr-ld --no-warn-mismatch -o tiny-avr tiny-avr.o -Ttext=40
$ avr-objdump -d tiny-avr
tiny-avr: file format elf32-avr
Disassembly of section .text:
00000040 <__ctors_end>:
40: 12 a1 ldd r17, Z+34 ; 0x22
00000042 <foo>:
42: ff cf rjmp .-2 ; 0x42 <foo>
It is equals to LLD:
$ llvm/build/bin/ld.lld -o tiny-avr-lld tiny-avr.o -Ttext=40
$ avr-objdump -d tiny-avr-lld
tiny-avr-lld: file format elf32-avr
Disassembly of section .text:
00000040 <main>:
40: 12 a1 ldd r17, Z+34 ; 0x22
00000042 <foo>:
42: ff cf rjmp .-2 ; 0x42 <foo>
Repository:
rL LLVM
https://reviews.llvm.org/D37615
Files:
ELF/Arch/AVR.cpp
test/ELF/basic-avr.s
test/ELF/tiny-avr.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37615.114972.patch
Type: text/x-patch
Size: 9246 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170913/52f6e42d/attachment.bin>
More information about the llvm-commits
mailing list