[PATCH] D32991: [ELF] Initial migration of AVR target

Leslie Zhai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 16 01:23:13 PDT 2017


xiangzhai updated this revision to Diff 99111.
xiangzhai added a comment.

Sorry for my late reply, I have to look after my wife she had cold :(

Dear Dylan,

> we should factor out the fixup application code in AVRAsmBackend.cpp and reuse it from lld.

Please leading me, as my mentor, I have no direction about `lib/Target/AVR/MCTargetDesc` and relocation type `R_AVR_CALL` has not been implemented yet <https://github.com/avr-llvm/lld/blob/avr-support/lib/ReaderWriter/ELF/AVR/AVRRelocationHandler.cpp#L321> so I need to read the source code of binutils about Relocation for CALL command in ATmega.

Dear George,

> Things like new target always needs some, because testcase is a proof of work.

I am not familiar with how to write the testcase for lld, it is much easier for clang analyzer <https://reviews.llvm.org/D31868> but I might make stupid mistakes for `avr-call.s` please point out my fault, thanks a lot!

> Though I think minimal possible runnable code would not have calls to bar() or foo() and you would not have these

relocations. I would suggest to link and run minimal possible example with just empty setup() and loop() for start.

empty setup() and loop() is able to work, but Dylan's fork, but

> When I originally implemented AVR support from LLD, by far the biggest component that I needed to write was the AVR-specific relocation handling code. I was able to link program successfully, and I am fairly certain that we don't need anything more complex than that.

so I have to implement R_AVR_32 and R_AVR_CALL as Initial migration of AVR target at the very beginning.

> I guess you can try to link both object with a known workable avr linker and should be able to run them without problems.

Yes! avr-ld works :)

Regards,
Leslie Zhai


Repository:
  rL LLVM

https://reviews.llvm.org/D32991

Files:
  ELF/InputFiles.cpp
  ELF/Target.cpp
  test/ELF/avr-call.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32991.99111.patch
Type: text/x-patch
Size: 3028 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170516/198fc9f2/attachment.bin>


More information about the llvm-commits mailing list