[PATCH] D37615: [AVR] implement the relocation of LDI for LLD

Leslie Zhai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 9 19:54:27 PDT 2017


xiangzhai added a comment.

Dear Rui,

幸せな先生の日!

> doing nothing for R_AVR_HI8_LDI seems apparently odd.



  00000000 <main>:
     0:   0e 94 00 00     call    0       ; 0x0 <main>
     4:   10 e0           ldi     r17, 0x00       ; 0
     6:   20 e0           ldi     r18, 0x00       ; 0
     8:   30 e0           ldi     r19, 0x00       ; 0
  
  0000000a <foo>:
     a:   0c 94 00 00     jmp     0       ; 0x0 <main>

relocated to by avr-ld:

  00000000 <__ctors_end>:
     0:   0e 94 05 00     call    0xa     ; 0xa <foo>
     4:   1a e0           ldi     r17, 0x0A       ; 10
     6:   20 e0           ldi     r18, 0x00       ; 0 <-- *without* change at all?
     8:   3a e0           ldi     r19, 0x0A       ; 10
  
  0000000a <foo>:
     a:   0c 94 05 00     jmp     0xa     ; 0xa <foo>

so I argue that it doesn't need to be relocated (doing nothing) for R_AVR_HI8_LDI, sorry for my foolish...

> Firstly, can you give me a documentation about AVR relocations?

There is no exp about AVR relocation in the http://www.atmel.com/images/Atmel-0856-AVR-Instruction-Set-Manual.pdf   no even such lesson in my assembly language or compiler principle courses 15 years ago, but only binutils's source code <http://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=bfd/elf32-avr.c;h=830da288f3cd3e6a070b5ced908ca05d6b11e4b0;hb=HEAD> about it.

https://reviews.llvm.org/D32991 I can *not* understand your relocation method <https://reviews.llvm.org/D32991#779825> about `0e 94 00 00` -> `0e 94 05 00` for `0xa` relocation address. why not `write16le(Loc, read16le(Loc));` for `0e 94`?

> took 70+ messages and more than a month to review despite its smallness, and I don't want both of us to spend that much time this time.

先生 sorry for wasting your time! I need to go deepin to binutils to learn how to relocate, thanks again for your help Orz

Regards,
Leslie Zhai


Repository:
  rL LLVM

https://reviews.llvm.org/D37615





More information about the llvm-commits mailing list