[llvm] [BOLT] Use llvm-nm by default on Windows (PR #151805)

via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 2 01:11:21 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: Dmitry Vasilyev (slydiman)

<details>
<summary>Changes</summary>

Use `llvm-nm` by default instead of `nm` in case of Windows host.

---
Full diff: https://github.com/llvm/llvm-project/pull/151805.diff


1 Files Affected:

- (modified) bolt/test/link_fdata.py (+10-2) 


``````````diff
diff --git a/bolt/test/link_fdata.py b/bolt/test/link_fdata.py
index 898dce8e3fb5f..24c0963989cd1 100755
--- a/bolt/test/link_fdata.py
+++ b/bolt/test/link_fdata.py
@@ -9,6 +9,7 @@
 
 import argparse
 import os
+import platform
 import shutil
 import subprocess
 import sys
@@ -19,7 +20,11 @@
 parser.add_argument("objfile", help="Object file to extract symbol values from")
 parser.add_argument("output")
 parser.add_argument("prefix", nargs="?", default="FDATA", help="Custom FDATA prefix")
-parser.add_argument("--nmtool", default="nm", help="Path to nm tool")
+parser.add_argument(
+    "--nmtool",
+    default="llvm-nm" if platform.system() == "Windows" else "nm",
+    help="Path to nm tool",
+)
 parser.add_argument("--no-lbr", action="store_true")
 parser.add_argument("--no-redefine", action="store_true")
 
@@ -86,7 +91,10 @@
             exit("ERROR: unexpected input:\n%s" % line)
 
 # Read nm output: <symbol value> <symbol type> <symbol name>
-is_llvm_nm = os.path.basename(os.path.realpath(shutil.which(args.nmtool))) == "llvm-nm"
+# Ignore .exe on Windows host.
+is_llvm_nm = os.path.basename(os.path.realpath(shutil.which(args.nmtool))).startswith(
+    "llvm-nm"
+)
 nm_output = subprocess.run(
     [
         args.nmtool,

``````````

</details>


https://github.com/llvm/llvm-project/pull/151805


More information about the llvm-commits mailing list