From 18821d5dee4013cfaa72ca586becf020beba862d Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Fri, 16 Oct 2026 13:58:58 +0300 Subject: Read LTO archives with the compiler's own llvm-nm 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 --- tests/meson.build | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests') 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 = [ -- cgit v1.2.3