r245344 - [sanitizer] Add -lutil to static runtime link flags.
Evgeniy Stepanov via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 18 13:36:11 PDT 2015
Author: eugenis
Date: Tue Aug 18 15:36:11 2015
New Revision: 245344
URL: http://llvm.org/viewvc/llvm-project?rev=245344&view=rev
Log:
[sanitizer] Add -lutil to static runtime link flags.
This is needed to prevent breakage of -Wl,-as-needed link when
interceptors for functions in libutil are added. See PR15823.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/sanitizer-ld.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=245344&r1=245343&r2=245344&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Aug 18 15:36:11 2015
@@ -2498,6 +2498,7 @@ static void linkSanitizerRuntimeDeps(con
CmdArgs.push_back("--no-as-needed");
CmdArgs.push_back("-lpthread");
CmdArgs.push_back("-lrt");
+ CmdArgs.push_back("-lutil");
CmdArgs.push_back("-lm");
// There's no libdl on FreeBSD.
if (TC.getTriple().getOS() != llvm::Triple::FreeBSD)
Modified: cfe/trunk/test/Driver/sanitizer-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/sanitizer-ld.c?rev=245344&r1=245343&r2=245344&view=diff
==============================================================================
--- cfe/trunk/test/Driver/sanitizer-ld.c (original)
+++ cfe/trunk/test/Driver/sanitizer-ld.c Tue Aug 18 15:36:11 2015
@@ -14,6 +14,7 @@
// CHECK-ASAN-LINUX-NOT: "-export-dynamic"
// CHECK-ASAN-LINUX: "-lpthread"
// CHECK-ASAN-LINUX: "-lrt"
+// CHECK-ASAN-LINUX: "-lutil"
// CHECK-ASAN-LINUX: "-ldl"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -29,6 +30,7 @@
// CHECK-SHARED-ASAN-LINUX: "-whole-archive" "{{.*}}libclang_rt.asan-preinit-i386.a" "-no-whole-archive"
// CHECK-SHARED-ASAN-LINUX-NOT: "-lpthread"
// CHECK-SHARED-ASAN-LINUX-NOT: "-lrt"
+// CHECK-SHARED-ASAN-LINUX-NOT: "-lutil"
// CHECK-SHARED-ASAN-LINUX-NOT: "-ldl"
// CHECK-SHARED-ASAN-LINUX-NOT: "-export-dynamic"
// CHECK-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
@@ -46,6 +48,7 @@
// CHECK-DSO-SHARED-ASAN-LINUX: libclang_rt.asan-i386.so"
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lpthread"
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lrt"
+// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lutil"
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-ldl"
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-export-dynamic"
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
@@ -65,6 +68,7 @@
// CHECK-ASAN-FREEBSD: "-export-dynamic"
// CHECK-ASAN-FREEBSD: "-lpthread"
// CHECK-ASAN-FREEBSD: "-lrt"
+// CHECK-ASAN-FREEBSD: "-lutil"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -target i386-unknown-freebsd -fsanitize=address \
@@ -90,6 +94,7 @@
// CHECK-ASAN-LINUX-CXX: stdc++
// CHECK-ASAN-LINUX-CXX: "-lpthread"
// CHECK-ASAN-LINUX-CXX: "-lrt"
+// CHECK-ASAN-LINUX-CXX: "-lutil"
// CHECK-ASAN-LINUX-CXX: "-ldl"
// RUN: %clang -no-canonical-prefixes %s -### -o /dev/null -fsanitize=address \
@@ -167,6 +172,7 @@
// CHECK-TSAN-LINUX-CXX: stdc++
// CHECK-TSAN-LINUX-CXX: "-lpthread"
// CHECK-TSAN-LINUX-CXX: "-lrt"
+// CHECK-TSAN-LINUX-CXX: "-lutil"
// CHECK-TSAN-LINUX-CXX: "-ldl"
// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -185,6 +191,7 @@
// CHECK-MSAN-LINUX-CXX: stdc++
// CHECK-MSAN-LINUX-CXX: "-lpthread"
// CHECK-MSAN-LINUX-CXX: "-lrt"
+// CHECK-MSAN-LINUX-CXX: "-lutil"
// CHECK-MSAN-LINUX-CXX: "-ldl"
// RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
More information about the cfe-commits
mailing list