-
Notifications
You must be signed in to change notification settings - Fork 15k
[Clang] Restore SafeStack support for x86-32 Fuchsia #165471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fuchsia does not fully support an x86-32 (i?86-fuchsia) target. But the x86_64-fuchsia target in -m32 mode is used when building some kernel / boot-loader related code. This narrow use of an (effective) i?86-fuchsia target still supports SafeStack using the same Fuchsia-specific ABI as x86_64-fuchsia.
|
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-driver Author: Roland McGrath (frobtech) ChangesFuchsia does not fully support an x86-32 (i?86-fuchsia) target. Full diff: https://github.com/llvm/llvm-project/pull/165471.diff 2 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index 31c2f3f7e1be4..507cc03b27513 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -483,7 +483,8 @@ SanitizerMask Fuchsia::getSupportedSanitizers() const {
Res |= SanitizerKind::Leak;
Res |= SanitizerKind::Scudo;
Res |= SanitizerKind::Thread;
- if (getTriple().getArch() == llvm::Triple::x86_64) {
+ if (getTriple().getArch() == llvm::Triple::x86_64 ||
+ getTriple().getArch() == llvm::Triple::x86) {
Res |= SanitizerKind::SafeStack;
}
return Res;
@@ -496,6 +497,7 @@ SanitizerMask Fuchsia::getDefaultSanitizers() const {
case llvm::Triple::riscv64:
Res |= SanitizerKind::ShadowCallStack;
break;
+ case llvm::Triple::x86:
case llvm::Triple::x86_64:
Res |= SanitizerKind::SafeStack;
break;
diff --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c
index d0fec18e13a20..99e5018117924 100644
--- a/clang/test/Driver/fuchsia.c
+++ b/clang/test/Driver/fuchsia.c
@@ -130,6 +130,11 @@
// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
// RUN: -fuse-ld=ld \
// RUN: | FileCheck %s -check-prefix=CHECK-SAFESTACK
+// RUN: %clang -### %s --target=x86_64-unknown-fuchsia -m32 \
+// RUN: -fsanitize=safe-stack 2>&1 \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN: -fuse-ld=ld \
+// RUN: | FileCheck %s -check-prefix=CHECK-SAFESTACK
// CHECK-SAFESTACK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-SAFESTACK: "-fsanitize=safe-stack"
// CHECK-SAFESTACK-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.safestack.a"
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/169/builds/16472 Here is the relevant piece of the build log for the reference |
Fuchsia does not fully support an x86-32 (i?86-fuchsia) target. But the x86_64-fuchsia target in -m32 mode is used when building some kernel / boot-loader related code. This narrow use of an (effective) i?86-fuchsia target still supports SafeStack using the same Fuchsia-specific ABI as x86_64-fuchsia.
Fuchsia does not fully support an x86-32 (i?86-fuchsia) target.
But the x86_64-fuchsia target in -m32 mode is used when building
some kernel / boot-loader related code. This narrow use of an
(effective) i?86-fuchsia target still supports SafeStack using
the same Fuchsia-specific ABI as x86_64-fuchsia.