This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: gold vs. BFD handling of relocations
- From: Ian Lance Taylor <iant at google dot com>
- To: David Miller <davem at davemloft dot net>
- Cc: binutils at sourceware dot org
- Date: Thu, 17 Apr 2008 00:33:50 -0700
- Subject: Re: gold vs. BFD handling of relocations
- References: <20080416.234341.83044818.davem@davemloft.net>
David Miller <davem@davemloft.net> writes:
> One area which I've noticed gold behaves significantly differently
> from the BFD linker is the handling of new relocations emitted that
> essentially preempt a given input relocation.
>
> For example, if we emit a dynamic relocation in response to an input
> relocation to the same exact location (ie. not a situation like a PLT
> reloc where the emitted dynamic reloc is to a different location than
> the input reloc on the call instruction), BFD skips the input reloc in
> the final relocation processing pass completely whereas gold still
> processes the input relocation.
>
> I don't know which is right or whether it matters at all. What's
> the story here?
The right thing to do is target dependent. For most REL targets, even
when an input relocation is turned into a dynamic relocation, if the
input relocation is against a section symbol, some processing is
necessary.
For i386, see should_apply_static_reloc.
For x86_64, it doesn't much matter what the linker does, since the
dynamic linker mostly ignores the contents of the input sections when
applying dynamic relocs. I suppose it might be a little bit more
efficient if we skipped the reloc processing.
Ian