Remove restriction on combining ubsan with asan or tsan. This has worked for a while.

llvm-svn: 169066
This commit is contained in:
Richard Smith 2012-12-01 01:02:45 +00:00
parent c401755f46
commit 06d87f1e5d
2 changed files with 8 additions and 9 deletions

View File

@ -1466,14 +1466,12 @@ SanitizerArgs::SanitizerArgs(const Driver &D, const ArgList &Args) {
}
// Only one runtime library can be used at once.
// FIXME: Allow Ubsan to be combined with the other two.
bool NeedsAsan = needsAsanRt();
bool NeedsTsan = needsTsanRt();
bool NeedsUbsan = needsUbsanRt();
if (NeedsAsan + NeedsTsan + NeedsUbsan > 1)
if (NeedsAsan && NeedsTsan)
D.Diag(diag::err_drv_argument_not_allowed_with)
<< lastArgumentForKind(D, Args, NeedsAsan ? NeedsAsanRt : NeedsTsanRt)
<< lastArgumentForKind(D, Args, NeedsUbsan ? NeedsUbsanRt : NeedsTsanRt);
<< lastArgumentForKind(D, Args, NeedsAsanRt)
<< lastArgumentForKind(D, Args, NeedsTsanRt);
// If -fsanitize contains extra features of ASan, it should also
// explicitly contain -fsanitize=address.
@ -1545,6 +1543,7 @@ static void addUbsanRTLinux(const ToolChain &TC, const ArgList &Args,
TC.getArchName() + ".a"));
CmdArgs.push_back(Args.MakeArgString(LibUbsan));
CmdArgs.push_back("-lpthread");
CmdArgs.push_back("-export-dynamic");
}
}

View File

@ -26,11 +26,11 @@
// RUN: %clang -target x86_64-linux-gnu -fsanitize=init-order %s -c -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-EXTRA-ASAN
// CHECK-ONLY-EXTRA-ASAN: argument '-fsanitize=init-order' only allowed with '-fsanitize=address'
// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize=alignment -fsanitize=vptr -fno-sanitize=vptr %s -c -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-UBSAN-ASAN
// CHECK-UBSAN-ASAN: '-fsanitize=address' not allowed with '-fsanitize=alignment'
// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize=alignment -fsanitize=vptr -fno-sanitize=vptr %s -c -o /dev/null 2>&1
// OK
// RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -c -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-UBSAN-ASAN
// CHECK-VPTR-UBSAN-ASAN: '-fsanitize=address' not allowed with '-fsanitize=undefined'
// RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -c -o /dev/null 2>&1
// OK
// RUN: %clang -target x86_64-linux-gnu -fcatch-undefined-behavior -fthread-sanitizer -fno-thread-sanitizer -faddress-sanitizer -fno-address-sanitizer -fbounds-checking -c -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=CHECK-DEPRECATED
// CHECK-DEPRECATED: argument '-fcatch-undefined-behavior' is deprecated, use '-fsanitize=undefined' instead