]> granicus.if.org Git - clang/commitdiff
[Driver] Enable SafeStack for Fuchsia targets
authorPetr Hosek <phosek@chromium.org>
Fri, 24 Feb 2017 03:17:41 +0000 (03:17 +0000)
committerPetr Hosek <phosek@chromium.org>
Fri, 24 Feb 2017 03:17:41 +0000 (03:17 +0000)
The runtime support is provided directly by the Fuchsia system C
library.

Patch by Roland McGrath

Differential Revision: https://reviews.llvm.org/D30238

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296082 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains.cpp
lib/Driver/ToolChains.h
test/Driver/fuchsia.c

index 533206e40613cf237e77f689e934dc98eed80254..495cc0a73b7e14d08561d58e6c9ef86725b541b5 100644 (file)
@@ -4860,6 +4860,12 @@ void Fuchsia::AddCXXStdlibLibArgs(const ArgList &Args,
   CmdArgs.push_back("-lunwind");
 }
 
+SanitizerMask Fuchsia::getSupportedSanitizers() const {
+  SanitizerMask Res = ToolChain::getSupportedSanitizers();
+  Res |= SanitizerKind::SafeStack;
+  return Res;
+}
+
 /// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly.
 
 DragonFly::DragonFly(const Driver &D, const llvm::Triple &Triple,
index 8646efbf3887afe079c02a86cd887645c091926e..7810b76d1be35db3fe02667388c77d743e7593f1 100644 (file)
@@ -1095,6 +1095,8 @@ public:
     return llvm::DebuggerKind::GDB;
   }
 
+  SanitizerMask getSupportedSanitizers() const override;
+
   RuntimeLibType
   GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
   CXXStdlibType
index 75172edf6b2744c6f69c694236d9366bbbfce33d..58c2bbe533c9020496f1e3a391607d2fe601a3be 100644 (file)
@@ -38,3 +38,8 @@
 // CHECK-RELOCATABLE-NOT: "-pie"
 // CHECK-RELOCATABLE-NOT: "--build-id"
 // CHECK-RELOCATABLE: "-r"
+
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
+// RUN:     -fsanitize=safe-stack 2>&1 \
+// RUN:     | FileCheck %s -check-prefix=CHECK-SAFESTACK
+// CHECK-SAFESTACK: "-fsanitize=safe-stack"