forked from OSchip/llvm-project
[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
This commit is contained in:
parent
635b988578
commit
0a9cb239a6
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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) + " "
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue