[lld] r249628 - [ELF2] Garbage collect or{16, 64}le. They're now unused.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 17:47:22 PDT 2015


On Fri, Oct 9, 2015 at 7:43 AM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
>> I think this is correct. I also checked bfd and they read contents for this one.
>
> Do you know what generates a Elf_Rela with effectively 2 addends?
>

Hi Rafael,
I finally got to this (sorry for the delay).
The comment for this relocation is "set an ADD immediate value to bits
[11:0] of X", where X = (S + A).
Now, consider for example the test in aarch64-relocs.s :
add x0, x0, :lo12:.L.str

So, this updates an instruction with the selected bits of the
immediate. If we don't logical 'OR the contents with the result of the
relocation we get a wrong result. I'm as surprised as you about Rela
reading the contents, but in this case seems correct.  Given I was
still not sure about the correctness of this, I also checked what gold
does in this case, and they handle the case exactly as we do. Now,
this doesn't mean anything (both gold and ld.bfd may be wrong), but
still it was something I wanted to point out.
Please let me know if you have any other questions, and sorry if I
made any technical mistake (still learning this ABI).

Thank you,

-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare


More information about the llvm-commits mailing list