Skip to content

Commit c233deb

Browse files
authored
[BOLT] Use llvm-nm by default on Windows (#151805)
Use `llvm-nm` by default instead of `nm` in case of Windows host.
1 parent 6393a9e commit c233deb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

bolt/test/link_fdata.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import argparse
1111
import os
12+
import platform
1213
import shutil
1314
import subprocess
1415
import sys
@@ -19,7 +20,11 @@
1920
parser.add_argument("objfile", help="Object file to extract symbol values from")
2021
parser.add_argument("output")
2122
parser.add_argument("prefix", nargs="?", default="FDATA", help="Custom FDATA prefix")
22-
parser.add_argument("--nmtool", default="nm", help="Path to nm tool")
23+
parser.add_argument(
24+
"--nmtool",
25+
default="llvm-nm" if platform.system() == "Windows" else "nm",
26+
help="Path to nm tool",
27+
)
2328
parser.add_argument("--no-lbr", action="store_true")
2429
parser.add_argument("--no-redefine", action="store_true")
2530

@@ -86,7 +91,10 @@
8691
exit("ERROR: unexpected input:\n%s" % line)
8792

8893
# Read nm output: <symbol value> <symbol type> <symbol name>
89-
is_llvm_nm = os.path.basename(os.path.realpath(shutil.which(args.nmtool))) == "llvm-nm"
94+
# Ignore .exe on Windows host.
95+
is_llvm_nm = os.path.basename(os.path.realpath(shutil.which(args.nmtool))).startswith(
96+
"llvm-nm"
97+
)
9098
nm_output = subprocess.run(
9199
[
92100
args.nmtool,

0 commit comments

Comments
 (0)