[llvm] [BOLT][test] Resolve symlink for nm tool (NFC) (PR #136722)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 22 09:00:59 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: YongKang Zhu (yozhu)

<details>
<summary>Changes</summary>

Handle the case where nm could be a symlink to llvm-nm.

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


1 Files Affected:

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


``````````diff
diff --git a/bolt/test/link_fdata.py b/bolt/test/link_fdata.py
index f1d83458346d6..bcf9a777922d5 100755
--- a/bolt/test/link_fdata.py
+++ b/bolt/test/link_fdata.py
@@ -9,6 +9,7 @@
 
 import argparse
 import os
+import shutil
 import subprocess
 import sys
 import re
@@ -85,7 +86,7 @@
             exit("ERROR: unexpected input:\n%s" % line)
 
 # Read nm output: <symbol value> <symbol type> <symbol name>
-is_llvm_nm = os.path.basename(args.nmtool) == "llvm-nm"
+is_llvm_nm = os.path.basename(os.path.realpath(shutil.which(args.nmtool))) == "llvm-nm"
 nm_output = subprocess.run(
     [
         args.nmtool,

``````````

</details>


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


More information about the llvm-commits mailing list