[PATCH] D140035: [X86] Prevent -mibt-seal to work together with -flto=thin

Sami Tolvanen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 15 11:48:53 PST 2022


samitolvanen accepted this revision.
samitolvanen added a comment.
This revision is now accepted and ready to land.

In D140035#3996066 <https://reviews.llvm.org/D140035#3996066>, @joaomoreira wrote:

> Regarding not being able to reproduce this in kernel -- never mind... I was misled by setup issues while running IBT kernels in QEMU. I managed to fix the setup and confirm that kernel won't boot.

OK, great. Thanks for double checking!

The patch itself looks good to me, but I suspect ibt-seal in general has the same issue as D138337 <https://reviews.llvm.org/D138337> where it can drop endbr instructions from `isUsedInRegularObj` symbols that are not address-taken in the bitcode (e.g. functions whose address is only taken in stand-alone assembly). I saw this issue only in the arm64 Linux kernel, but there's always a chance a similar code pattern emerges on the x86 side at some point in future too. This can obviously be worked around in the kernel, but just something to keep in mind.



================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1856
 
-  if (Opts.PrepareForLTO && Args.hasArg(OPT_mibt_seal))
+  if (Opts.PrepareForLTO &&
+      !Opts.PrepareForThinLTO &&
----------------
Please run `git clang-format` for the patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140035/new/

https://reviews.llvm.org/D140035



More information about the cfe-commits mailing list