Blame SOURCES/m-branch-protection.patch

803c1c
commit fed96f31bb5b68f77dd617ee8e698dd8171ee71b
803c1c
Author: Tom Stellard <tstellar@redhat.com>
803c1c
Date:   Tue Mar 22 23:17:39 2022 -0700
803c1c
803c1c
    Re-commit: Driver: Don't warn on -mbranch-protection when linking
803c1c
    
803c1c
    This is a re-commit of 98fd3b359866f474ab1c097c22fb5c3be356b996.  The
803c1c
    newly added test was failing on the bots, and I've fixed the test now so
803c1c
    that it doesn't actually invoke the linker.
803c1c
803c1c
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
803c1c
index d37d3a31fe07..6ed87f9a464d 100644
803c1c
--- a/clang/include/clang/Driver/Options.td
803c1c
+++ b/clang/include/clang/Driver/Options.td
803c1c
@@ -3444,6 +3444,7 @@ def msign_return_address_EQ : Joined<["-"], "msign-return-address=">,
803c1c
   Flags<[CC1Option]>, Group<m_Group>, Values<"none,all,non-leaf">,
803c1c
   HelpText<"Select return address signing scope">;
803c1c
 def mbranch_protection_EQ : Joined<["-"], "mbranch-protection=">,
803c1c
+  Group<m_Group>,
803c1c
   HelpText<"Enforce targets of indirect branches and function returns">;
803c1c
 
803c1c
 def mharden_sls_EQ : Joined<["-"], "mharden-sls=">,
803c1c
diff --git a/clang/test/Driver/aarch64-security-options.c b/clang/test/Driver/aarch64-security-options.c
803c1c
index 6ea4b8ae5838..4bd73e06d255 100644
803c1c
--- a/clang/test/Driver/aarch64-security-options.c
803c1c
+++ b/clang/test/Driver/aarch64-security-options.c
803c1c
@@ -27,6 +27,9 @@
803c1c
 // RUN: %clang -target aarch64--none-eabi -c %s -### -mbranch-protection=bar     2>&1 | \
803c1c
 // RUN: FileCheck %s --check-prefix=BAD-BP-PROTECTION --check-prefix=WARN
803c1c
 
803c1c
+// RUN: %clang -target aarch64--none-eabi -### -o /dev/null -mbranch-protection=standard /dev/null 2>&1 | \
803c1c
+// RUN: FileCheck --allow-empty %s --check-prefix=LINKER-DRIVER
803c1c
+
803c1c
 // WARN-NOT: warning: ignoring '-mbranch-protection=' option because the 'aarch64' architecture does not support it [-Wbranch-protection]
803c1c
 
803c1c
 // RA-OFF: "-msign-return-address=none"
803c1c
@@ -46,3 +49,7 @@
803c1c
 
803c1c
 // BAD-B-KEY-COMBINATION: invalid branch protection option 'b-key' in '-mbranch-protection={{.*}}'
803c1c
 // BAD-LEAF-COMBINATION: invalid branch protection option 'leaf' in '-mbranch-protection={{.*}}'
803c1c
+
803c1c
+// Check that the linker driver doesn't warn about -mbranch-protection=standard
803c1c
+// as an unused option.
803c1c
+// LINKER-DRIVER-NOT: warning: