[llvm-dev] [lld][ELF] Addends adjustment for relocatable object

Simon Atanasyan via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 27 13:32:20 PDT 2016


You are right. LLD does not have this problem. Initially I bumped into
the MIPS specific bug related to GP relative relocations calculation.
I tried to make reproduction script as general as possible and
mistakenly make it too general. So now with your help I realized that
the problem solely affects MIPS.

On Tue, Sep 27, 2016 at 8:46 PM, Peter Smith <peter.smith at linaro.org> wrote:
> Hello Simon,
>
> Can I just check something with you? When I tried the example the
> .data section symbols given in the llvm-readelf -r output are
> different, one has an offset of 0 and one has an offset of 4 so the
> addends don't need updating. In ld the section symbols both have the
> same offset of 0 so the addends need updating. So I think the two
> approaches are equivalent.
>
> Have I misunderstood?
>
> Peter
>
> On 27 September 2016 at 08:28, Simon Atanasyan via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
>> Hi,
>>
>> Now in case of relocatable object generation LLD merges and copies
>> REL/RELA sections as is and does not touch any addends. But it is
>> incorrect. If we have a relocation which targets a section, we have to
>> adjust the relocation's addend to take in account that the section
>> might be merged with other ones.

-- 
Simon Atanasyan


More information about the llvm-dev mailing list