[llvm-branch-commits] [clang] 99c0f85 - Re-commit: Driver: Don't warn on -mbranch-protection when linking

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Apr 1 20:13:06 PDT 2022


Author: Tom Stellard
Date: 2022-04-01T20:09:54-07:00
New Revision: 99c0f85ef992e9aa6465f27a8b05601667412bc7

URL: https://github.com/llvm/llvm-project/commit/99c0f85ef992e9aa6465f27a8b05601667412bc7
DIFF: https://github.com/llvm/llvm-project/commit/99c0f85ef992e9aa6465f27a8b05601667412bc7.diff

LOG: Re-commit: Driver: Don't warn on -mbranch-protection when linking

This is a re-commit of 98fd3b359866f474ab1c097c22fb5c3be356b996.  The
newly added test was failing on the bots, and I've fixed the test now so
that it doesn't actually invoke the linker.

(cherry picked from commit fed96f31bb5b68f77dd617ee8e698dd8171ee71b)

Added: 
    

Modified: 
    clang/include/clang/Driver/Options.td
    clang/test/Driver/aarch64-security-options.c

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 53e68ed2cef90..602586f94603f 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3400,6 +3400,7 @@ def msign_return_address_EQ : Joined<["-"], "msign-return-address=">,
   Flags<[CC1Option]>, Group<m_Group>, Values<"none,all,non-leaf">,
   HelpText<"Select return address signing scope">;
 def mbranch_protection_EQ : Joined<["-"], "mbranch-protection=">,
+  Group<m_Group>,
   HelpText<"Enforce targets of indirect branches and function returns">;
 
 def mharden_sls_EQ : Joined<["-"], "mharden-sls=">,

diff  --git a/clang/test/Driver/aarch64-security-options.c b/clang/test/Driver/aarch64-security-options.c
index 6ea4b8ae58385..4bd73e06d255a 100644
--- a/clang/test/Driver/aarch64-security-options.c
+++ b/clang/test/Driver/aarch64-security-options.c
@@ -27,6 +27,9 @@
 // RUN: %clang -target aarch64--none-eabi -c %s -### -mbranch-protection=bar     2>&1 | \
 // RUN: FileCheck %s --check-prefix=BAD-BP-PROTECTION --check-prefix=WARN
 
+// RUN: %clang -target aarch64--none-eabi -### -o /dev/null -mbranch-protection=standard /dev/null 2>&1 | \
+// RUN: FileCheck --allow-empty %s --check-prefix=LINKER-DRIVER
+
 // WARN-NOT: warning: ignoring '-mbranch-protection=' option because the 'aarch64' architecture does not support it [-Wbranch-protection]
 
 // RA-OFF: "-msign-return-address=none"
@@ -46,3 +49,7 @@
 
 // BAD-B-KEY-COMBINATION: invalid branch protection option 'b-key' in '-mbranch-protection={{.*}}'
 // BAD-LEAF-COMBINATION: invalid branch protection option 'leaf' in '-mbranch-protection={{.*}}'
+
+// Check that the linker driver doesn't warn about -mbranch-protection=standard
+// as an unused option.
+// LINKER-DRIVER-NOT: warning:


        


More information about the llvm-branch-commits mailing list