[llvm] [BOLT][AArch64] Handle OpNegateRAState to enable optimizing binaries with pac-ret hardening (PR #120064)

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Wed May 14 03:18:26 PDT 2025


================
@@ -2769,10 +2770,12 @@ struct CFISnapshot {
       llvm_unreachable("unsupported CFI opcode");
       break;
     case MCCFIInstruction::OpNegateRAState:
-      if (!(opts::BinaryAnalysisMode || opts::HeatmapMode)) {
-        llvm_unreachable("BOLT-ERROR: binaries using pac-ret hardening (e.g. "
-                         "as produced by '-mbranch-protection=pac-ret') are "
-                         "currently not supported by BOLT.");
+      if (!(opts::BinaryAnalysisMode || opts::HeatmapMode ||
+            opts::AllowPacret)) {
+        llvm_unreachable(
+            "BOLT-ERROR: support for binaries using pac-ret hardening (e.g. as "
+            "produced by '-mbranch-protection=pac-ret') is experimental\n"
+            "BOLT-ERROR: set --allow-experimental-pacret to allow processing");
----------------
paschalis-mpeis wrote:

All are valid points – thanks for raising them.
We've discussed them at length offline, but we'll need input from others as well.
Let's bring this to the community to gather their thoughts.

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


More information about the llvm-commits mailing list