summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-12-17 23:46:49 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-12-17 23:46:49 +0000
commit658e2d274d98d44d2736da9fc77da7b9494e877a (patch)
tree82b3f9bab00d6c3e53fc7dd95e6ac67be5dbd730
parent518a7b25852392a305319706293eacc31e2945bc (diff)
downloadbcm5719-llvm-658e2d274d98d44d2736da9fc77da7b9494e877a.tar.gz
bcm5719-llvm-658e2d274d98d44d2736da9fc77da7b9494e877a.zip
[ASan] Add -ldl to linker invocation to lit tests that require it.
This fixes these tests under dynamic ASan runtime. llvm-svn: 224473
-rw-r--r--compiler-rt/test/asan/TestCases/Linux/coverage-direct.cc2
-rw-r--r--compiler-rt/test/asan/TestCases/Linux/coverage-module-unloaded.cc2
-rw-r--r--compiler-rt/test/asan/TestCases/Linux/stack-trace-dlclose.cc2
-rw-r--r--compiler-rt/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cc2
-rw-r--r--compiler-rt/test/asan/TestCases/Posix/init-order-dlopen.cc4
-rw-r--r--compiler-rt/test/asan/TestCases/Posix/shared-lib-test.cc8
-rw-r--r--compiler-rt/test/asan/TestCases/Posix/start-deactivated.cc2
-rw-r--r--compiler-rt/test/asan/TestCases/dlclose-test.cc8
-rw-r--r--compiler-rt/test/asan/lit.cfg14
9 files changed, 24 insertions, 20 deletions
diff --git a/compiler-rt/test/asan/TestCases/Linux/coverage-direct.cc b/compiler-rt/test/asan/TestCases/Linux/coverage-direct.cc
index 2cc1aed0a0f..770ff90f35e 100644
--- a/compiler-rt/test/asan/TestCases/Linux/coverage-direct.cc
+++ b/compiler-rt/test/asan/TestCases/Linux/coverage-direct.cc
@@ -1,6 +1,6 @@
// Test for direct coverage writing with dlopen.
// RUN: %clangxx_asan -fsanitize-coverage=1 -DSHARED %s -shared -o %T/libcoverage_direct_test_1.so -fPIC
-// RUN: %clangxx_asan -fsanitize-coverage=1 -DSO_DIR=\"%T\" %s -o %t
+// RUN: %clangxx_asan -fsanitize-coverage=1 -DSO_DIR=\"%T\" %s %libdl -o %t
// RUN: rm -rf %T/coverage-direct
diff --git a/compiler-rt/test/asan/TestCases/Linux/coverage-module-unloaded.cc b/compiler-rt/test/asan/TestCases/Linux/coverage-module-unloaded.cc
index 449841e7818..f8d9c57f81b 100644
--- a/compiler-rt/test/asan/TestCases/Linux/coverage-module-unloaded.cc
+++ b/compiler-rt/test/asan/TestCases/Linux/coverage-module-unloaded.cc
@@ -2,7 +2,7 @@
// modules.
// RUN: %clangxx_asan -fsanitize-coverage=1 -DSHARED %s -shared -o %T/libcoverage_module_unloaded_test_1.so -fPIC
// RUN: %clangxx_asan -fsanitize-coverage=1 -DSHARED %s -shared -o %T/libcoverage_module_unloaded_test_2.so -fPIC
-// RUN: %clangxx_asan -fsanitize-coverage=1 -DSO_DIR=\"%T\" %s -o %t
+// RUN: %clangxx_asan -fsanitize-coverage=1 -DSO_DIR=\"%T\" %s %libdl -o %t
// RUN: export ASAN_OPTIONS=coverage=1:verbosity=1
// RUN: mkdir -p %T/coverage-module-unloaded && cd %T/coverage-module-unloaded
// RUN: %run %t 2>&1 | FileCheck %s
diff --git a/compiler-rt/test/asan/TestCases/Linux/stack-trace-dlclose.cc b/compiler-rt/test/asan/TestCases/Linux/stack-trace-dlclose.cc
index e494e5661d1..b3bd9f7780f 100644
--- a/compiler-rt/test/asan/TestCases/Linux/stack-trace-dlclose.cc
+++ b/compiler-rt/test/asan/TestCases/Linux/stack-trace-dlclose.cc
@@ -2,7 +2,7 @@
// XFAIL: android
//
// RUN: %clangxx_asan -DSHARED %s -shared -o %T/stack_trace_dlclose.so -fPIC
-// RUN: %clangxx_asan -DSO_DIR=\"%T\" %s -o %t
+// RUN: %clangxx_asan -DSO_DIR=\"%T\" %s %libdl -o %t
// RUN: ASAN_OPTIONS=exitcode=0 %run %t 2>&1 | FileCheck %s
// XFAIL: arm-linux-gnueabi
// XFAIL: armv7l-unknown-linux-gnueabihf
diff --git a/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cc b/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cc
index 6ed02f4d537..3ce6446eca2 100644
--- a/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cc
+++ b/compiler-rt/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cc
@@ -5,7 +5,7 @@
// shared object files.
// RUN: %clangxx_asan -O0 -DSHARED_LIB %s -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O0 %s -o %t
+// RUN: %clangxx_asan -O0 %s %libdl -o %t
// RUN: env ASAN_OPTIONS=symbolize=0 not %run %t 2>&1 | %asan_symbolize | FileCheck %s
// XFAIL: arm-linux-gnueabi
// XFAIL: armv7l-unknown-linux-gnueabihf
diff --git a/compiler-rt/test/asan/TestCases/Posix/init-order-dlopen.cc b/compiler-rt/test/asan/TestCases/Posix/init-order-dlopen.cc
index 6f204775eb4..3c6f093b03d 100644
--- a/compiler-rt/test/asan/TestCases/Posix/init-order-dlopen.cc
+++ b/compiler-rt/test/asan/TestCases/Posix/init-order-dlopen.cc
@@ -10,8 +10,8 @@
// If the linker doesn't support --export-dynamic (which is ELF-specific),
// try to link without that option.
// FIXME: find a better solution.
-// RUN: %clangxx_asan -O0 %s -pthread -o %t -Wl,--export-dynamic || \
-// RUN: %clangxx_asan -O0 %s -pthread -o %t
+// RUN: %clangxx_asan -O0 %s -pthread %libdl -o %t -Wl,--export-dynamic || \
+// RUN: %clangxx_asan -O0 %s -pthread %libdl -o %t
// RUN: ASAN_OPTIONS=strict_init_order=true %run %t 2>&1 | FileCheck %s
#if !defined(SHARED_LIB)
#include <dlfcn.h>
diff --git a/compiler-rt/test/asan/TestCases/Posix/shared-lib-test.cc b/compiler-rt/test/asan/TestCases/Posix/shared-lib-test.cc
index a0827b5fefb..305942a0792 100644
--- a/compiler-rt/test/asan/TestCases/Posix/shared-lib-test.cc
+++ b/compiler-rt/test/asan/TestCases/Posix/shared-lib-test.cc
@@ -1,11 +1,11 @@
// RUN: %clangxx_asan -O0 -DSHARED_LIB %s -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O0 %s %libdl -o %t && not %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O1 -DSHARED_LIB %s -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O1 %s %libdl -o %t && not %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O2 -DSHARED_LIB %s -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O2 %s %libdl -o %t && not %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O3 -DSHARED_LIB %s -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O3 %s %libdl -o %t && not %run %t 2>&1 | FileCheck %s
// XFAIL: arm-linux-gnueabi
#if !defined(SHARED_LIB)
diff --git a/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cc b/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cc
index d60677a8a5b..2280e2af03f 100644
--- a/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cc
+++ b/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cc
@@ -4,7 +4,7 @@
// RUN: %clangxx_asan -O0 -DSHARED_LIB %s -fPIC -shared -o %t-so.so
// RUN: %clangxx -O0 %s -c -o %t.o
-// RUN: %clangxx_asan -O0 %t.o -o %t
+// RUN: %clangxx_asan -O0 %t.o %libdl -o %t
// RUN: ASAN_OPTIONS=start_deactivated=1 not %run %t 2>&1 | FileCheck %s
// XFAIL: arm-linux-gnueabi
// XFAIL: armv7l-unknown-linux-gnueabihf
diff --git a/compiler-rt/test/asan/TestCases/dlclose-test.cc b/compiler-rt/test/asan/TestCases/dlclose-test.cc
index 094453f3de2..2d31aee5a32 100644
--- a/compiler-rt/test/asan/TestCases/dlclose-test.cc
+++ b/compiler-rt/test/asan/TestCases/dlclose-test.cc
@@ -15,13 +15,13 @@
// REQUIRES: x86_64-supported-target,i386-supported-target
// RUN: %clangxx_asan -O0 -DSHARED_LIB %s -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O0 %s %libdl -o %t && %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O1 -DSHARED_LIB %s -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O1 %s %libdl -o %t && %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O2 -DSHARED_LIB %s -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O2 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O2 %s %libdl -o %t && %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O3 -DSHARED_LIB %s -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O3 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O3 %s %libdl -o %t && %run %t 2>&1 | FileCheck %s
#if !defined(SHARED_LIB)
#include <assert.h>
diff --git a/compiler-rt/test/asan/lit.cfg b/compiler-rt/test/asan/lit.cfg
index 82a36de9cdd..a2899ea8a7b 100644
--- a/compiler-rt/test/asan/lit.cfg
+++ b/compiler-rt/test/asan/lit.cfg
@@ -28,17 +28,19 @@ config.name = 'AddressSanitizer' + config.name_suffix
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
+# There is no libdl on FreeBSD.
+if config.host_os != 'FreeBSD':
+ libdl_flag = "-ldl"
+else:
+ libdl_flag = ""
+
# GCC-ASan doesn't link in all the necessary libraries automatically, so
# we have to do it ourselves.
if config.compiler_id == 'GNU':
- extra_linkflags = ["-pthread", "-lstdc++"]
+ extra_linkflags = ["-pthread", "-lstdc++", libdl_flag]
else:
extra_linkflags = []
-# There is no libdl on FreeBSD.
-if config.compiler_id == 'GNU' and config.host_os != 'FreeBSD':
- extra_linkflags += ["-ldl"]
-
# Setup default compiler flags used with -fsanitize=address option.
# FIXME: Review the set of required flags and check if it can be reduced.
target_cflags = [get_required_attr(config, "target_cflags")] + extra_linkflags
@@ -121,6 +123,8 @@ else:
config.substitutions.append( ('CHECK-%kernel_bits', ("CHECK-kernel-" + kernel_bits + "-bits")))
+config.substitutions.append( ("%libdl", libdl_flag) )
+
config.available_features.add("asan-" + config.bits + "-bits")
# Allow tests to use REQUIRES=stable-runtime. For use when you cannot use XFAIL
OpenPOWER on IntegriCloud