r296082 - [Driver] Enable SafeStack for Fuchsia targets

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 23 19:17:41 PST 2017


Author: phosek
Date: Thu Feb 23 21:17:41 2017
New Revision: 296082

URL: http://llvm.org/viewvc/llvm-project?rev=296082&view=rev
Log:
[Driver] Enable SafeStack for Fuchsia targets

The runtime support is provided directly by the Fuchsia system C
library.

Patch by Roland McGrath

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

Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp
    cfe/trunk/lib/Driver/ToolChains.h
    cfe/trunk/test/Driver/fuchsia.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=296082&r1=296081&r2=296082&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Feb 23 21:17:41 2017
@@ -4860,6 +4860,12 @@ void Fuchsia::AddCXXStdlibLibArgs(const
   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,

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=296082&r1=296081&r2=296082&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Thu Feb 23 21:17:41 2017
@@ -1095,6 +1095,8 @@ public:
     return llvm::DebuggerKind::GDB;
   }
 
+  SanitizerMask getSupportedSanitizers() const override;
+
   RuntimeLibType
   GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
   CXXStdlibType

Modified: cfe/trunk/test/Driver/fuchsia.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fuchsia.c?rev=296082&r1=296081&r2=296082&view=diff
==============================================================================
--- cfe/trunk/test/Driver/fuchsia.c (original)
+++ cfe/trunk/test/Driver/fuchsia.c Thu Feb 23 21:17:41 2017
@@ -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"




More information about the cfe-commits mailing list