[PATCH] D32991: [ELF] Initial migration of AVR target
Leslie Zhai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 8 19:22:34 PDT 2017
xiangzhai updated this revision to Diff 101987.
xiangzhai added a comment.
Dear Dylan,
Thanks for your hint!
> This is caused because unless you specify a target mcu, it will default to the bare minimum - the avr2 architecture, as with avr-gcc. Devices that fit into this category do not even have call/jmp instructions, and so you likely just need to pass something like atmega328p as the target CPU to llvm-mc.
Worked :)
$ /home/zhaixiang/project/llvm/build/bin/llvm-mc -filetype=obj -triple=avr-unknown-linux -mcpu=atmega328p basic-avr.s -o /tmp/basic-avr.o
$ file /tmp/basic-avr.o
/tmp/basic-avr.o: ELF 32-bit LSB relocatable, Atmel AVR 8-bit, version 1 (SYSV), not stripped
$ readelf -r /tmp/basic-avr.o
Relocation section '.rela.text' at offset 0x7c contains 2 entries:
Offset Info Type Sym.Value Sym. Name + Addend
00000000 00000312 R_AVR_CALL 00000000 .text + 4
00000004 00000312 R_AVR_CALL 00000000 .text + 4
Dear Rui,
> but you need to enable AVR backend when building your LLVM, I guess?
$ /home/zhaixiang/project/llvm/build/bin/llvm-mc --version
LLVM (http://llvm.org/):
LLVM version 5.0.0svn
Optimized build.
Default target: x86_64-redhat-linux
Host CPU: broadwell
Registered Targets:
...
avr - Atmel AVR Microcontroller
...
And I run the testcase:
$ make check-lld
[100%] Running lld test suite
Testing Time: 27.90s
Expected Passes : 1146
Unsupported Tests : 12
[100%] Built target check-lld
PS: @dylanmckay please update Buildbot's build optioin, I have experienced False Positive build failures <http://lists.llvm.org/pipermail/llvm-dev/2017-April/112406.html>, I directly added **AVR** to LLVM_ALL_TARGETS instead of `-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="AVR"` https://reviews.llvm.org/D33348 thoughts?
Then run for the AVR simulator:
$ simavr -m atmega328p ./basic-avr
Loaded 8 .text at address 0x0
avr_gdb_init listening on port 1234
Regards,
Leslie Zhai
Repository:
rL LLVM
https://reviews.llvm.org/D32991
Files:
ELF/InputFiles.cpp
ELF/Target.cpp
test/ELF/basic-avr.s
test/lit.cfg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32991.101987.patch
Type: text/x-patch
Size: 3818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170609/1f245dae/attachment.bin>
More information about the llvm-commits
mailing list