[cfe-commits] r168918 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/asan-ld.c
Eric Christopher
echristo at gmail.com
Thu Nov 29 10:51:05 PST 2012
Author: echristo
Date: Thu Nov 29 12:51:05 2012
New Revision: 168918
URL: http://llvm.org/viewvc/llvm-project?rev=168918&view=rev
Log:
Make sure that we put the rest of the sanitizer libraries on the link line
before libstdc++ like we do with ubsan.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/asan-ld.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=168918&r1=168917&r2=168918&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Nov 29 12:51:05 2012
@@ -5423,9 +5423,13 @@
SanitizerArgs Sanitize(D, Args);
- // Call this before we add the C++ ABI library.
+ // Call these before we add the C++ ABI library.
if (Sanitize.needsUbsanRt())
addUbsanRTLinux(getToolChain(), Args, CmdArgs);
+ if (Sanitize.needsAsanRt())
+ addAsanRTLinux(getToolChain(), Args, CmdArgs);
+ if (Sanitize.needsTsanRt())
+ addTsanRTLinux(getToolChain(), Args, CmdArgs);
if (D.CCCIsCXX &&
!Args.hasArg(options::OPT_nostdlib) &&
@@ -5440,12 +5444,6 @@
CmdArgs.push_back("-lm");
}
- // Call this before we add the C run-time.
- if (Sanitize.needsAsanRt())
- addAsanRTLinux(getToolChain(), Args, CmdArgs);
- if (Sanitize.needsTsanRt())
- addTsanRTLinux(getToolChain(), Args, CmdArgs);
-
if (!Args.hasArg(options::OPT_nostdlib)) {
if (!Args.hasArg(options::OPT_nodefaultlibs)) {
if (Args.hasArg(options::OPT_static))
Modified: cfe/trunk/test/Driver/asan-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/asan-ld.c?rev=168918&r1=168917&r2=168918&view=diff
==============================================================================
--- cfe/trunk/test/Driver/asan-ld.c (original)
+++ cfe/trunk/test/Driver/asan-ld.c Thu Nov 29 12:51:05 2012
@@ -11,6 +11,19 @@
// CHECK-LINUX: "-lpthread"
// CHECK-LINUX: "-ldl"
// CHECK-LINUX: "-export-dynamic"
+
+// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-unknown-linux -fsanitize=address \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LINUX-CXX %s
+//
+// CHECK-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LINUX-CXX-NOT: "-lc"
+// CHECK-LINUX-CXX: libclang_rt.asan-i386.a"
+// CHECK-LINUX-CXX: "-lpthread"
+// CHECK-LINUX-CXX: "-ldl"
+// CHECK-LINUX-CXX: "-export-dynamic"
+// CHECK-LINUX-CXX: stdc++
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -target arm-linux-androideabi -fsanitize=address \
More information about the cfe-commits
mailing list