[PATCH] D30238: [Driver] Enable SafeStack for Fuchsia targets

Roland McGrath via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 22 11:49:23 PST 2017


mcgrathr updated this revision to Diff 89393.
mcgrathr added a comment.

Added test case.


Repository:
  rL LLVM

https://reviews.llvm.org/D30238

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


Index: test/Driver/fuchsia.c
===================================================================
--- test/Driver/fuchsia.c
+++ test/Driver/fuchsia.c
@@ -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"
Index: lib/Driver/ToolChains.h
===================================================================
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -1095,6 +1095,8 @@
     return llvm::DebuggerKind::GDB;
   }
 
+  SanitizerMask getSupportedSanitizers() const override;
+
   RuntimeLibType
   GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
   CXXStdlibType
Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -4860,6 +4860,12 @@
   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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30238.89393.patch
Type: text/x-patch
Size: 1403 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170222/11dd241b/attachment.bin>


More information about the cfe-commits mailing list