Add libc++ to link XRay test cases if libc++ is used to build CLANG
authorXing Xue <xingxue@outlook.com>
Mon, 6 May 2019 17:45:21 +0000 (17:45 +0000)
committerXing Xue <xingxue@outlook.com>
Mon, 6 May 2019 17:45:21 +0000 (17:45 +0000)
commit865a39d328c2fa0ce251447bf2d6005dbbfec595
tree70ebe2bb603c1015f042d7319665610d9f3c6b82
parenta64bd09ec44a7fc86a95f4b4ab77fbb700a84b48
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

llvm-svn: 360060
compiler-rt/test/lit.common.configured.in
compiler-rt/test/xray/lit.cfg
llvm/cmake/modules/HandleLLVMStdlib.cmake