This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
ICF on PowerPC Bug
- From: Sriraman Tallam <tmsriram at google dot com>
- To: Alan Modra <amodra at gmail dot com>, binutils <binutils at sourceware dot org>, Ian Lance Taylor <iant at google dot com>
- Date: Tue, 1 Apr 2014 15:06:37 -0700
- Subject: ICF on PowerPC Bug
- Authentication-results: sourceware.org; auth=none
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