[PATCH] D83022: Add option LLVM_NM to allow specifying the location of the llvm-nm tool.

Arlo Siemsen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 21:39:08 PDT 2020


arlosi created this revision.
arlosi added reviewers: beanz, smeenai, compnerd.
Herald added a subscriber: mgorny.
Herald added a project: LLVM.

The new option works like the existing LLVM_TABLEGEN, and LLVM_CONFIG_PATH options.
Instead of building llvm-nm, the build uses the executable defined by LLVM_NM.

This is useful for cross-compilation scenarios where the host cannot run the cross-compiled
tool, and recursing into another cmake build is not an option (due to required DEFINE's, for example).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83022

Files:
  llvm/tools/llvm-shlib/CMakeLists.txt


Index: llvm/tools/llvm-shlib/CMakeLists.txt
===================================================================
--- llvm/tools/llvm-shlib/CMakeLists.txt
+++ llvm/tools/llvm-shlib/CMakeLists.txt
@@ -154,13 +154,17 @@
   set(GEN_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/gen-msvc-exports.py)
 
   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}")
+  if(NOT LLVM_NM)
+    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()
   else()
-    set(llvm_nm $<TARGET_FILE:llvm-nm>)
-    set(llvm_nm_target llvm-nm)
+    set(llvm_nm ${LLVM_NM})
+    set(llvm_nm_target ${LLVM_NM})
   endif()
 
   add_custom_command(OUTPUT ${LLVM_EXPORTED_SYMBOL_FILE}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83022.275000.patch
Type: text/x-patch
Size: 939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200702/d694efc6/attachment.bin>


More information about the llvm-commits mailing list