[clang] f08d86f - [RISCV] Default to -fsanitize=shadow-call-stack for Fuchsia
Roland McGrath via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 5 18:59:10 PST 2023
Author: Roland McGrath
Date: 2023-02-05T18:58:59-08:00
New Revision: f08d86fc7f4479d5f44d75c720201334682075b8
URL: https://github.com/llvm/llvm-project/commit/f08d86fc7f4479d5f44d75c720201334682075b8
DIFF: https://github.com/llvm/llvm-project/commit/f08d86fc7f4479d5f44d75c720201334682075b8.diff
LOG: [RISCV] Default to -fsanitize=shadow-call-stack for Fuchsia
The ShadowCallStack is the preferred and default ABI for Fuchsia.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D143357
Added:
Modified:
clang/lib/Driver/ToolChains/Fuchsia.cpp
clang/test/Driver/fuchsia.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index d0e035f205ae0..36bd93a4913c6 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -466,13 +466,13 @@ SanitizerMask Fuchsia::getDefaultSanitizers() const {
SanitizerMask Res;
switch (getTriple().getArch()) {
case llvm::Triple::aarch64:
+ case llvm::Triple::riscv64:
Res |= SanitizerKind::ShadowCallStack;
break;
case llvm::Triple::x86_64:
Res |= SanitizerKind::SafeStack;
break;
default:
- // TODO: Enable SafeStack on RISC-V once tested.
break;
}
return Res;
diff --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c
index a8bae5f655415..c785e3a52251c 100644
--- a/clang/test/Driver/fuchsia.c
+++ b/clang/test/Driver/fuchsia.c
@@ -31,6 +31,7 @@
// CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include"
// CHECK-AARCH64: "-fsanitize=shadow-call-stack"
+// CHECK-RISCV64: "-fsanitize=shadow-call-stack"
// CHECK-X86_64: "-fsanitize=safe-stack"
// CHECK: "-stack-protector" "2"
// CHECK-AARCH64: "-target-feature" "+outline-atomics"
More information about the cfe-commits
mailing list