[GOLD] ifunc tests

Alan Modra amodra@gmail.com
Wed Mar 6 23:39:00 GMT 2013


On Wed, Mar 06, 2013 at 06:15:04AM -0800, Ian Lance Taylor wrote:
> On Wed, Mar 6, 2013 at 3:45 AM, Alan Modra <amodra@gmail.com> wrote:
> > ifuncmain1pie and ifuncmain6pie fail on powerpc, because the ifunc
> > resolver function runs *before* all GOT relocations have been applied.
> > (The tests all pass on powerpc64 with a recent gcc due to
> > -mcmodel=medium avoiding the GOT/TOC.  They fail with any other
> > -mcmodel.)
> 
> I don't understand why the ifunc relocations can't be run after all
> the other relocations are applied.  That is how it works on x86.  Gold
> uses a separate reloc section for the IRELATIVE relocs and puts it
> after the other reloc sections.  The dynamic linker then processes the
> relocs in order.

Yes, we do the same on powerpc (*), but it only works for relocs in a
single binary, not when the ifunc relocation in a shared library uses
a resolver function in another shared library or the main app.  In
that case GOT relocs may not have been applied.  Exactly this
situation occurs in ifuncmain6pie/ifuncmod6.so.

*) I do have a reloc ordering problem in ifuncmod1.so that I intend to
fix.  A foo() dynamic reloc there is before one setting up the GOT
entry for global:

00010c58  00000901 R_PPC_ADDR32           foo()      foo + 0
00010c44  00000f01 R_PPC_ADDR32           00010c7c   global + 0

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list