]> granicus.if.org Git - clang/commitdiff
Enable SafeStack for CloudABI.
authorEd Schouten <ed@nuxi.nl>
Wed, 17 Feb 2016 18:56:20 +0000 (18:56 +0000)
committerEd Schouten <ed@nuxi.nl>
Wed, 17 Feb 2016 18:56:20 +0000 (18:56 +0000)
Summary:
I've got a patchset in my home directory to integrate support for
SafeStack into CloudABI's C library. All of the CloudABI unit tests
still seem to pass. Pretty sweet!

This change adds the necessary changes to Clang to make
-fsanitize=safe-stack work on CloudABI. Without it, passing this command
line flag throws an error.

Reviewers: eugenis, samsonov

Differential Revision: http://reviews.llvm.org/D17243

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

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

index 6c5cdb275971c0d22edf135a1911376946cc4baa..165d5345a36493289580af9981dc0a928f856b28 100644 (file)
@@ -3000,6 +3000,12 @@ Tool *CloudABI::buildLinker() const {
   return new tools::cloudabi::Linker(*this);
 }
 
+SanitizerMask CloudABI::getSupportedSanitizers() const {
+  SanitizerMask Res = ToolChain::getSupportedSanitizers();
+  Res |= SanitizerKind::SafeStack;
+  return Res;
+}
+
 /// OpenBSD - OpenBSD tool chain which can call as(1) and ld(1) directly.
 
 OpenBSD::OpenBSD(const Driver &D, const llvm::Triple &Triple,
index 11e4c834b41a9023668e00b3aeb3e25f35a7704c..b956ac9405252e17f4cd8ec835da9b81bbaacf82 100644 (file)
@@ -617,6 +617,8 @@ public:
 
   bool isPIEDefault() const override { return false; }
 
+  SanitizerMask getSupportedSanitizers() const override;
+
 protected:
   Tool *buildLinker() const override;
 };
index 76f41018209ec3d8d79c175d6cef14275e7dcc23..0d6c4d6340c22cd1f19ac8cb043858023e58be35 100644 (file)
 // RUN: %clang -target powerpc64le-unknown-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-SANM
 // CHECK-SANM: "-fsanitize=memory"
 
+// RUN: %clang -target aarch64-unknown-cloudabi -fsanitize=safe-stack %s -### 2>&1 | FileCheck %s -check-prefix=SAFESTACK-CLOUDABI
+// RUN: %clang -target x86_64-unknown-cloudabi -fsanitize=safe-stack %s -### 2>&1 | FileCheck %s -check-prefix=SAFESTACK-CLOUDABI
+// SAFESTACK-CLOUDABI: "-fsanitize=safe-stack"
+
 // RUN: %clang -target x86_64-scei-ps4 -fsanitize=function -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSAN-UBSAN-PS4
 // CHECK-FSAN-UBSAN-PS4: unsupported option '-fsanitize=function' for target 'x86_64-scei-ps4'
 // RUN: %clang -target x86_64-scei-ps4 -fsanitize=function %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSAN-PS4