https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83782
Bug ID: 83782 Summary: Inconsistent address for hidden ifunc in a shared library Product: gcc Version: 7.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: rafael.espindola at gmail dot com Target Milestone: --- Created attachment 43092 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43092&action=edit testcase If a function with hidden visibility is implemented with an ifunc, different translation units have different opinions as to what its address is. The translation unit implementing the function gets its address with movq foo@GOTPCREL(%rip), %rax That is, it finds the address of the actual function after it is selected. Any translation unit will use leaq foo(%rip), %rax which the linker translates to the address of the plt. The net result is that the attached program finds two addresses for the same function: $ ./t 0x7fc5f331360a 0x7fc5f3313510 Gives the desire to allow ifuncs to be used by changing just the implementation (not the declaration), I think the only solution is to use the plt address in both translation units.