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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 10 19:44:31 PDT 2017


ruiu added a comment.

>> 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...

As I wrote, "I believe it happens to generate the same result as ld.bfd because in the given test case, high address happens to be zero," and I'm still believing that that is the case. A relocation that doesn't really do anything is very odd, and it is likely a sign that something's not correct. I believe you want to learn/investigate more about ELF/AVR to write code for an ELF/AVR linker. You need to be able to explain with certainty what that relocation is and what it should do.


Repository:
  rL LLVM

https://reviews.llvm.org/D37615





More information about the llvm-commits mailing list