[llvm] [llvm-exegesis][AArch64] Check for PAC keys before disabling them (PR #138643)

Abhilash Majumder via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 6 01:49:24 PDT 2025


================
@@ -150,6 +214,70 @@ class ExegesisAArch64Target : public ExegesisTarget {
     // Function return is a pseudo-instruction that needs to be expanded
     PM.add(createAArch64ExpandPseudoPass());
   }
+
+#if defined(__aarch64__) && defined(__linux__)
+  // Converts variadic arguments to `long` and passes zeros for the unused
+  // arg2-arg5, as tested by the Linux kernel.
+  static long prctl_wrapper(int op, long arg2 = 0, long arg3 = 0) {
+    return prctl(op, arg2, arg3, /*arg4=*/0L, /*arg5=*/0L);
+  }
+#endif
+
+  const char *getIgnoredOpcodeReasonOrNull(const LLVMState &State,
+                                           unsigned Opcode) const override {
+    if (const char *Reason =
+            ExegesisTarget::getIgnoredOpcodeReasonOrNull(State, Opcode))
+      return Reason;
+
+    if (isPointerAuth(Opcode)) {
+#if defined(__aarch64__) && defined(__linux__)
+      // Only proceed with PAC key control if explicitly requested
+      if (!AArch64KeepPacKeys) {
----------------
abhilash1910 wrote:

The logic here needs reversal, will change it soon.
Thanks @tuliom  for highlighting.

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


More information about the llvm-commits mailing list