diff --git a/cmake/modules/LLVMExternalProjectUtils.cmake b/cmake/modules/LLVMExternalProjectUtils.cmake index 619550b5943a4..f491f39e1b005 100644 --- a/cmake/modules/LLVMExternalProjectUtils.cmake +++ b/cmake/modules/LLVMExternalProjectUtils.cmake @@ -46,7 +46,7 @@ function(llvm_ExternalProject_Add name source_dir) if(NOT ARG_TOOLCHAIN_TOOLS) set(ARG_TOOLCHAIN_TOOLS clang lld) if(NOT APPLE AND NOT WIN32) - list(APPEND ARG_TOOLCHAIN_TOOLS llvm-ar llvm-ranlib) + list(APPEND ARG_TOOLCHAIN_TOOLS llvm-ar llvm-ranlib llvm-nm llvm-objcopy llvm-objdump llvm-strip) endif() endif() foreach(tool ${ARG_TOOLCHAIN_TOOLS}) @@ -107,12 +107,27 @@ function(llvm_ExternalProject_Add name source_dir) set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++) endif() + if(lld IN_LIST TOOLCHAIN_TOOLS) + list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/ld.lld) + endif() if(llvm-ar IN_LIST TOOLCHAIN_TOOLS) list(APPEND compiler_args -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar) endif() if(llvm-ranlib IN_LIST TOOLCHAIN_TOOLS) list(APPEND compiler_args -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib) endif() + if(llvm-nm IN_LIST TOOLCHAIN_TOOLS) + list(APPEND compiler_args -DCMAKE_NM=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-nm) + endif() + if(llvm-objdump IN_LIST TOOLCHAIN_TOOLS) + list(APPEND compiler_args -DCMAKE_OBJDUMP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objdump) + endif() + if(llvm-objcopy IN_LIST TOOLCHAIN_TOOLS) + list(APPEND compiler_args -DCMAKE_OBJCOPY=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objcopy) + endif() + if(llvm-strip IN_LIST TOOLCHAIN_TOOLS) + list(APPEND compiler_args -DCMAKE_STRIP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-strip) + endif() list(APPEND ARG_DEPENDS ${TOOLCHAIN_TOOLS}) endif() @@ -139,8 +154,13 @@ function(llvm_ExternalProject_Add name source_dir) if(CMAKE_CROSSCOMPILING) set(compiler_args -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_LINKER=${CMAKE_LINKER} -DCMAKE_AR=${CMAKE_AR} - -DCMAKE_RANLIB=${CMAKE_RANLIB}) + -DCMAKE_RANLIB=${CMAKE_RANLIB} + -DCMAKE_NM=${CMAKE_NM} + -DCMAKE_OBJCOPY=${CMAKE_OBJCOPY} + -DCMAKE_OBJDUMP=${CMAKE_OBJDUMP} + -DCMAKE_STRIP=${CMAKE_STRIP}) set(llvm_config_path ${LLVM_CONFIG_PATH}) else() set(llvm_config_path "$") diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index e5291f81979b7..40694451b177b 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -285,7 +285,7 @@ else() # if this is included from LLVM's CMake -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON ${${target}_extra_args} PASSTHROUGH_PREFIXES CLANG_DEFAULT - TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib + TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib llvm-nm llvm-objcopy llvm-objdump llvm-strip USE_TOOLCHAIN ${EXTRA_ARGS}) endfunction() @@ -463,7 +463,7 @@ else() # if this is included from LLVM's CMake ${${name}_extra_args} PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES CLANG_DEFAULT - TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib + TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib llvm-nm llvm-objcopy llvm-objdump llvm-strip EXTRA_TARGETS ${${name}_extra_targets} ${${name}_test_targets} USE_TOOLCHAIN