Skip to content

Commit

Permalink
[Driver] Support -fsanitize=function on Solaris/x86
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rorth committed Jul 30, 2019
1 parent 4e68530 commit 4377c48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Driver/ToolChains/Solaris.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,16 @@ 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) {
Res |= SanitizerKind::Address;
Res |= SanitizerKind::PointerCompare;
Res |= SanitizerKind::PointerSubtract;
}
if (IsX86 || IsX86_64)
Res |= SanitizerKind::Function;
Res |= SanitizerKind::Vptr;
return Res;
}
Expand Down
3 changes: 3 additions & 0 deletions test/Driver/fsanitize.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,9 @@
// 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
Expand Down

0 comments on commit 4377c48

Please sign in to comment.