In #311, it became apparent that duplicate symbol definitions were
becoming unwieldy. This change merges all duplicates using `uniq`.
@# Ignore certain llvm builtin symbols such as those starting with __mul
@# since these dependencies can vary between llvm versions.
"$(NM)" --defined-only "$(SYSROOT_LIB)"/libc.a "$(SYSROOT_LIB)"/libwasi-emulated-*.a "$(SYSROOT_LIB)"/*.o \
- |grep ' [[:upper:]] ' |sed 's/.* [[:upper:]] //' |LC_ALL=C sort > "$(DEFINED_SYMBOLS)"
+ |grep ' [[:upper:]] ' |sed 's/.* [[:upper:]] //' |LC_ALL=C sort |uniq > "$(DEFINED_SYMBOLS)"
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 \
grep -q '\<'$$undef_sym'\>' "$(DEFINED_SYMBOLS)" || echo $$undef_sym; \
__do_des
__duplocale
__env_rm_add
-__env_rm_add
-__env_rm_add
-__env_rm_add
__exp2f_data
__exp_data
__expo2
__ftello
__ftello_unlocked
__funcs_on_exit
-__funcs_on_exit
-__funcs_on_quick_exit
__funcs_on_quick_exit
__futimesat
__fwritable
__lctrans
__lctrans_cur
__lctrans_impl
-__lctrans_impl
__ldexp_cexp
__ldexp_cexpf
__lgamma_r
__small_printf
__stderr_FILE
__stderr_used
-__stderr_used
-__stderr_used
__stdin_FILE
__stdin_used
-__stdin_used
__stdio_close
__stdio_exit
-__stdio_exit
__stdio_exit_needed
__stdio_read
__stdio_seek
__stdio_write
__stdout_FILE
__stdout_used
-__stdout_used
-__stdout_used
__stdout_write
__stpcpy
__stpncpy
__wasilibc_dttoif
__wasilibc_ensure_environ
__wasilibc_environ
-__wasilibc_environ
__wasilibc_fd_renumber
__wasilibc_find_abspath
__wasilibc_find_relpath
__wasilibc_link_newat
__wasilibc_link_oldat
__wasilibc_maybe_reinitialize_environ_eagerly
-__wasilibc_maybe_reinitialize_environ_eagerly
__wasilibc_nocwd___wasilibc_rmdirat
__wasilibc_nocwd___wasilibc_unlinkat
__wasilibc_nocwd_faccessat
_flushlbf
_initialize
_start
-_start
a64l
abort
abs