This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: bug: GOLD handling of Sparc PLTREL
- From: Ian Lance Taylor <iant at google dot com>
- To: David Miller <davem at davemloft dot net>
- Cc: binutils at sourceware dot org
- Date: Mon, 08 Feb 2010 21:53:50 -0800
- Subject: Re: bug: GOLD handling of Sparc PLTREL
- References: <20100208.164245.99036930.davem@davemloft.net>
David Miller <davem@davemloft.net> writes:
> Several test cases in GOLD fail on sparc because of how it lays out
> the .rela.plt and .rela.dyn sections.
>
> On Sparc, the .rela.dyn must include .rela.plt in it's range. If this
> is not followed, the dynamic linker will reference past the end of the
> relocations. This is true on 32-bit PowerPC and 32-bit S390 as well.
>
> But GOLD isn't doing this, it makes the size of .rela.dyn only include
> the .rela.dyn relocs, it doesn't include the .rela.plt reloc size
> too.
I don't see how this could be a problem, since the only thing the
dynamic linker sees are the segments and the dynamic tags. The
dynamic linker doesn't see anything about the .rela.dyn or .rela.plt
sections.
> The lack of overlapping .rela.dyn only causes visible problems breaks
> once we start emitting the DT_RELACOUNT which gets added in a later
> change.
Hmmm, I'm not sure I see how that could be a problem either, unless
something weird is happening. DT_RELACOUNT just counts the number of
relative relocs.
I see a few calls to add_local_relative and add_global_relative that
are not passing down elfcpp::R_SPARC_RELATIVE as the reloc type. That
is rather suspicious and seems like it could cause this sort of
problem. The add_local_relative and add_global_relative functions
should only be used to add RELATIVE relocs to the dynamic reloc
section, not to add any other sort of relocation.
Ian