[PATCH] D61016: [lit][tests]Add libc++ to link XRay test cases if libc++ is used to build CLANG
Xing Xue via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 6 10:43:02 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL360060: Add libc++ to link XRay test cases if libc++ is used to build CLANG (authored by xingxue, committed by ).
Herald added a subscriber: delcypher.
Changed prior to commit:
https://reviews.llvm.org/D61016?vs=196237&id=198305#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61016/new/
https://reviews.llvm.org/D61016
Files:
compiler-rt/trunk/test/lit.common.configured.in
compiler-rt/trunk/test/xray/lit.cfg
llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake
Index: compiler-rt/trunk/test/xray/lit.cfg
===================================================================
--- compiler-rt/trunk/test/xray/lit.cfg
+++ compiler-rt/trunk/test/xray/lit.cfg
@@ -10,8 +10,16 @@
# 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) + ' '
Index: compiler-rt/trunk/test/lit.common.configured.in
===================================================================
--- compiler-rt/trunk/test/lit.common.configured.in
+++ compiler-rt/trunk/test/lit.common.configured.in
@@ -49,6 +49,7 @@
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.
Index: llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake
===================================================================
--- llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake
+++ llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake
@@ -14,6 +14,7 @@
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 @@
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()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61016.198305.patch
Type: text/x-patch
Size: 2284 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190506/d1c34a39/attachment.bin>
More information about the llvm-commits
mailing list