[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
Mon Dec 13 09:11:02 PST 2021


amilendra updated this revision to Diff 393917.
amilendra added a comment.

Address review comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115501

Files:
  clang/lib/Basic/Targets/ARM.cpp
  clang/lib/CodeGen/TargetInfo.cpp


Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -6403,7 +6403,8 @@
         // If the Branch Protection attribute is missing, validate the target
         // Architecture attribute against Branch Protection command line
         // settings.
-        if (!CGM.getTarget().isBranchProtectionSupportedArch(Attr.Architecture))
+        if (!Attr.Architecture.empty() &&
+            !CGM.getTarget().isBranchProtectionSupportedArch(Attr.Architecture))
           CGM.getDiags().Report(
               D->getLocation(),
               diag::warn_target_unsupported_branch_protection_attribute)
Index: clang/lib/Basic/Targets/ARM.cpp
===================================================================
--- clang/lib/Basic/Targets/ARM.cpp
+++ clang/lib/Basic/Targets/ARM.cpp
@@ -369,7 +369,7 @@
 
 bool ARMTargetInfo::isBranchProtectionSupportedArch(StringRef Arch) const {
   if (Arch.empty())
-    return true;
+    return false;
 
   llvm::ARM::ArchKind ArchKind = llvm::ARM::parseCPUArch(Arch);
   if (ArchKind != llvm::ARM::ArchKind::ARMV8_1MMainline &&
@@ -388,7 +388,7 @@
   if (!llvm::ARM::parseBranchProtection(Spec, PBP, Err))
     return false;
 
-  if (!isBranchProtectionSupportedArch(Arch))
+  if (!Arch.empty() && !isBranchProtectionSupportedArch(Arch))
     return false;
 
   BPI.SignReturnAddr =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115501.393917.patch
Type: text/x-patch
Size: 1445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211213/375113f5/attachment.bin>


More information about the cfe-commits mailing list