Skip to content

Commit 92576a9

Browse files
committed
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360060 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent f8e9cda commit 92576a9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cmake/modules/HandleLLVMStdlib.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ if(NOT DEFINED LLVM_STDLIB_HANDLED)
1414

1515
include(CheckCXXCompilerFlag)
1616
include(CheckLinkerFlag)
17+
set(LLVM_LIBCXX_USED 0)
1718
if(LLVM_ENABLE_LIBCXX)
1819
if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
1920
check_cxx_compiler_flag("-stdlib=libc++" CXX_COMPILER_SUPPORTS_STDLIB)
@@ -22,6 +23,7 @@ if(NOT DEFINED LLVM_STDLIB_HANDLED)
2223
append("-stdlib=libc++"
2324
CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS
2425
CMAKE_MODULE_LINKER_FLAGS)
26+
set(LLVM_LIBCXX_USED 1)
2527
else()
2628
message(WARNING "Can't specify libc++ with '-stdlib='")
2729
endif()

0 commit comments

Comments
 (0)