summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShoaib Meenai <smeenai@fb.com>2019-04-02 15:58:05 +0000
committerShoaib Meenai <smeenai@fb.com>2019-04-02 15:58:05 +0000
commit7c16c5b6aec53ae59c5c611af55d089a84ed3f10 (patch)
treeeaf72fc1081c02ea4ef2efdcb5d368f09270975b
parentf92acf1299500b3b161a2bdf94639244a8fc4cae (diff)
downloadbcm5719-llvm-7c16c5b6aec53ae59c5c611af55d089a84ed3f10.tar.gz
bcm5719-llvm-7c16c5b6aec53ae59c5c611af55d089a84ed3f10.zip
[llvm-shlib] Fix cross-compilation for LLVM-C
When we're cross-compiling, build and use a native llvm-nm instead of attempting to use the one from the target's build tree. A nice follow-up would be to add a cache variable to allow specifying a path to an external native llvm-nm instead of building one ourselves, similar to LLVM_TABLEGEN and LLVM_CONFIG_PATH. Differential Revision: https://reviews.llvm.org/D60025 llvm-svn: 357487
-rw-r--r--llvm/tools/llvm-shlib/CMakeLists.txt12
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt b/llvm/tools/llvm-shlib/CMakeLists.txt
index af44b8ae853..bc5ea44e336 100644
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
@@ -164,9 +164,17 @@ if(MSVC)
set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libllvm-c.exports)
+ if(CMAKE_CROSSCOMPILING)
+ build_native_tool(llvm-nm llvm_nm)
+ set(llvm_nm_target "${llvm_nm}")
+ else()
+ set(llvm_nm $<TARGET_FILE:llvm-nm>)
+ set(llvm_nm_target llvm-nm)
+ endif()
+
add_custom_command(OUTPUT ${LLVM_EXPORTED_SYMBOL_FILE}
- COMMAND ${PYTHON_EXECUTABLE} ${GEN_SCRIPT} --libsfile ${LIBSFILE} ${GEN_UNDERSCORE} --nm ${LLVM_TOOLS_BINARY_DIR}/llvm-nm -o ${LLVM_EXPORTED_SYMBOL_FILE}
- DEPENDS ${LIB_NAMES} llvm-nm
+ COMMAND ${PYTHON_EXECUTABLE} ${GEN_SCRIPT} --libsfile ${LIBSFILE} ${GEN_UNDERSCORE} --nm "${llvm_nm}" -o ${LLVM_EXPORTED_SYMBOL_FILE}
+ DEPENDS ${LIB_NAMES} ${llvm_nm_target}
COMMENT "Generating export list for LLVM-C"
VERBATIM )
OpenPOWER on IntegriCloud