[PATCH] D79733: [clang][SLH] Add __has_feature(speculative_load_hardening)
Zola Bridges via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 11 12:56:12 PDT 2020
zbrid updated this revision to Diff 263247.
zbrid added a comment.
Change langopt type + SpeculativeLoadHardeningEnabled -> SpeculativeLoadHardening
This is to match the CodeGenOpt for SLH that already exists and to address
mattdr's feedback.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79733/new/
https://reviews.llvm.org/D79733
Files:
clang/include/clang/Basic/Features.def
clang/include/clang/Basic/LangOptions.def
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -3372,6 +3372,7 @@
}
Opts.BranchTargetEnforcement = Args.hasArg(OPT_mbranch_target_enforce);
+ Opts.SpeculativeLoadHardening = Args.hasArg(OPT_mspeculative_load_hardening);
}
static bool isStrictlyPreprocessorAction(frontend::ActionKind Action) {
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5354,8 +5354,8 @@
Args.AddLastArg(CmdArgs, options::OPT_pthread);
- if (Args.hasFlag(options::OPT_mspeculative_load_hardening, options::OPT_mno_speculative_load_hardening,
- false))
+ if (Args.hasFlag(options::OPT_mspeculative_load_hardening,
+ options::OPT_mno_speculative_load_hardening, false))
CmdArgs.push_back(Args.MakeArgString("-mspeculative-load-hardening"));
RenderSSPOptions(TC, Args, CmdArgs, KernelOrKext);
Index: clang/include/clang/Basic/LangOptions.def
===================================================================
--- clang/include/clang/Basic/LangOptions.def
+++ clang/include/clang/Basic/LangOptions.def
@@ -366,6 +366,8 @@
"Key used for return address signing")
LANGOPT(BranchTargetEnforcement, 1, 0, "Branch-target enforcement enabled")
+LANGOPT(SpeculativeLoadHardening, 1, 0, "Speculative load hardening enabled")
+
#undef LANGOPT
#undef COMPATIBLE_LANGOPT
#undef BENIGN_LANGOPT
Index: clang/include/clang/Basic/Features.def
===================================================================
--- clang/include/clang/Basic/Features.def
+++ clang/include/clang/Basic/Features.def
@@ -36,6 +36,7 @@
#define EXTENSION(Name, Predicate)
#endif
+FEATURE(speculative_load_hardening, LangOpts.SpeculativeLoadHardening)
FEATURE(address_sanitizer,
LangOpts.Sanitize.hasOneOf(SanitizerKind::Address |
SanitizerKind::KernelAddress))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79733.263247.patch
Type: text/x-patch
Size: 2148 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200511/21097e68/attachment-0001.bin>
More information about the cfe-commits
mailing list