r247324 - Driver: Support cfi-icall on all OSs when targeting x86/x86_64.

Peter Collingbourne via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 10 12:18:06 PDT 2015


Author: pcc
Date: Thu Sep 10 14:18:05 2015
New Revision: 247324

URL: http://llvm.org/viewvc/llvm-project?rev=247324&view=rev
Log:
Driver: Support cfi-icall on all OSs when targeting x86/x86_64.

Modified:
    cfe/trunk/lib/Driver/ToolChain.cpp
    cfe/trunk/lib/Driver/ToolChains.cpp
    cfe/trunk/test/Driver/fsanitize.c

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=247324&r1=247323&r2=247324&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Thu Sep 10 14:18:05 2015
@@ -493,8 +493,12 @@ bool ToolChain::AddFastMathRuntimeIfAvai
 
 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;
 }

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=247324&r1=247323&r2=247324&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Sep 10 14:18:05 2015
@@ -3764,7 +3764,6 @@ SanitizerMask Linux::getSupportedSanitiz
   if (IsX86_64 || IsMIPS64 || IsPowerPC64)
     Res |= SanitizerKind::Memory;
   if (IsX86 || IsX86_64) {
-    Res |= SanitizerKind::CFIICall;
     Res |= SanitizerKind::Function;
     Res |= SanitizerKind::SafeStack;
   }

Modified: cfe/trunk/test/Driver/fsanitize.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsanitize.c?rev=247324&r1=247323&r2=247324&view=diff
==============================================================================
--- cfe/trunk/test/Driver/fsanitize.c (original)
+++ cfe/trunk/test/Driver/fsanitize.c Thu Sep 10 14:18:05 2015
@@ -230,6 +230,7 @@
 // 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




More information about the cfe-commits mailing list