[llvm] 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:
    llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake

Modified: llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake?rev=360060&r1=360059&r2=360060&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake Mon May  6 10:45:21 2019
@@ -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()




More information about the llvm-commits mailing list