summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test
diff options
context:
space:
mode:
authorJonas Hahnfeld <hahnjo@hahnjo.de>2019-02-17 12:16:20 +0000
committerJonas Hahnfeld <hahnjo@hahnjo.de>2019-02-17 12:16:20 +0000
commit66c60d9d714bed88765c1575fbf57e7582fd27a3 (patch)
tree10985015d08c8b88087c54ca15b17d75ff7ce8b3 /compiler-rt/test
parent91ecb69acdf4cffb4f879e12716465169848633e (diff)
downloadbcm5719-llvm-66c60d9d714bed88765c1575fbf57e7582fd27a3.tar.gz
bcm5719-llvm-66c60d9d714bed88765c1575fbf57e7582fd27a3.zip
[compiler-rt] Build custom libcxx with libcxxabi
This changes add_custom_libcxx to also build libcxxabi and merges the two into a static and hermetic library. There are multiple advantages: 1) The resulting libFuzzer doesn't expose C++ internals and looks like a plain C library. 2) We don't have to manually link in libstdc++ to provide cxxabi. 3) The sanitizer tests cannot interfere with an installed version of libc++.so in LD_LIBRARY_PATH. Differential Revision: https://reviews.llvm.org/D58013 llvm-svn: 354212
Diffstat (limited to 'compiler-rt/test')
-rw-r--r--compiler-rt/test/fuzzer/lit.cfg12
-rw-r--r--compiler-rt/test/msan/CMakeLists.txt4
-rw-r--r--compiler-rt/test/tsan/CMakeLists.txt1
-rw-r--r--compiler-rt/test/tsan/Linux/check_memcpy.c (renamed from compiler-rt/test/tsan/Linux/check_memcpy.cc)6
-rw-r--r--compiler-rt/test/tsan/lit.cfg7
-rw-r--r--compiler-rt/test/tsan/static_init6.cc3
6 files changed, 11 insertions, 22 deletions
diff --git a/compiler-rt/test/fuzzer/lit.cfg b/compiler-rt/test/fuzzer/lit.cfg
index eff9a5508fa..1bc1d7d7bc3 100644
--- a/compiler-rt/test/fuzzer/lit.cfg
+++ b/compiler-rt/test/fuzzer/lit.cfg
@@ -63,17 +63,6 @@ config.substitutions.append(('%libfuzzer_src', libfuzzer_src_root))
def generate_compiler_cmd(is_cpp=True, fuzzer_enabled=True, msan_enabled=False):
compiler_cmd = config.clang
extra_cmd = config.target_flags
- if config.clang and config.stdlib == 'libc++':
- link_cmd = '-stdlib=libc++ -Wl,-rpath=%s' % config.runtime_library_dir
- elif config.clang and config.stdlib == 'static-libc++':
- link_cmd = '-stdlib=libc++ -lc++abi -static-libstdc++ -Wl,-rpath=%s' % (
- config.runtime_library_dir)
- elif any(x in config.target_triple for x in ('darwin', 'freebsd')):
- link_cmd = '-lc++'
- elif 'windows-msvc' in config.target_triple:
- link_cmd = ''
- else:
- link_cmd = '-lstdc++'
if is_cpp and 'windows-msvc' in config.target_triple:
std_cmd = '--driver-mode=cl'
@@ -92,7 +81,6 @@ def generate_compiler_cmd(is_cpp=True, fuzzer_enabled=True, msan_enabled=False):
return " ".join([
compiler_cmd,
std_cmd,
- link_cmd,
"-O2 -gline-tables-only",
sanitizers_cmd,
"-I%s" % libfuzzer_src_root,
diff --git a/compiler-rt/test/msan/CMakeLists.txt b/compiler-rt/test/msan/CMakeLists.txt
index 7919a6cd2ea..c6408c1edb0 100644
--- a/compiler-rt/test/msan/CMakeLists.txt
+++ b/compiler-rt/test/msan/CMakeLists.txt
@@ -43,7 +43,9 @@ if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND MSAN_TEST_DEPS msan)
endif()
-if(COMPILER_RT_INCLUDE_TESTS AND COMPILER_RT_LIBCXX_PATH)
+if(COMPILER_RT_INCLUDE_TESTS AND
+ COMPILER_RT_LIBCXX_PATH AND
+ COMPILER_RT_LIBCXXABI_PATH)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg)
diff --git a/compiler-rt/test/tsan/CMakeLists.txt b/compiler-rt/test/tsan/CMakeLists.txt
index ba0fd9f23a3..2dcf46eee4a 100644
--- a/compiler-rt/test/tsan/CMakeLists.txt
+++ b/compiler-rt/test/tsan/CMakeLists.txt
@@ -8,6 +8,7 @@ if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND TSAN_TEST_DEPS tsan)
endif()
if(COMPILER_RT_LIBCXX_PATH AND
+ COMPILER_RT_LIBCXXABI_PATH AND
COMPILER_RT_TEST_COMPILER_ID STREQUAL "Clang"
AND NOT APPLE AND NOT ANDROID)
list(APPEND TSAN_TEST_DEPS libcxx_tsan)
diff --git a/compiler-rt/test/tsan/Linux/check_memcpy.cc b/compiler-rt/test/tsan/Linux/check_memcpy.c
index b81efa42ad5..75dd7da8316 100644
--- a/compiler-rt/test/tsan/Linux/check_memcpy.cc
+++ b/compiler-rt/test/tsan/Linux/check_memcpy.c
@@ -1,8 +1,8 @@
// Test that verifies TSan runtime doesn't contain compiler-emitted
-// memcpy/memmove calls. It builds the binary with TSan and passes it to
-// check_memcpy.sh script.
+// memcpy/memmove calls. It builds the binary with TSan and check's
+// its objdump.
-// RUN: %clangxx_tsan -O1 %s -o %t
+// RUN: %clang_tsan -O1 %s -o %t
// RUN: llvm-objdump -d %t | FileCheck %s
// REQUIRES: compiler-rt-optimized
diff --git a/compiler-rt/test/tsan/lit.cfg b/compiler-rt/test/tsan/lit.cfg
index 114e325ce78..eb5bdb21416 100644
--- a/compiler-rt/test/tsan/lit.cfg
+++ b/compiler-rt/test/tsan/lit.cfg
@@ -38,7 +38,7 @@ config.substitutions.append(('%env_tsan_opts=',
# GCC driver doesn't add necessary compile/link flags with -fsanitize=thread.
if config.compiler_id == 'GNU':
- extra_cflags = ["-fPIE", "-pthread", "-ldl", "-lstdc++", "-lrt", "-pie"]
+ extra_cflags = ["-fPIE", "-pthread", "-ldl", "-lrt", "-pie"]
else:
extra_cflags = []
@@ -59,11 +59,10 @@ if config.has_libcxx and config.host_os != 'Darwin':
"tsan", "libcxx_tsan_%s" % config.target_arch)
libcxx_incdir = os.path.join(libcxx_path, "include", "c++", "v1")
libcxx_libdir = os.path.join(libcxx_path, "lib")
- libcxx_so = os.path.join(libcxx_libdir, "libc++.so")
+ libcxx_a = os.path.join(libcxx_libdir, "libc++.a")
clang_tsan_cxxflags += ["-nostdinc++",
"-I%s" % libcxx_incdir,
- libcxx_so,
- "-Wl,-rpath=%s" % libcxx_libdir]
+ libcxx_a]
def build_invocation(compile_flags):
return " " + " ".join([config.clang] + compile_flags) + " "
diff --git a/compiler-rt/test/tsan/static_init6.cc b/compiler-rt/test/tsan/static_init6.cc
index 06215ced3c7..b334981e85b 100644
--- a/compiler-rt/test/tsan/static_init6.cc
+++ b/compiler-rt/test/tsan/static_init6.cc
@@ -1,5 +1,4 @@
-// RUN: %clangxx_tsan %linux_static_libstdcplusplus -O1 %s -o %t && %run %t 2>&1 \
-// RUN: | FileCheck %s
+// RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
OpenPOWER on IntegriCloud