[llvm] [BOLT] Gadget scanner: implement finer-grained --scanners option (PR #176135)

Kristof Beyls via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 19 02:40:04 PST 2026


================
@@ -286,13 +286,23 @@ static cl::opt<bool> WriteBoltInfoSection(
     "bolt-info", cl::desc("write bolt info section in the output binary"),
     cl::init(true), cl::Hidden, cl::cat(BoltOutputCategory));
 
-cl::bits<GadgetScannerKind> GadgetScannersToRun(
-    "scanners", cl::desc("which gadget scanners to run"),
+static cl::list<GadgetScannerKind> GadgetScannersToRun(
+    "scanners", cl::desc("Which gadget scanners to run"),
     cl::values(
-        clEnumValN(GS_PACRET, "pacret",
-                   "pac-ret: return address protection (subset of \"pauth\")"),
-        clEnumValN(GS_PAUTH, "pauth", "All Pointer Authentication scanners"),
-        clEnumValN(GS_ALL, "all", "All implemented scanners")),
+        clEnumValN(GS_PTRAUTH_RETURN_TARGETS, "ptrauth-pac-ret",
+                   "Unprotected returns (pac-ret)"),
+        clEnumValN(GS_PTRAUTH_TAIL_CALLS, "ptrauth-tail-calls",
+                   "Tail calls performed with unprotected link register"),
+        clEnumValN(GS_PTRAUTH_BRANCH_AND_CALL_TARGETS, "ptrauth-forward-cf",
+                   "Unprotected calls and branches (forward control-flow)"),
+        clEnumValN(GS_PTRAUTH_SIGN_ORACLES, "ptrauth-sign-oracles",
+                   "Signing of untrusted pointers (signing oracles)"),
+        clEnumValN(GS_PTRAUTH_AUTH_ORACLES, "ptrauth-auth-oracles",
+                   "Authentication oracles"),
+
+        clEnumValN(GS_PTRAUTH_ALL_MASK, "ptrauth-all",
+                   "All Pointer Authentication scanners"),
----------------
kbeyls wrote:

Thank you, I like this patch :)
My only thought/comment is about the naming of the command line arguments.
My impression is that in most other places, we abbreviate "pointer authentication" to "pauth" rather than "ptrauth".
The AArch64 architecture extension family for pointer authentication is also called "FEAT_PAUTH_*".

To me it seems it would be more consistent to name these command line options `pauth-*` rather than `ptrauth-*` to keep naming more consistent.
Or maybe I haven't kept up well, and "ptrauth" is the most common abbreviation to refer to pointer authentication?

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


More information about the llvm-commits mailing list