Author: Fangrui Song Date: 2023-06-11T08:59:42-07:00 New Revision: c8c28ac5caf875771f9a424e46255948004cbeab
URL: https://github.com/llvm/llvm-project/commit/c8c28ac5caf875771f9a424e46255948004cbeab DIFF: https://github.com/llvm/llvm-project/commit/c8c28ac5caf875771f9a424e46255948004cbeab.diff LOG: [Driver] Place -mharden-sls= in m_Group Fix https://github.com/llvm/llvm-project/issues/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 5548843d692a92a7840f14002debc3cebcb3cdc3, an error. Added: Modified: clang/include/clang/Driver/Options.td clang/test/Driver/x86-target-features.c Removed: ################################################################################ diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 27a4bc080b8c0..aed62677da692 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -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)," diff --git a/clang/test/Driver/x86-target-features.c b/clang/test/Driver/x86-target-features.c index 6819c907f5c98..71bdd2a9c2981 100644 --- a/clang/test/Driver/x86-target-features.c +++ b/clang/test/Driver/x86-target-features.c @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits