[llvm] [CFI] Fix Direct Call Issues in CFI Dispatch Table (PR #69663)

Oskar Wirga via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 27 11:12:34 PDT 2023


================
@@ -1516,8 +1522,13 @@ void LowerTypeTestsModule::createJumpTable(
   // -fcf-protection=.
   if (JumpTableArch == Triple::x86 || JumpTableArch == Triple::x86_64)
     F->addFnAttr(Attribute::NoCfCheck);
-  // Make sure we don't emit .eh_frame for this function.
-  F->addFnAttr(Attribute::NoUnwind);
+
+  // Make sure we don't emit .eh_frame for this function if it isn't needed.
+  if (doesEntryHaveNoUnwind)
----------------
oskarwirga wrote:

This has an issue when there are more than one dispatch entries and one of them excepts and one of them doesn't. If the first entry in the dispatch table excepts but the second does not, then a direct replacement for the generated function will incorrectly be marked as `nounwind`

Will put up a fix soon. 

https://github.com/llvm/llvm-project/pull/69663


More information about the llvm-commits mailing list