summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-16 13:58:58 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-16 13:58:58 +0300
commit18821d5dee4013cfaa72ca586becf020beba862d (patch)
treef02f3739160e6616b2c35aefffe6afedfbfbf4e8 /tests
parent8d6bc64e793dd38bdd1ecbe79441087908f29f8c (diff)
Read LTO archives with the compiler's own llvm-nmHEADmain
The symbols test ran the system nm on the static library. Under LTO the archive holds bitcode. Xcode's nm cannot read bitcode from a newer Homebrew LLVM, so the test failed on macOS. With clang, the test now asks the compiler for its llvm-nm and falls back to nm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/meson.build13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/meson.build b/tests/meson.build
index f176a6e..f42a1de 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,3 +1,4 @@
+fs = import('fs')
dl_dep = cc.find_library('dl', required: false)
python = find_program('python3', native: true, version: '>=3.10')
bash = find_program('bash', native: true)
@@ -9,7 +10,17 @@ test_c_args = ['-UNDEBUG']
test_env = environment()
test_env.set('LD_PRELOAD', '')
test_env.set('DYLD_INSERT_LIBRARIES', '')
-test_env.set('NM', find_program('nm', native: true).full_path())
+# An LTO archive holds the compiler's bitcode. A system nm from another
+# LLVM cannot read it, so clang uses the llvm-nm of its own toolchain.
+nm = find_program('nm', native: true)
+if cc.get_id() == 'clang'
+ llvm_nm = run_command(cc.cmd_array() + ['-print-prog-name=llvm-nm'],
+ check: false).stdout().strip()
+ if fs.is_absolute(llvm_nm) and fs.is_file(llvm_nm)
+ nm = find_program(llvm_nm)
+ endif
+endif
+test_env.set('NM', nm.full_path())
# [name, sources, dependencies, suites]
wsap_vtcore_tests = [