This is an archive of the discontinued LLVM Phabricator instance.

[MC][ELF] Mark GNU ABI if ifunc are used
ClosedPublic

Authored by zatrazz on Aug 4 2022, 6:28 AM.

Details

Summary

Similar to D107861. Some tools required the GNU ABI mark to output
the symbol is a IFUNC type correctly (for instance binutils readelf).

Diff Detail

Event Timeline

zatrazz created this revision.Aug 4 2022, 6:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2022, 6:28 AM
zatrazz requested review of this revision.Aug 4 2022, 6:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2022, 6:28 AM

The SHF_GNU_RETAIN change is more so that GNU ld recognizes its semantics, less about the readelf -s output. With many systems adopting GNU ABI features, I do not know whether it makes significant sense to "upgrade" ELFOSABI_NONE to ELFOSABI_GNU.

The SHF_GNU_RETAIN change is more so that GNU ld recognizes its semantics, less about the readelf -s output. With many systems adopting GNU ABI features, I do not know whether it makes significant sense to "upgrade" ELFOSABI_NONE to ELFOSABI_GNU.

I came up with this change mainly to make glibc configure script to detect that clang can actually use the ifunc attribute, otherwise it will use the old inline asm macros which might be subpar regarding debug information [1].

And I think this change also aligns with the recent discussion gABI where iFUNC does make the object ELFOSABI_GNU.

[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=configure.ac;h=eb5bc6a1313acb3f3614645739adeb7638f19617;hb=HEAD#l657

MaskRay accepted this revision.Aug 24 2022, 9:14 AM
This revision is now accepted and ready to land.Aug 24 2022, 9:14 AM
This revision was landed with ongoing or failed builds.Aug 25 2022, 2:19 PM
This revision was automatically updated to reflect the committed changes.

IMO we ought to test that FreeBSD (or some other non-OS/ABI NONE case) isn't changed to GNU, similar to the test in D97976.