]> granicus.if.org Git - clang/commitdiff
[Driver] Support -fsanitize=function on Solaris/x86
authorRainer Orth <ro@gcc.gnu.org>
Tue, 30 Jul 2019 20:04:53 +0000 (20:04 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Tue, 30 Jul 2019 20:04:53 +0000 (20:04 +0000)
UBSan-Standalone-x86_64 :: TestCases/TypeCheck/Function/function.cpp currently
FAILs on Solaris/x86_64:

  clang-9: error: unsupported option '-fsanitize=function' for target 'x86_64-pc-solaris2.11'

AFAICS, there's nothing more to do then enable that sanitizer in the driver (for x86 only),
which is what this patch does, together with updating another testcase.

Tested on x86_64-pc-solaris2.11.

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

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

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

index 38f24d4cf7e74cd1d21757aa876927349851b56a..86b9ba9542f86b3efa6ea3a830998b28e6367b80 100644 (file)
@@ -177,6 +177,7 @@ Solaris::Solaris(const Driver &D, const llvm::Triple &Triple,
 
 SanitizerMask Solaris::getSupportedSanitizers() const {
   const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
+  const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
   SanitizerMask Res = ToolChain::getSupportedSanitizers();
   // FIXME: Omit X86_64 until 64-bit support is figured out.
   if (IsX86) {
@@ -184,6 +185,8 @@ SanitizerMask Solaris::getSupportedSanitizers() const {
     Res |= SanitizerKind::PointerCompare;
     Res |= SanitizerKind::PointerSubtract;
   }
+  if (IsX86 || IsX86_64)
+    Res |= SanitizerKind::Function;
   Res |= SanitizerKind::Vptr;
   return Res;
 }
index 2896eda5aaa0f4514e6d356c50f5eb1f2c6d19f7..9a2a3836d1543c1bc7c373e2654fb6fb821b3d6a 100644 (file)
 // RUN: %clang -target x86_64--netbsd -fsanitize=scudo %s -### 2>&1 | FileCheck %s -check-prefix=SCUDO-NETBSD
 // SCUDO-NETBSD: "-fsanitize=scudo"
 
+// RUN: %clang -target i386--solaris -fsanitize=function %s -### 2>&1 | FileCheck %s -check-prefix=FUNCTION-SOLARIS
+// RUN: %clang -target x86_64--solaris -fsanitize=function %s -### 2>&1 | FileCheck %s -check-prefix=FUNCTION-SOLARIS
+// FUNCTION-SOLARIS: "-fsanitize=function"
 
 
 // RUN: %clang -target x86_64-scei-ps4 -fsanitize=function -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSAN-UBSAN-PS4