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

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 13:20:58 PDT 2015


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

Oh, I get it.

Semantically, we are writing only r_addend. The problem is that the
destination is 12 bits, and there is no instruction to store 12 bits,
so we do a larger store of the value ored with the original bits. This
assumes that the original addend bits are zero.

Would you mind adding a comment about it?

Thanks,
Rafael


More information about the llvm-commits mailing list