https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70082
Bug ID: 70082 Summary: Attribute ifunc marked functions should not be allowed to call other functions. Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: carlos at redhat dot com Target Milestone: --- In 2005 the GNU IFUNC support was documented and added to GCC via the ifunc attribute. To be honest this was a mistake, the feature is not documented and the implementation has so many caveats that it is incredibly difficult to use. Recently gperftools added IFUNC usage in tcmalloc and they did a lot of things which break the IFUNC implementation in general, but happy to work by luck on x86_64. I have documented some of this here: https://sourceware.org/glibc/wiki/GNU_IFUNC The IFUNC support is salvageable, but will require some reworking across the various architectures to organize the relocations in a sensible way, and even then it's going to be hard to allow everything. Particularly with -Wl,-z,now which needs to complete all relocations early. To that end, and until we fix IFUNC, the use of the ifunc attribute in a function should immediately cause compilation to fail if that function calls any other function. There is simply no way to guarantee you can make that function call safely at early ld.so startup. You might allow calls to functions in the same translation unit, but then you'd have to make sure those functions don't also call other external functions. It's simply safer to limit the use to something that works. Is such a fix feasible?