Skip to content

Commit

Permalink
[Driver] Place -mharden-sls= in m_Group
Browse files Browse the repository at this point in the history
Fix #63237

With only a link action, we claim all CompileOnly_Group options (including -f*,
-m*, -i*, etc). -mharden-sls= is not in a Group and therefore not claimed,
leading to a spurious -Wunused-command-line-argument warning, and after
5548843, an error.
  • Loading branch information
MaskRay committed Jun 11, 2023
1 parent 9596b48 commit c8c28ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -3846,7 +3846,7 @@ 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=">,
def mharden_sls_EQ : Joined<["-"], "mharden-sls=">, Group<m_Group>,
HelpText<"Select straight-line speculation hardening scope (ARM/AArch64/X86"
" only). <arg> must be: all, none, retbr(ARM/AArch64),"
" blr(ARM/AArch64), comdat(ARM/AArch64), nocomdat(ARM/AArch64),"
Expand Down
3 changes: 3 additions & 0 deletions clang/test/Driver/x86-target-features.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,6 @@
// SLS-IJMP-DAG: "-target-feature" "+harden-sls-ijmp"
// NO-SLS-NOT: "+harden-sls-
// BAD-SLS: unsupported argument '{{[^']+}}' to option '-mharden-sls='

// RUN: touch %t.o
// RUN: %clang -fdriver-only -Werror --target=x86_64-pc-linux-gnu -mharden-sls=all %t.o -o /dev/null 2>&1 | count 0

0 comments on commit c8c28ac

Please sign in to comment.