summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
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 = [