From 85e01c0bdca413339ec575049e0580a80fb5f85d Mon Sep 17 00:00:00 2001 From: Kuba Brecka Date: Fri, 6 Nov 2015 15:09:20 +0000 Subject: [PATCH] [tsan] Add Clang frontend support for TSan on OS X We're currently in process of porting TSan to OS X, and quite a few of the initial support in the runtime library has already landed in trunk. This patch actually enables "-fsanitize=thread" in the frontend. Differential Revision: http://reviews.llvm.org/D14440 llvm-svn: 252310 --- clang/lib/Driver/ToolChains.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index 43a8ff657dd7..d39bfaa4bec1 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/lib/Driver/ToolChains.cpp @@ -389,6 +389,8 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args, AddLinkSanitizerLibArgs(Args, CmdArgs, "asan"); if (Sanitize.needsUbsanRt()) AddLinkSanitizerLibArgs(Args, CmdArgs, "ubsan"); + if (Sanitize.needsTsanRt()) + AddLinkSanitizerLibArgs(Args, CmdArgs, "tsan"); // Otherwise link libSystem, then the dynamic runtime library, and finally any // target specific static runtime library. @@ -1199,6 +1201,7 @@ SanitizerMask Darwin::getSupportedSanitizers() const { if (!isMacosxVersionLT(10, 9)) Res |= SanitizerKind::Vptr; Res |= SanitizerKind::SafeStack; + Res |= SanitizerKind::Thread; } return Res; }