[GOLD] ifunc tests

Ian Lance Taylor iant@google.com
Wed Mar 6 23:44:00 GMT 2013

On Wed, Mar 6, 2013 at 3:39 PM, Alan Modra <amodra@gmail.com> wrote:
> 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.


OK, next (unrelated) thought: perhaps the PPC code should just safely
retrieve global into a local variable, rather than writing the whole
switch statement in assembler.

  int i;
#ifdef __powerpc__
  i = global;
  switch (i)


More information about the Binutils mailing list