From c35f0f5dd64ad982bbad71f3e3a8942a1029c1e6 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 29 Aug 2019 18:05:38 -0700 Subject: [PATCH] When checking undefined symbol list, ignore certain llvm buildins These can vary between llvm version. For example a recent upstream change recently added __multi3 to the list: https://reviews.llvm.org/D65143 Fixes #98 --- Makefile | 4 +++- expected/wasm32-wasi/undefined-symbols.txt | 5 ----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 83c8632..02f3e7f 100644 --- a/Makefile +++ b/Makefile @@ -451,12 +451,14 @@ finish: startup_files libc # Collect symbol information. # TODO: Use llvm-nm --extern-only instead of grep. This is blocked on # LLVM PR40497, which is fixed in 9.0, but not in 8.0. + # Ignore certain llvm builtin symbols such as those starting with __mul + # since these dependencies can vary between llvm versions. "$(WASM_NM)" --defined-only "$(SYSROOT_LIB)"/libc.a "$(SYSROOT_LIB)"/*.o \ |grep ' [[:upper:]] ' |sed 's/.* [[:upper:]] //' |LC_ALL=C sort > "$(SYSROOT_SHARE)/defined-symbols.txt" for undef_sym in $$("$(WASM_NM)" --undefined-only "$(SYSROOT_LIB)"/*.a "$(SYSROOT_LIB)"/*.o \ |grep ' U ' |sed 's/.* U //' |LC_ALL=C sort |uniq); do \ grep -q '\<'$$undef_sym'\>' "$(SYSROOT_SHARE)/defined-symbols.txt" || echo $$undef_sym; \ - done > "$(SYSROOT_SHARE)/undefined-symbols.txt" + done | grep -v "^__mul" > "$(SYSROOT_SHARE)/undefined-symbols.txt" grep '^_*wasi_' "$(SYSROOT_SHARE)/undefined-symbols.txt" \ > "$(SYSROOT_LIB)/libc.imports" diff --git a/expected/wasm32-wasi/undefined-symbols.txt b/expected/wasm32-wasi/undefined-symbols.txt index 75bee03..8715e54 100644 --- a/expected/wasm32-wasi/undefined-symbols.txt +++ b/expected/wasm32-wasi/undefined-symbols.txt @@ -12,11 +12,6 @@ __getf2 __gttf2 __letf2 __lttf2 -__muldc3 -__muloti4 -__mulsc3 -__multc3 -__multf3 __netf2 __stack_pointer __subtf3