This is an archive of the discontinued LLVM Phabricator instance.

Remove incorrectly implemented -mibt-seal
ClosedPublic

Authored by MaskRay on Dec 19 2022, 6:52 PM.

Details

Summary

The option from D116070 does not work as intended and will not be needed when
hidden visibility is used. A function needs ENDBR if it may be reached
indirectly. If we make ThinLTO combine the address-taken property (close to
!GV.use_empty() && !GV.hasAtLeastLocalUnnamedAddr()), then the condition can
be expressed with:

AddressTaken || (!F.hasLocalLinkage() && (VisibleToRegularObj || !F.hasHiddenVisibility()))

The current F.hasAddressTaken() condition does not take into acount of
address-significance in another bitcode file or ELF relocatable file.

For the Linux kernel, it uses relocatable linking. lld/ELF uses a
conservative approach by setting all VisibleToRegularObj to true.
Using the non-relocatable semantics may under-estimate
VisibleToRegularObj. As @pcc mentioned on
https://github.com/ClangBuiltLinux/linux/issues/1737#issuecomment-1343414686
, we probably need a symbol list to supply additional
VisibleToRegularObj symbols (not part of the relocatable LTO link).

Diff Detail

Event Timeline

MaskRay created this revision.Dec 19 2022, 6:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 19 2022, 6:52 PM
MaskRay requested review of this revision.Dec 19 2022, 6:52 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 19 2022, 6:52 PM
MaskRay edited the summary of this revision. (Show Details)Dec 19 2022, 7:12 PM
MaskRay edited the summary of this revision. (Show Details)Dec 19 2022, 7:24 PM
MaskRay edited the summary of this revision. (Show Details)Dec 19 2022, 7:36 PM
samitolvanen accepted this revision.Dec 22 2022, 10:44 AM

I agree, it's probably best to temporarily revert this until Joao has time to address the issues you mentioned. The Linux kernel doesn't use -mibt-seal yet, so dropping the feature for now shouldn't be a problem.

This revision is now accepted and ready to land.Dec 22 2022, 10:44 AM
This revision was automatically updated to reflect the committed changes.

FWIIW, agreed on removing this until we figure out how to make it work properly. Thanks for the patch @MaskRay.

FWIIW, agreed on removing this until we figure out how to make it work properly. Thanks for the patch @MaskRay.

Thanks for accepting the removal:)

llvm/test/CodeGen/X86/ibtseal-kernel.ll