[PATCH] D115501: [clang][ARM] Emit warnings when PACBTI-M is used with unsupported architectures

Amilendra Kodithuwakku via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 15 01:54:49 PST 2021


amilendra added inline comments.


================
Comment at: clang/lib/Basic/Targets/ARM.cpp:391-392
 
+  if (!Arch.empty() && !isBranchProtectionSupportedArch(Arch))
+    return false;
+
----------------
chill wrote:
> On empty `Arch` it'd continue down the function, but we'd like to return failure.
I am having trouble getting the test `arm-branch-protection-attr-1.c` to work after these changes. `validateBranchProtection()` checks the combination of two parameters, the branch protection attribute and architecture.
If the architecture is empty, like below, shouldn't the function to continue checking further than simply returning false? 
```
__attribute__((target("branch-protection=bti"))) void btionly() {}
```
Or should I be using something else other than `CGM.getTarget().getTargetOpts().CPU` to get the architecture in `ARMTargetCodeGenInfo::setTargetAttributes`?



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115501/new/

https://reviews.llvm.org/D115501



More information about the cfe-commits mailing list