diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2015-06-17 22:27:32 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2015-06-17 22:27:32 +0000 |
commit | 9bc2ad5e6c0b2a2e87a2dc3d34f401fc8c33cac5 (patch) | |
tree | fb067f87d9f59227c2bf322289a10c88a3157c6d /clang/lib/Driver/ToolChains.cpp | |
parent | 6f1e05f388f7c890e6aaeab163864c9d8367a980 (diff) | |
download | bcm5719-llvm-9bc2ad5e6c0b2a2e87a2dc3d34f401fc8c33cac5.tar.gz bcm5719-llvm-9bc2ad5e6c0b2a2e87a2dc3d34f401fc8c33cac5.zip |
Revert "[Sanitizers] Provide better diagnostic for sanitizers unsupported for target triple."
This reverts commit r239953, while I'm investigating assertion
failure from http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_check/9994/
llvm-svn: 239958
Diffstat (limited to 'clang/lib/Driver/ToolChains.cpp')
-rw-r--r-- | clang/lib/Driver/ToolChains.cpp | 75 |
1 files changed, 20 insertions, 55 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index aaaab9cecd2..e3dab2040fc 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/lib/Driver/ToolChains.cpp @@ -399,10 +399,26 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args, const SanitizerArgs &Sanitize = getSanitizerArgs(); - if (Sanitize.needsAsanRt()) - AddLinkSanitizerLibArgs(Args, CmdArgs, "asan"); - if (Sanitize.needsUbsanRt()) - AddLinkSanitizerLibArgs(Args, CmdArgs, "ubsan"); + + if (Sanitize.needsAsanRt()) { + if (!isTargetMacOS() && !isTargetIOSSimulator()) { + // FIXME: Move this check to SanitizerArgs::filterUnsupportedKinds. + getDriver().Diag(diag::err_drv_clang_unsupported_per_platform) + << "-fsanitize=address"; + } else { + AddLinkSanitizerLibArgs(Args, CmdArgs, "asan"); + } + } + + if (Sanitize.needsUbsanRt()) { + if (!isTargetMacOS() && !isTargetIOSSimulator()) { + // FIXME: Move this check to SanitizerArgs::filterUnsupportedKinds. + getDriver().Diag(diag::err_drv_clang_unsupported_per_platform) + << "-fsanitize=undefined"; + } else { + AddLinkSanitizerLibArgs(Args, CmdArgs, "ubsan"); + } + } // Otherwise link libSystem, then the dynamic runtime library, and finally any // target specific static runtime library. @@ -1081,18 +1097,6 @@ void Darwin::CheckObjCARC() const { getDriver().Diag(diag::err_arc_unsupported_on_toolchain); } -SanitizerMask Darwin::getSupportedSanitizers() const { - SanitizerMask Res = ToolChain::getSupportedSanitizers(); - if (isTargetMacOS() || isTargetIOSSimulator()) { - // ASan and UBSan are available on Mac OS and on iOS simulator. - Res |= SanitizerKind::Address; - Res |= SanitizerKind::Vptr; - } - if (isTargetMacOS()) - Res |= SanitizerKind::SafeStack; - return Res; -} - /// Generic_GCC - A tool chain using the 'gcc' command to perform /// all subcommands; this relies on gcc translating the majority of /// command line options. @@ -2733,24 +2737,6 @@ bool FreeBSD::isPIEDefault() const { return getSanitizerArgs().requiresPIE(); } -SanitizerMask FreeBSD::getSupportedSanitizers() const { - const bool IsX86 = getTriple().getArch() == llvm::Triple::x86; - const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64; - const bool IsMIPS64 = getTriple().getArch() == llvm::Triple::mips64 || - getTriple().getArch() == llvm::Triple::mips64el; - SanitizerMask Res = ToolChain::getSupportedSanitizers(); - Res |= SanitizerKind::Address; - Res |= SanitizerKind::Vptr; - if (IsX86_64 || IsMIPS64) { - Res |= SanitizerKind::Leak; - Res |= SanitizerKind::Thread; - } - if (IsX86 || IsX86_64) { - Res |= SanitizerKind::SafeStack; - } - return Res; -} - /// NetBSD - NetBSD tool chain which can call as(1) and ld(1) directly. NetBSD::NetBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args) @@ -3655,27 +3641,6 @@ bool Linux::isPIEDefault() const { return getSanitizerArgs().requiresPIE(); } -SanitizerMask Linux::getSupportedSanitizers() const { - const bool IsX86 = getTriple().getArch() == llvm::Triple::x86; - const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64; - const bool IsMIPS64 = getTriple().getArch() == llvm::Triple::mips64 || - getTriple().getArch() == llvm::Triple::mips64el; - SanitizerMask Res = ToolChain::getSupportedSanitizers(); - Res |= SanitizerKind::Address; - Res |= SanitizerKind::Vptr; - if (IsX86_64 || IsMIPS64) { - Res |= SanitizerKind::DataFlow; - Res |= SanitizerKind::Leak; - Res |= SanitizerKind::Memory; - Res |= SanitizerKind::Thread; - } - if (IsX86 || IsX86_64) { - Res |= SanitizerKind::Function; - Res |= SanitizerKind::SafeStack; - } - return Res; -} - /// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly. DragonFly::DragonFly(const Driver &D, const llvm::Triple& Triple, const ArgList &Args) |