http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51469
Bug #: 51469 Summary: attr-ifunc-* tests fail on PowerPC if --enable-gnu-indirect-function is used Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: meiss...@gcc.gnu.org ReportedBy: meiss...@gcc.gnu.org Host: powerpc64-linux power-linux Target: powerpc64-linux Build: powerpc64-linux The tests: gcc.dg/attr-ifunc-1.c gcc.dg/attr-ifunc-3.c gcc.dg/attr-ifunc-4.c gcc.dg/attr-ifunc-5.c g++.dg/ext/attr-ifunc-1.C g++.dg/ext/attr-ifunc-2.C g++.dg/ext/attr-ifunc-3.C all fail on PowerPC linux when the compiler is configured with --enable-gnu-indirect-function I traced this down, and the problem with the tests is that the gnu indirect function (with the ifunc attribute) is in the same module as the call. The SYMBOL_REF_LOCAL bit is set for these functions. Because SYMBOL_REF_LOCAL is set, the PPC compiler assumes the call is in the same module and bypasses putting a NOP after the BL instruction, which is used to restore the TOC. Because the BL is not followed by a NOP, the assembler and linker will not create a PLT for the function and use the indirect function to return the address of the function to use for the call.