[clang] [llvm] [PAC][Driver] Implement `-mbranch-protection=pauthabi` option (PR #97237)

Daniel Kiss via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 5 01:00:11 PDT 2024


================
@@ -1537,11 +1570,16 @@ static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args,
     if (!isAArch64 && PBP.Key == "b_key")
       D.Diag(diag::warn_unsupported_branch_protection)
           << "b-key" << A->getAsString(Args);
+    if (!isAArch64 && PBP.HasPauthABI)
+      D.Diag(diag::warn_unsupported_branch_protection)
+          << "pauthabi" << A->getAsString(Args);
     Scope = PBP.Scope;
     Key = PBP.Key;
     BranchProtectionPAuthLR = PBP.BranchProtectionPAuthLR;
     IndirectBranches = PBP.BranchTargetEnforcement;
     GuardedControlStack = PBP.GuardedControlStack;
+    if (isAArch64 && PBP.HasPauthABI)
----------------
DanielKristofKiss wrote:

FYI - I'm going to change the `sign-return-address` and variants to be a function flag. (#82819) 

`bti` - All `BRA*` and `BLRA*` instructions set the `PSTATE.BTYPE`.  I prefer to check the [pseudo code](https://developer.arm.com/documentation/ddi0602/2022-06/Base-Instructions/BLRAA--BLRAAZ--BLRAB--BLRABZ--Branch-with-Link-to-Register--with-pointer-authentication- )for this things (see BTypeNext)

IMHO `pauthabi+bti` makes sense as they are complementary while other option are overlapping. We can introduce this combination later. 

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


More information about the cfe-commits mailing list