Skip to content

Commit

Permalink
Use all lib artifacts when checking symbols
Browse files Browse the repository at this point in the history
Previously, we generated the defined and undefined symbol lists from
different sets of `sysroot/lib` artifacts. This uses all static
artifacts that are built, `*.a` and `*.o`, to increase coverage of the
symbols wasi-libc is publishing.
  • Loading branch information
abrown committed Nov 20, 2024
1 parent 2ef2881 commit a0cbb41
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ install: finish
$(SYSROOT_SHARE)/defined-symbols.txt: startup_files libc
mkdir -p "$(SYSROOT_SHARE)"
"$(NM)" --defined-only \
$(SYSROOT_LIB)/libc.a $(SYSROOT_LIB)/libwasi-emulated-*.a $(SYSROOT_LIB)/*.o \
$(SYSROOT_LIB)/*.a $(SYSROOT_LIB)/*.o \
|grep ' [[:upper:]] ' \
|sed 's/.* [[:upper:]] //' \
|LC_ALL=C sort \
Expand All @@ -946,7 +946,7 @@ $(SYSROOT_SHARE)/undefined-symbols.txt: $(SYSROOT_SHARE)/defined-symbols.txt
@# 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.
for undef_sym in $$("$(NM)" --undefined-only $(SYSROOT_LIB)/libc.a $(SYSROOT_LIB)/libc-*.a $(SYSROOT_LIB)/*.o |grep ' U ' |sed 's/.* U //' |LC_ALL=C sort |uniq); do \
for undef_sym in $$("$(NM)" --undefined-only $(SYSROOT_LIB)/*.a $(SYSROOT_LIB)/*.o |grep ' U ' |sed 's/.* U //' |LC_ALL=C sort |uniq); do \
grep -q '\<'$$undef_sym'\>' "$<" || echo $$undef_sym; \
done | grep -E -v "^__mul|__memory_base|__indirect_function_table|__tls_base" > "$@"

Expand Down
8 changes: 8 additions & 0 deletions expected/wasm32-wasip1-threads/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ __atexit_lockptr
__c_dot_utf8
__c_dot_utf8_locale
__c_locale
__c_longjmp
__clock
__clock_gettime
__clock_nanosleep
Expand Down Expand Up @@ -402,6 +403,9 @@ __wasilibc_tell
__wasilibc_unlinkat
__wasilibc_utimens
__wasm_call_dtors
__wasm_longjmp
__wasm_setjmp
__wasm_setjmp_test
__wcscoll_l
__wcsftime_l
__wcsxfrm_l
Expand Down Expand Up @@ -575,6 +579,10 @@ difftime
dirfd
dirname
div
dlclose
dlerror
dlopen
dlsym
dprintf
drand48
drem
Expand Down
8 changes: 8 additions & 0 deletions expected/wasm32-wasip1/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ __assert_fail
__c_dot_utf8
__c_dot_utf8_locale
__c_locale
__c_longjmp
__clock
__clock_gettime
__clock_nanosleep
Expand Down Expand Up @@ -373,6 +374,9 @@ __wasilibc_tell
__wasilibc_unlinkat
__wasilibc_utimens
__wasm_call_dtors
__wasm_longjmp
__wasm_setjmp
__wasm_setjmp_test
__wcscoll_l
__wcsftime_l
__wcsxfrm_l
Expand Down Expand Up @@ -546,6 +550,10 @@ difftime
dirfd
dirname
div
dlclose
dlerror
dlopen
dlsym
dprintf
drand48
drem
Expand Down
8 changes: 8 additions & 0 deletions expected/wasm32-wasip2/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ __assert_fail
__c_dot_utf8
__c_dot_utf8_locale
__c_locale
__c_longjmp
__clock
__clock_gettime
__clock_nanosleep
Expand Down Expand Up @@ -389,6 +390,9 @@ __wasilibc_tell
__wasilibc_unlinkat
__wasilibc_utimens
__wasm_call_dtors
__wasm_longjmp
__wasm_setjmp
__wasm_setjmp_test
__wcscoll_l
__wcsftime_l
__wcsxfrm_l
Expand Down Expand Up @@ -568,6 +572,10 @@ difftime
dirfd
dirname
div
dlclose
dlerror
dlopen
dlsym
dprintf
drand48
drem
Expand Down

0 comments on commit a0cbb41

Please sign in to comment.