]> granicus.if.org Git - clang/commitdiff
Driver: Support cfi-icall on all OSs when targeting x86/x86_64.
authorPeter Collingbourne <peter@pcc.me.uk>
Thu, 10 Sep 2015 19:18:05 +0000 (19:18 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 10 Sep 2015 19:18:05 +0000 (19:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247324 91177308-0d34-0410-b5e6-96231b3b80d8

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

index e93487d28c212c4c75fd7b824981bac726a80e90..b3b3959af4d2c8cdc5d7b2795a4bd2cd015a5e5c 100644 (file)
@@ -493,8 +493,12 @@ bool ToolChain::AddFastMathRuntimeIfAvailable(const ArgList &Args,
 
 SanitizerMask ToolChain::getSupportedSanitizers() const {
   // Return sanitizers which don't require runtime support and are not
-  // platform or architecture-dependent.
+  // platform dependent.
   using namespace SanitizerKind;
-  return (Undefined & ~Vptr & ~Function) | (CFI & ~CFIICall) | CFICastStrict |
-         UnsignedIntegerOverflow | LocalBounds;
+  SanitizerMask Res = (Undefined & ~Vptr & ~Function) | (CFI & ~CFIICall) |
+                      CFICastStrict | UnsignedIntegerOverflow | LocalBounds;
+  if (getTriple().getArch() == llvm::Triple::x86 ||
+      getTriple().getArch() == llvm::Triple::x86_64)
+    Res |= CFIICall;
+  return Res;
 }
index c3f9b5876d71fec46b41c505ef2c0d5e5f194e1d..7f0b9bb7472269310ba1cd8dbcda25018e3f57ca 100644 (file)
@@ -3764,7 +3764,6 @@ SanitizerMask Linux::getSupportedSanitizers() const {
   if (IsX86_64 || IsMIPS64 || IsPowerPC64)
     Res |= SanitizerKind::Memory;
   if (IsX86 || IsX86_64) {
-    Res |= SanitizerKind::CFIICall;
     Res |= SanitizerKind::Function;
     Res |= SanitizerKind::SafeStack;
   }
index ce140e58c9630369fac73c7ed7f08da7a05900cb..93289acf0be665c7ce5b01f0405da50297b4c6a8 100644 (file)
 // CHECK-ASAN-OPENBSD: unsupported option '-fsanitize=address' for target 'i386-pc-openbsd'
 
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI
+// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=cfi -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi-derived-cast -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-DCAST
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi-unrelated-cast -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-UCAST
 // RUN: %clang -target x86_64-linux-gnu -flto -fsanitize=cfi-nvcall -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NVCALL