summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/test/lit.common.configured.in1
-rw-r--r--compiler-rt/test/xray/lit.cfg10
-rw-r--r--llvm/cmake/modules/HandleLLVMStdlib.cmake2
3 files changed, 12 insertions, 1 deletions
diff --git a/compiler-rt/test/lit.common.configured.in b/compiler-rt/test/lit.common.configured.in
index d43597b0679..3514760d0d0 100644
--- a/compiler-rt/test/lit.common.configured.in
+++ b/compiler-rt/test/lit.common.configured.in
@@ -49,6 +49,7 @@ else:
set_default("target_suffix", "-%s" % config.target_arch)
set_default("have_zlib", "@HAVE_LIBZ@")
+set_default("libcxx_used", "@LLVM_LIBCXX_USED@")
# LLVM tools dir can be passed in lit parameters, so try to
# apply substitution.
diff --git a/compiler-rt/test/xray/lit.cfg b/compiler-rt/test/xray/lit.cfg
index 0dc2108ba18..cc4cc212435 100644
--- a/compiler-rt/test/xray/lit.cfg
+++ b/compiler-rt/test/xray/lit.cfg
@@ -10,8 +10,16 @@ config.test_source_root = os.path.dirname(__file__)
# Setup default compiler flags use with -fxray-instrument option.
clang_xray_cflags = (['-fxray-instrument', config.target_cflags])
-clang_xray_cxxflags = config.cxx_mode_flags + clang_xray_cflags
+# If libc++ was used to build XRAY libraries, libc++ is needed. Fix applied
+# to Linux only since -rpath may not be portable. This can be extended to
+# other platforms.
+if config.libcxx_used == "1" and config.host_os == "Linux":
+ clang_xray_cflags = clang_xray_cflags + (['-L%s -lc++ -Wl,-rpath=%s'
+ % (config.llvm_shlib_dir,
+ config.llvm_shlib_dir)])
+
+clang_xray_cxxflags = config.cxx_mode_flags + clang_xray_cflags
def build_invocation(compile_flags):
return ' ' + ' '.join([config.clang] + compile_flags) + ' '
diff --git a/llvm/cmake/modules/HandleLLVMStdlib.cmake b/llvm/cmake/modules/HandleLLVMStdlib.cmake
index a0706d8e084..f0e22d1a5b3 100644
--- a/llvm/cmake/modules/HandleLLVMStdlib.cmake
+++ b/llvm/cmake/modules/HandleLLVMStdlib.cmake
@@ -14,6 +14,7 @@ if(NOT DEFINED LLVM_STDLIB_HANDLED)
include(CheckCXXCompilerFlag)
include(CheckLinkerFlag)
+ set(LLVM_LIBCXX_USED 0)
if(LLVM_ENABLE_LIBCXX)
if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
check_cxx_compiler_flag("-stdlib=libc++" CXX_COMPILER_SUPPORTS_STDLIB)
@@ -22,6 +23,7 @@ if(NOT DEFINED LLVM_STDLIB_HANDLED)
append("-stdlib=libc++"
CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS)
+ set(LLVM_LIBCXX_USED 1)
else()
message(WARNING "Can't specify libc++ with '-stdlib='")
endif()
OpenPOWER on IntegriCloud