[compiler-rt] r360060 - Add libc++ to link XRay test cases if libc++ is used to build CLANG
Xing Xue via llvm-commits
llvm-commits at lists.llvm.org
Mon May 6 10:45:21 PDT 2019
Author: xingxue
Date: Mon May 6 10:45:21 2019
New Revision: 360060
URL: http://llvm.org/viewvc/llvm-project?rev=360060&view=rev
Log:
Add libc++ to link XRay test cases if libc++ is used to build CLANG
Summary: When libc++ is used to build CLANG, its XRay libraries libclang_rt.xray-*.a have dependencies on libc++. Therefore, libc++ is needed to link and run XRay test cases. For Linux -rpath is also needed to specify where to load libc++. This change sets macro LLVM_LIBCXX_USED to 1 if libc++ is actually used in the build. XRay tests then check the flag and add -L<llvm_shlib_dir> -lc++ and -Wl,-rpath=<llvm_shlib_dir> if needed.
Reviewers: hubert.reinterpretcast, amyk, dberris, jasonliu, sfertile, EricWF
Subscribers: dberris, mgorny, jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61016
Modified:
compiler-rt/trunk/test/lit.common.configured.in
compiler-rt/trunk/test/xray/lit.cfg
Modified: compiler-rt/trunk/test/lit.common.configured.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lit.common.configured.in?rev=360060&r1=360059&r2=360060&view=diff
==============================================================================
--- compiler-rt/trunk/test/lit.common.configured.in (original)
+++ compiler-rt/trunk/test/lit.common.configured.in Mon May 6 10:45:21 2019
@@ -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.
Modified: compiler-rt/trunk/test/xray/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/xray/lit.cfg?rev=360060&r1=360059&r2=360060&view=diff
==============================================================================
--- compiler-rt/trunk/test/xray/lit.cfg (original)
+++ compiler-rt/trunk/test/xray/lit.cfg Mon May 6 10:45:21 2019
@@ -10,8 +10,16 @@ config.test_source_root = os.path.dirnam
# 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) + ' '
More information about the llvm-commits
mailing list