[PATCH] D92245: -fstack-clash-protection: Return an actual error when used on unsupported OS
Sylvestre Ledru via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 27 12:51:12 PST 2020
sylvestre.ledru created this revision.
sylvestre.ledru added a reviewer: serge-sans-paille.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
sylvestre.ledru requested review of this revision.
$ clang-12: error: -fstack-clash-protection is not supported on Windows or Mac OS X
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92245
Files:
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/ToolChains/Clang.cpp
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3077,12 +3077,14 @@
}
}
-static void RenderSCPOptions(const ToolChain &TC, const ArgList &Args,
+static void RenderSCPOptions(const Driver &D, const ToolChain &TC, const ArgList &Args,
ArgStringList &CmdArgs) {
const llvm::Triple &EffectiveTriple = TC.getEffectiveTriple();
- if (!EffectiveTriple.isOSLinux())
+ if (EffectiveTriple.isOSWindows() || EffectiveTriple.isOSDarwin()) {
+ D.Diag(diag::err_drv_stack_clash_protection_unsupported_on_toolchain);
return;
+ }
if (!EffectiveTriple.isX86() && !EffectiveTriple.isSystemZ() &&
!EffectiveTriple.isPPC64())
@@ -5551,7 +5553,7 @@
CmdArgs.push_back(Args.MakeArgString("-mspeculative-load-hardening"));
RenderSSPOptions(D, TC, Args, CmdArgs, KernelOrKext);
- RenderSCPOptions(TC, Args, CmdArgs);
+ RenderSCPOptions(D, TC, Args, CmdArgs);
RenderTrivialAutoVarInitOptions(D, TC, Args, CmdArgs);
// Translate -mstackrealign
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -273,6 +273,8 @@
: Error<"%0 is not supported with -fembed-bitcode">;
def err_drv_bitcode_unsupported_on_toolchain : Error<
"-fembed-bitcode is not supported on versions of iOS prior to 6.0">;
+def err_drv_stack_clash_protection_unsupported_on_toolchain : Error<
+ "-fstack-clash-protection is not supported on Windows or Mac OS X">;
def err_drv_invalid_malign_branch_EQ : Error<
"invalid argument '%0' to -malign-branch=; each element must be one of: %1">;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92245.308106.patch
Type: text/x-patch
Size: 1867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201127/d22badb7/attachment.bin>
More information about the cfe-commits
mailing list