[llvm] [BOLT][PAC] Warn about synchronous unwind tables (PR #165227)

Peter Waller via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 8 01:49:01 PST 2025


================
@@ -130,14 +137,34 @@ Error PointerAuthCFIAnalyzer::runOnFunctions(BinaryContext &BC) {
     return P.second.containedNegateRAState() && !P.second.isIgnored();
   });
 
+  if (Total == 0)
+    return Error::success();
+
   ParallelUtilities::runOnEachFunction(
       BC, ParallelUtilities::SchedulingPolicy::SP_INST_LINEAR, WorkFun,
       SkipPredicate, "PointerAuthCFIAnalyzer");
+
+  float IgnoredPercent = (100.0 * FunctionsIgnored) / Total;
   BC.outs() << "BOLT-INFO: PointerAuthCFIAnalyzer ran on " << Total
             << " functions. Ignored " << FunctionsIgnored << " functions "
-            << format("(%.2lf%%)", (100.0 * FunctionsIgnored) / Total)
+            << format("(%.2lf%%)", IgnoredPercent)
             << " because of CFI inconsistencies\n";
 
+  // Errors in the input are expected from two sources:
+  // - compilers emitting incorrect CFIs. This happens more frequently with
+  // older compiler versions, but it should not account for a large percentage.
+  // - input binary is using synchronous unwind tables. This means that after
+  // call sites, the unwind CFIs are dropped: the pass sees missing
+  // .cfi_negate_ra_state from autiasp instructions. If this is the case, a
+  // larger percentage of functions will be ignored.
+  //
+  // This is why the 10% threshold was chosen: we should not warn about
+  // synchronous unwind tables if only a few % is ignored.
----------------
peterwaller-arm wrote:

nit. /is ignored/are ignored/

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


More information about the llvm-commits mailing list