[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
Tue Dec 22 02:27:22 PST 2020
sylvestre.ledru updated this revision to Diff 313271.
sylvestre.ledru added a comment.
Error only on Windows
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92245/new/
https://reviews.llvm.org/D92245
Files:
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/ToolChains/Clang.cpp
llvm/test/CodeGen/X86/stack-clash-large.ll
Index: llvm/test/CodeGen/X86/stack-clash-large.ll
===================================================================
--- llvm/test/CodeGen/X86/stack-clash-large.ll
+++ llvm/test/CodeGen/X86/stack-clash-large.ll
@@ -1,5 +1,7 @@
; RUN: llc -mtriple=x86_64-linux-android < %s | FileCheck -check-prefix=CHECK-X86-64 %s
; RUN: llc -mtriple=i686-linux-android < %s | FileCheck -check-prefix=CHECK-X86-32 %s
+; RUN: llc -mtriple=x86_64-unknown-freebsd < %s | FileCheck -check-prefix=CHECK-X86-64 %s
+; RUN: llc -mtriple=x86_64-pc-linux-gnu < %s | FileCheck -check-prefix=CHECK-X86-64 %s
define i32 @foo() local_unnamed_addr #0 {
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3077,12 +3077,15 @@
}
}
-static void RenderSCPOptions(const ToolChain &TC, const ArgList &Args,
- ArgStringList &CmdArgs) {
+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()) {
+ D.Diag(diag::err_drv_stack_clash_protection_unsupported_on_toolchain)
+ << EffectiveTriple.getOSName();
return;
+ }
if (!EffectiveTriple.isX86() && !EffectiveTriple.isSystemZ() &&
!EffectiveTriple.isPPC64())
@@ -5551,7 +5554,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 %0">;
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.313271.patch
Type: text/x-patch
Size: 2546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201222/aa06ae13/attachment-0001.bin>
More information about the cfe-commits
mailing list