[gold patch 1/3] Support for incremental linking: write incremental inputs, symtab, relocs

Ian Lance Taylor iant@google.com
Thu Aug 12 21:10:00 GMT 2010


Cary Coutant <ccoutant@google.com> writes:

>>> +      // Get the addend.
>>> +      typename elfcpp::Elf_types<size>::Elf_Swxword addend;
>>> +      if (sh_type == elfcpp::SHT_RELA)
>>> +     addend =
>>> +         Reloc_types<sh_type, size, big_endian>::get_reloc_addend(&reloc);
>>> +      else
>>> +        {
>>> +          // FIXME: Get the addend for SHT_REL.
>>> +          addend = 0;
>>> +        }
>>
>> Why does the value of the addend matter for a SHT_REL section?
>
> Because the original addend will have been overwritten by the result
> of the relocation during the previous link. Hmmm, maybe it could be
> recovered because we know the original value of the symbol. I'll have
> to think about that -- I think that would require more target-specific
> knowledge than it would take to just fetch the original addend here.

Fetching the addend is of course target specific--e.g., MIPS, in which
the full addend can be spread across two different relocs.  I wonder
whether we will need a target-specific interface which takes the old and
new value of the symbol and updates the section contents accordingly.
Simple targets like i386 can use a standard implementation.

Ian



More information about the Binutils mailing list