This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bug: GOLD handling of Sparc PLTREL


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]