summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Hahnfeld <hahnjo@hahnjo.de>2019-02-17 18:47:33 +0000
committerJonas Hahnfeld <hahnjo@hahnjo.de>2019-02-17 18:47:33 +0000
commit0a9cb239a6c91a709a98c96bbf60b6c006d5a07b (patch)
tree5a679033a904ae7ff22ab3f02f39a88144122daf
parent635b988578505eee09ff304974bc2a72becb66d3 (diff)
downloadbcm5719-llvm-0a9cb239a6c91a709a98c96bbf60b6c006d5a07b.tar.gz
bcm5719-llvm-0a9cb239a6c91a709a98c96bbf60b6c006d5a07b.zip
[compiler-rt] Fix broken sanitizer bots (hopefully)
According to the logs and local debugging there were two issues: 1) tsan tests listed libc++.a before the source file. That's usually ok for shared libraries, but the linker will not add symbols from a static library unless needed at that time. As a result the tests that rely upon symbols from the library (and not only include the headers) had undefined references. To solve this I'm adding a new substitution %link_libcxx_tsan which expands to libc++.a if available. 2) The target Fuzzer-x86_64-Test linked in SANITIZER_TEST_CXX_LIBRARIES which defaults to -lstdc++. This resulted in error messages like hidden symbol '_ZdlPv' is not defined locally hidden symbol '_Znwm' is not defined locally when using GNU gold (ld.bfd and lld are fine). Removing the linkage is fine because we build a custom libc++ for that purpose. llvm-svn: 354231
-rw-r--r--compiler-rt/lib/fuzzer/tests/CMakeLists.txt3
-rw-r--r--compiler-rt/test/tsan/dl_iterate_phdr.cc2
-rw-r--r--compiler-rt/test/tsan/dlclose.cc2
-rw-r--r--compiler-rt/test/tsan/ignore_lib0.cc2
-rw-r--r--compiler-rt/test/tsan/ignore_lib1.cc2
-rw-r--r--compiler-rt/test/tsan/ignore_lib2.cc2
-rw-r--r--compiler-rt/test/tsan/ignore_lib3.cc2
-rw-r--r--compiler-rt/test/tsan/ignore_lib4.cc2
-rw-r--r--compiler-rt/test/tsan/ignore_lib5.cc2
-rw-r--r--compiler-rt/test/tsan/libcxx/std_shared_ptr.cc2
-rw-r--r--compiler-rt/test/tsan/lit.cfg6
-rw-r--r--compiler-rt/test/tsan/load_shared_lib.cc2
-rw-r--r--compiler-rt/test/tsan/real_deadlock_detector_stress_test.cc2
13 files changed, 15 insertions, 16 deletions
diff --git a/compiler-rt/lib/fuzzer/tests/CMakeLists.txt b/compiler-rt/lib/fuzzer/tests/CMakeLists.txt
index 68d9d360673..141e3b7476a 100644
--- a/compiler-rt/lib/fuzzer/tests/CMakeLists.txt
+++ b/compiler-rt/lib/fuzzer/tests/CMakeLists.txt
@@ -17,9 +17,6 @@ set_target_properties(FuzzerUnitTests PROPERTIES FOLDER "Compiler-RT Tests")
set(LIBFUZZER_UNITTEST_LINK_FLAGS ${COMPILER_RT_UNITTEST_LINK_FLAGS})
list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS --driver-mode=g++)
-foreach(lib ${SANITIZER_TEST_CXX_LIBRARIES})
- list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -l${lib})
-endforeach()
if(NOT WIN32)
list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -lpthread)
endif()
diff --git a/compiler-rt/test/tsan/dl_iterate_phdr.cc b/compiler-rt/test/tsan/dl_iterate_phdr.cc
index 3c9821bf458..4a1fcc21c9c 100644
--- a/compiler-rt/test/tsan/dl_iterate_phdr.cc
+++ b/compiler-rt/test/tsan/dl_iterate_phdr.cc
@@ -1,5 +1,5 @@
// RUN: %clangxx_tsan -O1 %s -DBUILD_SO -fPIC -shared -o %t-so.so
-// RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -o %t && %run %t 2>&1 | FileCheck %s
// dl_iterate_phdr doesn't exist on OS X.
// UNSUPPORTED: darwin
diff --git a/compiler-rt/test/tsan/dlclose.cc b/compiler-rt/test/tsan/dlclose.cc
index d497fd704e4..6f0716d80c3 100644
--- a/compiler-rt/test/tsan/dlclose.cc
+++ b/compiler-rt/test/tsan/dlclose.cc
@@ -1,5 +1,5 @@
// RUN: %clangxx_tsan -O1 %s -DBUILD_SO -fPIC -shared -o %t-so.so
-// RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -o %t && %run %t 2>&1 | FileCheck %s
// Test case for
// https://github.com/google/sanitizers/issues/487
diff --git a/compiler-rt/test/tsan/ignore_lib0.cc b/compiler-rt/test/tsan/ignore_lib0.cc
index 2b217f21ff5..1d375336b1c 100644
--- a/compiler-rt/test/tsan/ignore_lib0.cc
+++ b/compiler-rt/test/tsan/ignore_lib0.cc
@@ -2,7 +2,7 @@
// RUN: mkdir %t-dir
// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib0.so
-// RUN: %clangxx_tsan -O1 %s -L%t-dir -lignore_lib0 -o %t
+// RUN: %clangxx_tsan -O1 %s -L%t-dir -lignore_lib0 %link_libcxx_tsan -o %t
// RUN: echo running w/o suppressions:
// RUN: env LD_LIBRARY_PATH=%t-dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} %deflake %run %t | FileCheck %s --check-prefix=CHECK-NOSUPP
// RUN: echo running with suppressions:
diff --git a/compiler-rt/test/tsan/ignore_lib1.cc b/compiler-rt/test/tsan/ignore_lib1.cc
index 1660cf3e41f..2a708eaab40 100644
--- a/compiler-rt/test/tsan/ignore_lib1.cc
+++ b/compiler-rt/test/tsan/ignore_lib1.cc
@@ -2,7 +2,7 @@
// RUN: mkdir %t-dir
// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib1.so
-// RUN: %clangxx_tsan -O1 %s -o %t-dir/executable
+// RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -o %t-dir/executable
// RUN: echo running w/o suppressions:
// RUN: %deflake %run %t-dir/executable | FileCheck %s --check-prefix=CHECK-NOSUPP
// RUN: echo running with suppressions:
diff --git a/compiler-rt/test/tsan/ignore_lib2.cc b/compiler-rt/test/tsan/ignore_lib2.cc
index e0dac567012..05b7c2ed915 100644
--- a/compiler-rt/test/tsan/ignore_lib2.cc
+++ b/compiler-rt/test/tsan/ignore_lib2.cc
@@ -3,7 +3,7 @@
// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib2_0.so
// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib2_1.so
-// RUN: %clangxx_tsan -O1 %s -o %t-dir/executable
+// RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -o %t-dir/executable
// RUN: %env_tsan_opts=suppressions='%s.supp' %deflake %run %t-dir/executable | FileCheck %s
// Tests that called_from_lib suppression matched against 2 libraries
diff --git a/compiler-rt/test/tsan/ignore_lib3.cc b/compiler-rt/test/tsan/ignore_lib3.cc
index a5af07fdd11..b1a3940d03b 100644
--- a/compiler-rt/test/tsan/ignore_lib3.cc
+++ b/compiler-rt/test/tsan/ignore_lib3.cc
@@ -2,7 +2,7 @@
// RUN: mkdir %t-dir
// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib3.so
-// RUN: %clangxx_tsan -O1 %s -o %t-dir/executable
+// RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -o %t-dir/executable
// RUN: %env_tsan_opts=suppressions='%s.supp' %deflake %run %t-dir/executable | FileCheck %s
// Tests that unloading of a library matched against called_from_lib suppression
diff --git a/compiler-rt/test/tsan/ignore_lib4.cc b/compiler-rt/test/tsan/ignore_lib4.cc
index da636ae3bf3..06241c7b89f 100644
--- a/compiler-rt/test/tsan/ignore_lib4.cc
+++ b/compiler-rt/test/tsan/ignore_lib4.cc
@@ -2,7 +2,7 @@
// RUN: mkdir %t-dir
// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -shared -o %t-dir/libignore_lib4.so
-// RUN: %clangxx_tsan -O1 %s -o %t-dir/executable
+// RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -o %t-dir/executable
// RUN: echo "called_from_lib:libignore_lib4.so" > %t-dir/executable.supp
// RUN: %env_tsan_opts=suppressions='%t-dir/executable.supp' %run %t-dir/executable 2>&1 | FileCheck %s
diff --git a/compiler-rt/test/tsan/ignore_lib5.cc b/compiler-rt/test/tsan/ignore_lib5.cc
index 43780daf7b6..81a1840c955 100644
--- a/compiler-rt/test/tsan/ignore_lib5.cc
+++ b/compiler-rt/test/tsan/ignore_lib5.cc
@@ -2,7 +2,7 @@
// RUN: mkdir %t-dir
// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib1.so
-// RUN: %clangxx_tsan -O1 %s -o %t-dir/executable
+// RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -o %t-dir/executable
// RUN: echo running w/o suppressions:
// RUN: %deflake %run %t-dir/executable | FileCheck %s --check-prefix=CHECK-NOSUPP
// RUN: echo running with suppressions:
diff --git a/compiler-rt/test/tsan/libcxx/std_shared_ptr.cc b/compiler-rt/test/tsan/libcxx/std_shared_ptr.cc
index 191a17cc798..e8e168a682f 100644
--- a/compiler-rt/test/tsan/libcxx/std_shared_ptr.cc
+++ b/compiler-rt/test/tsan/libcxx/std_shared_ptr.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -o %t && %run %t 2>&1 | FileCheck %s
#include <stdio.h>
#include <memory>
#include <thread>
diff --git a/compiler-rt/test/tsan/lit.cfg b/compiler-rt/test/tsan/lit.cfg
index eb5bdb21416..76d60cf41e3 100644
--- a/compiler-rt/test/tsan/lit.cfg
+++ b/compiler-rt/test/tsan/lit.cfg
@@ -61,8 +61,10 @@ if config.has_libcxx and config.host_os != 'Darwin':
libcxx_libdir = os.path.join(libcxx_path, "lib")
libcxx_a = os.path.join(libcxx_libdir, "libc++.a")
clang_tsan_cxxflags += ["-nostdinc++",
- "-I%s" % libcxx_incdir,
- libcxx_a]
+ "-I%s" % libcxx_incdir]
+ config.substitutions.append( ("%link_libcxx_tsan", libcxx_a) )
+else:
+ config.substitutions.append( ("%link_libcxx_tsan", "") )
def build_invocation(compile_flags):
return " " + " ".join([config.clang] + compile_flags) + " "
diff --git a/compiler-rt/test/tsan/load_shared_lib.cc b/compiler-rt/test/tsan/load_shared_lib.cc
index f02280895f8..a8939be4cee 100644
--- a/compiler-rt/test/tsan/load_shared_lib.cc
+++ b/compiler-rt/test/tsan/load_shared_lib.cc
@@ -3,7 +3,7 @@
// symbolized correctly.
// RUN: %clangxx_tsan -O1 %s -DBUILD_SO -fPIC -shared -o %t-so.so
-// RUN: %clangxx_tsan -O1 %s -o %t -rdynamic && %deflake %run %t | FileCheck %s
+// RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -o %t -rdynamic && %deflake %run %t | FileCheck %s
#ifdef BUILD_SO
diff --git a/compiler-rt/test/tsan/real_deadlock_detector_stress_test.cc b/compiler-rt/test/tsan/real_deadlock_detector_stress_test.cc
index feb1117e80a..8106ab87222 100644
--- a/compiler-rt/test/tsan/real_deadlock_detector_stress_test.cc
+++ b/compiler-rt/test/tsan/real_deadlock_detector_stress_test.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -o %t && %run %t 2>&1 | FileCheck %s
#include <pthread.h>
#include <stdlib.h>
OpenPOWER on IntegriCloud