ICF on PowerPC Bug

Sriraman Tallam tmsriram@google.com
Tue Apr 1 22:06:00 GMT 2014


Hi,


This program fails with ICF on powerpc:

__attribute__((noinline))
int foo () { return 1; }

__attribute__((noinline))
int bar () { return 0; }

__attribute__((noinline))
int fold1() {
  return foo ();
}

__attribute__((noinline))
int fold2() {
  return bar();
}

int main()
{
  assert (fold1() != fold2());
}

because fold2 is folded onto fold1.    The only way to differentiate
fold1 and fold2 which have the same object code is via the relocation
type and the Info value is different.  However, with powerpc this is
rewritten here in icf.cc:

// Look through function descriptors
parameters->target().function_location(&loc);
 if (loc.shndx != it_v->second)
{
 it_v->second = loc.shndx;
 // Modify symvalue/addend to the code entry.
 it_a->first = loc.offset;
 it_a->second = 0;
}

I am not sure how to fix it.

Thanks
Sri



More information about the Binutils mailing list