[all-commits] [llvm/llvm-project] 69243c: Remove incorrectly implemented -mibt-seal

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Dec 22 12:33:12 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 69243cdb926b1057c54522df305ffc195b2863ec
      https://github.com/llvm/llvm-project/commit/69243cdb926b1057c54522df305ffc195b2863ec
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-12-22 (Thu, 22 Dec 2022)

  Changed paths:
    M clang/include/clang/Basic/CodeGenOptions.def
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/test/CodeGen/X86/x86-cf-protection.c
    M llvm/lib/Target/X86/X86IndirectBranchTracking.cpp
    R llvm/test/CodeGen/X86/ibtseal-kernel.ll
    R llvm/test/CodeGen/X86/ibtseal-large.ll
    R llvm/test/CodeGen/X86/ibtseal-small.ll

  Log Message:
  -----------
  Remove incorrectly implemented -mibt-seal

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).

Reviewed By: samitolvanen

Differential Revision: https://reviews.llvm.org/D140363




More information about the All-commits mailing list