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

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


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

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

>From 56f9cb7922bc980f0d3d83c68608aabcce1e26e7 Mon Sep 17 00:00:00 2001
From: YongKang Zhu <yongzhu at fb.com>
Date: Tue, 22 Apr 2025 08:57:21 -0700
Subject: [PATCH] [BOLT][test] Resolve symlink for nm tool (NFC)

---
 bolt/test/link_fdata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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,



More information about the llvm-commits mailing list