[gold] Relocation data handling for comdat sections when doing a relocatable link
Artemiy Volkov
artemiyv@acm.org
Fri Dec 9 21:53:00 GMT 2016
On Mon, Nov 28, 2016 at 1:23 PM, Artemiy Volkov <artemiyv@acm.org> wrote:
> Hi all,
>
> I've stumbled upon an issue when linking a lot of C++ template-heavy
> code into a single library with gold. To ensure that there's only one
> copy of each text section corresponding to an instantiation of a
> template function, it uses the comdat section mechanism, which is
> handled just fine for regular linking in relocate_section().
>
> However, for relocatable linking it uses scan_relocatable_relocs() +
> relocate_relocs(). AFAICT, scan_relocatable_relocs() is simply setting
> relocation strategy to RELOC_DISCARD for every relocation that refers
> to a section that's being discarded, and that's a problem for every
> comdat section except those whose contents end up being included in
> the output file. This way lots of relocations in the debug sections
> are discarded instead of adjusted and the debug information becomes
> unreliable.
>
> Is this a known problem? Or might I be doing something wrong?
Ping? Can anyone shed some light on this?
Thanks,
Artemiy
More information about the Binutils
mailing list