Skip to content

Commit 99c0f85

Browse files
committed
Re-commit: Driver: Don't warn on -mbranch-protection when linking
This is a re-commit of 98fd3b3. 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 fed96f3)
1 parent 0547ffe commit 99c0f85

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3400,6 +3400,7 @@ def msign_return_address_EQ : Joined<["-"], "msign-return-address=">,
34003400
Flags<[CC1Option]>, Group<m_Group>, Values<"none,all,non-leaf">,
34013401
HelpText<"Select return address signing scope">;
34023402
def mbranch_protection_EQ : Joined<["-"], "mbranch-protection=">,
3403+
Group<m_Group>,
34033404
HelpText<"Enforce targets of indirect branches and function returns">;
34043405

34053406
def mharden_sls_EQ : Joined<["-"], "mharden-sls=">,

clang/test/Driver/aarch64-security-options.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
// RUN: %clang -target aarch64--none-eabi -c %s -### -mbranch-protection=bar 2>&1 | \
2828
// RUN: FileCheck %s --check-prefix=BAD-BP-PROTECTION --check-prefix=WARN
2929

30+
// RUN: %clang -target aarch64--none-eabi -### -o /dev/null -mbranch-protection=standard /dev/null 2>&1 | \
31+
// RUN: FileCheck --allow-empty %s --check-prefix=LINKER-DRIVER
32+
3033
// WARN-NOT: warning: ignoring '-mbranch-protection=' option because the 'aarch64' architecture does not support it [-Wbranch-protection]
3134

3235
// RA-OFF: "-msign-return-address=none"
@@ -46,3 +49,7 @@
4649

4750
// BAD-B-KEY-COMBINATION: invalid branch protection option 'b-key' in '-mbranch-protection={{.*}}'
4851
// BAD-LEAF-COMBINATION: invalid branch protection option 'leaf' in '-mbranch-protection={{.*}}'
52+
53+
// Check that the linker driver doesn't warn about -mbranch-protection=standard
54+
// as an unused option.
55+
// LINKER-DRIVER-NOT: warning:

0 commit comments

Comments
 (0)