I started a github issue here: https://github.com/emscripten-core/emscripten/issues/15506
...unfortunately I haven't been able to create a simple reproducer yet, building a simple test program which calls into one of the exp, exp2 or pow functions appears to work, with or without lto. On Friday, 12 November 2021 at 12:23:09 UTC+1 Floh wrote: > > I suspect LTO is the culprit here. > > That's indeed the issue. Building without LTO works. I'll try to come up > with a minimal reproducer, create a github ticket and then see if I can get > your PR working with my local emsdk installation :) > > On Thursday, 11 November 2021 at 23:08:14 UTC+1 [email protected] wrote: > >> I think this should fix your issue: >> https://github.com/emscripten-core/emscripten/pull/15497 >> >> On Thu, Nov 11, 2021 at 1:44 PM Sam Clegg <[email protected]> wrote: >> >>> >>> >>> On Thu, Nov 11, 2021 at 4:46 AM Floh <[email protected]> wrote: >>> >>>> These are the related header/source pairs in MUSL, and it seems that >>>> these are new (didn't exist in the stable SDK): >>>> >>>> >>>> https://github.com/emscripten-core/emscripten/blob/main/system/lib/libc/musl/src/math/exp_data.h >>>> >>>> https://github.com/emscripten-core/emscripten/blob/main/system/lib/libc/musl/src/math/exp_data.c >>>> >>>> >>>> https://github.com/emscripten-core/emscripten/blob/main/system/lib/libc/musl/src/math/exp2f_data.h >>>> >>>> https://github.com/emscripten-core/emscripten/blob/main/system/lib/libc/musl/src/math/exp2f_data.c >>>> >>>> When listing the libc.a symbols in the emscripten cache with llvm-nm I >>>> can see the entry for exp_data but nothing for exp2f_data: >>>> >>>> exp_data.o: >>>> -------- D __exp_data >>>> >>>> (which is doubly weird, why does exp_data produce a linker error even >>>> though it's there, and why isn't exp2f_data anywhere to be found) >>>> >>>> ...anyway, that's how far I got :) >>>> >>> >>> I suspect LTO is the culprit here. Does you non-LTO build work? >>> >>> I think these symbols can get generated at codegen time which can >>> confuse LTO because it likes to know all the symbols needed before running >>> the compiler/LTO. >>> >>> >>> >>>> On Thursday, 11 November 2021 at 12:57:06 UTC+1 Floh wrote: >>>> >>>>> PS: my other WASM projects appear to work fine (the home computer >>>>> emulators here: https://floooh.github.io/tiny8bit/, and the Z80 and >>>>> 6502 netlist simulations: https://floooh.github.io/visualz80remix/, >>>>> https://floooh.github.io/visual6502remix/). >>>>> >>>>> On Thursday, 11 November 2021 at 12:02:12 UTC+1 Floh wrote: >>>>> >>>>>> I'm getting the following linker errors in my sokol-samples project: >>>>>> >>>>>> 5x: >>>>>> wasm-ld: error: >>>>>> /...cache/sysroot/lib/wasm32-emscripten/lto/libc.a(exp2f_data.o): >>>>>> undefined >>>>>> symbol: __exp2f_data >>>>>> >>>>>> 8x: >>>>>> wasm-ld: error: >>>>>> /...cache/sysroot/lib/wasm32-emscripten/lto/libc.a(exp_data.o): >>>>>> undefined >>>>>> symbol: __exp_data >>>>>> >>>>>> Full wasm-ld command line: >>>>>> >>>>>> em++: error: >>>>>> '/Users/floh/projects/fips-sdks/emsdk/upstream/bin/wasm-ld -o >>>>>> /Users/floh/projects/fips-deploy/sokol-samples/sapp-webgl2-wasm-ninja-release/modplay-sapp.wasm >>>>>> >>>>>> sapp/CMakeFiles/modplay-sapp.dir/modplay-sapp.c.obj >>>>>> libs/sokol/libsokol.a >>>>>> fips-libmodplug_libmodplug/liblibmodplug.a >>>>>> -L/Users/floh/projects/fips-sdks/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto >>>>>> >>>>>> -lGL-webgl2 -lal -lhtml5 -lstubs -lc -lcompiler_rt -lc++-noexcept >>>>>> -lc++abi-noexcept -lemmalloc -lc_rt_wasm -lsockets -mllvm >>>>>> -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj >>>>>> -mllvm >>>>>> -disable-lsr --import-undefined --strip-debug --export-if-defined=main >>>>>> --export-if-defined=stackSave --export-if-defined=stackRestore >>>>>> --export-if-defined=stackAlloc --export-if-defined=__wasm_call_ctors >>>>>> --export-if-defined=__errno_location --export-if-defined=malloc >>>>>> --export-if-defined=free --export-if-defined=__start_em_asm >>>>>> --export-if-defined=__stop_em_asm --export-table -z stack-size=5242880 >>>>>> --initial-memory=33554432 --no-entry --max-memory=2147483648 >>>>>> <(214)%20748-3648> --global-base=1024' failed (returned 1) >>>>>> >>>>>> ...and the em++ command line: >>>>>> >>>>>> /Users/floh/projects/fips-sdks/emsdk/upstream/emscripten/em++ -s >>>>>> DISABLE_EXCEPTION_CATCHING=1 -fno-exceptions -fno-rtti -std=c++11 >>>>>> -fstrict-aliasing -Wall -Wno-multichar -Wextra -Wno-unknown-pragmas >>>>>> -Wno-ignored-qualifiers -Wno-long-long -Wno-overloaded-virtual >>>>>> -Wno-deprecated-writable-strings -Wno-unused-volatile-lvalue >>>>>> -Wno-inconsistent-missing-override -Wno-warn-absolute-paths >>>>>> -Wno-expansion-to-defined -flto -O3 -DNDEBUG -s >>>>>> DISABLE_EXCEPTION_CATCHING=1 --memory-init-file 0 -s >>>>>> INITIAL_MEMORY=33554432 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s >>>>>> NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s USE_WEBGL2=1 -s >>>>>> "MALLOC='emmalloc'" -s NO_FILESYSTEM=1 -s WASM=1 --shell-file >>>>>> /Users/floh/projects/sokol-samples/webpage/shell.html -O3 -flto >>>>>> --closure >>>>>> 1 -s ASSERTIONS=0 sapp/CMakeFiles/modplay-sapp.dir/modplay-sapp.c.obj -o >>>>>> /Users/floh/projects/fips-deploy/sokol-samples/sapp-webgl2-wasm-ninja-release/modplay-sapp.html >>>>>> >>>>>> libs/sokol/libsokol.a fips-libmodplug_libmodplug/liblibmodplug.a >>>>>> >>>>>> Investigating now, I think the most likely culprit is libmodplug (a >>>>>> MOD player library). >>>>>> >>>>>> Should I open a separate github ticket, or append this type of >>>>>> feedback to the PR? >>>>>> >>>>>> Cheers, >>>>>> -Andre. >>>>>> >>>>>> On Wednesday, 10 November 2021 at 17:33:34 UTC+1 [email protected] >>>>>> wrote: >>>>>> >>>>>>> Yesterday I landed the update to musl v1.2.2: >>>>>>> https://github.com/emscripten-core/emscripten/pull/13006 >>>>>>> >>>>>>> This is a fairly large change so we decided that next emscripten >>>>>>> release will bump the version 3.0.0. >>>>>>> >>>>>>> If you are interested in helping us test this new version before we >>>>>>> release it it would be great if you could try installing the `tot` >>>>>>> version >>>>>>> of emsdk which now contains this new version musl (`./emsdk install >>>>>>> tot`). >>>>>>> We are keen to find and fix any issues that might arise from this >>>>>>> change. >>>>>>> >>>>>>> cheers, >>>>>>> sam >>>>>>> >>>>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "emscripten-discuss" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/emscripten-discuss/ff0f0683-9ed5-44b0-b0be-f51267863559n%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/emscripten-discuss/ff0f0683-9ed5-44b0-b0be-f51267863559n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/67596134-ea22-473f-add4-69d33e5dd9f6n%40googlegroups.com.
