Skip to content

musl v1.2.2 LTO linker errors for exp_data and exp2f_data #15506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
floooh opened this issue Nov 12, 2021 · 13 comments
Closed

musl v1.2.2 LTO linker errors for exp_data and exp2f_data #15506

floooh opened this issue Nov 12, 2021 · 13 comments

Comments

@floooh
Copy link
Collaborator

floooh commented Nov 12, 2021

Related links:

When testing the latest tot version which switched to musl v1.2.2, I'm getting linker errors in the sokol-samples project only when building with LTO enabled:

wasm-ld: error: /...cache/sysroot/lib/wasm32-emscripten/lto/libc.a(exp2f_data.o): undefined symbol: __exp2f_data
wasm-ld: error: /...cache/sysroot/lib/wasm32-emscripten/lto/libc.a(exp_data.o): undefined symbol: __exp_data

Unfortunately I'm having a hard time coming up with a minimal reproduction test case. From looking at the MUSL sources I'd expect that just using one of the pow(), exp(), exp2() calls (or their 'f' versions) in a minimal source file and compiling with LTO should trigger the problem, but so far no dice (stay tuned).

PS: the optimizer passes removed the actual function calls and replaced them with simplified expressions 🙄

Here's a reproducer for the exp2_data problem:

//
//  Compile with:
//
//  emcc -flto -O3 -o bla.js bla.c   
//
#include <stdio.h>  // printf()
#include <stdlib.h> // atof()
#include <math.h>   // exp2f()
#include <assert.h> // assert()

int main(int argc, char* argv[]) {
    assert(argc > 0);
    // important to have some unpredictable input value, otherwise
    // the optimizer will remove the exp2f call alltogether
    const float val = atof(argv[1]);
    const float res = exp2f(val);
    printf("%f\n", res);
    return 0;
}

...and a reproducer for exp_data, same code, just replace the exp2f() call with exp2():

//
//  Compile with:
//
//  emcc -flto -O3 -o bla.js bla.c   
//
#include <stdio.h>  // printf()
#include <stdlib.h> // atof()
#include <math.h>   // exp2f()
#include <assert.h> // assert()

int main(int argc, char* argv[]) {
    assert(argc > 0);
    const double val = atof(argv[1]);
    const double res = exp2(val);
    printf("%f\n", res);
    return 0;
}
@floooh
Copy link
Collaborator Author

floooh commented Nov 12, 2021

Ok... after trying out @sbc100's PR the exp_data and exp2_data linker errors appear fixed, but there's now a similar followup problem with __math_oflowf and __math_uflowf (slightly different error output though) - this happens with the libmodplug library, not with the minimal test cases:

error: undefined symbol: __math_oflowf (referenced by top-level compiled C/C++ code)
warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on undefined symbols
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
warning: ___math_oflowf may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: __math_uflowf (referenced by top-level compiled C/C++ code)
warning: ___math_uflowf may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors

Also only when compiling with LTO.

Those are defined in MUSL in the source files src/math/__math_oflowf.c and src/math/__math_uflowf.c, I'll check if it's enough to add those files to the file list in tools/system_libs.py...

@floooh
Copy link
Collaborator Author

floooh commented Nov 12, 2021

Ok, looks like adding the following files additionally to the new files in #15497 fixes the issue for my sokol-samples / libmodplug case:

      '__math_oflow.c', '__math_oflowf.c',
      '__math_uflow.c', '__math_uflowf.c',

...hard to say though if there are similar problems lurking in other code bases...

@floooh
Copy link
Collaborator Author

floooh commented Nov 12, 2021

Oops, sorry, that was too early. While the libmodplug case is fixed, other sokol-sample demos now trigger a new wasm-ld error I haven't seen before.

wasm-ld: error: /.../lto/libc.a(__math_divzerof.o): attempt to add bitcode file after LTO.

This appears to happen in demos that also link with Dear ImGui, also seems LTO specific. No idea how to proceed there though, the error message looks like it's a problem with mixed LTO / non-LTO code generation?

Sorry for causing such a rabbit hole ;)

sbc100 added a commit that referenced this issue Nov 12, 2021
We have had reports of missing symbols in LTO builds after
the musl upgrade (#13006):
https://groups.google.com/g/emscripten-discuss/c/g_vkRRSCPUI/m/aT6fnUAtCQAJ?utm_medium=email&utm_source=footer

Also `lto2.test_float_builtinsTest` started failing on the
emscripten-releases FYI waterfall.

This change moves some of the new math-related source files
into the libc-mt library which is excluded from LTO (see comments
in in system_libs.py for background on this).

Fixes: #15506
@sbc100
Copy link
Collaborator

sbc100 commented Nov 12, 2021

No, this is all part of known issue related to libcalls/builtins and LTO.

Last last error you are seeing is because the reference to __math_divzerof.o object was generated during LTO. i.e. that object was deemed not needed prior to LTO but needed after LTO, but since the object itself is an LTO object there is now way to now include it since LTO is done.

I believe this all relates to this upstream issue that I files: https://bugs.llvm.org/show_bug.cgi?id=44353. And I think the reason that we seem to be the only effect folks is that nobody else is trying to compile compiler-rt and its libc dependencies as LTO.

Hopefully #15497 should fix this for you.

@floooh
Copy link
Collaborator Author

floooh commented Nov 12, 2021

FYI @sbc100, after testing your latest PR update there was one more followup error, but adding the following files to the end of your changes seems to fix those.

      '__math_invalid.c', '__math_invalidf.c', '__math_invalidl.c'

...my sokol-samples project is still compiling but after 2/3 I guess it's working now (will followup here if it doesn't).

PS: yep, this was the last error, at least for my projects. I wonder if there's a watertight way to make sure that other code bases don't trigger similar problems..?

@sbc100 sbc100 closed this as completed in 6160323 Nov 12, 2021
mmarczell-graphisoft pushed a commit to GRAPHISOFT/emscripten that referenced this issue Jan 5, 2022
We have had reports of missing symbols in LTO builds after
the musl upgrade (emscripten-core#13006):
https://groups.google.com/g/emscripten-discuss/c/g_vkRRSCPUI/m/aT6fnUAtCQAJ?utm_medium=email&utm_source=footer

Also `lto2.test_float_builtinsTest` started failing on the
emscripten-releases FYI waterfall.

This change moves some of the new math-related source files
into the libc-mt library which is excluded from LTO (see comments
in in system_libs.py for background on this).

Fixes: emscripten-core#15506
@yuyichao
Copy link

I'm getting a very similar error for ldexp.o when playing with yosysjs.

@sbc100
Copy link
Collaborator

sbc100 commented Jan 13, 2022

@yuyichao could you share the full command line and the full error message?

sbc100 added a commit that referenced this issue Jan 13, 2022
Like the math functions here these can be generated by the compiler
and therefore cannot themselves be part of LTO.

See #15506
@yuyichao
Copy link

I don't really have a minimum example to show but I have a github action to do the compilation automatically and I've just triggered a build that should show the issue (if I didn't mess anything up....)

The build is at https://github.com/yuyichao/yosysjs/runs/4804475201?check_suite_focus=true and it should finish in about 5-10min... The finally linking step has many different files though but if there's an easy way to automatically reduce it I could give it a try.

Note that this is using 3.0.0 release since the archlinux package hasn't been updated yet but it should have the previous fix.

@yuyichao
Copy link

yuyichao commented Jan 13, 2022

See the error at https://github.com/yuyichao/yosysjs/runs/4804475201?check_suite_focus=true#step:11:1094

emcc -o yosys.js -g0 -Os -flto -s INVOKE_RUN=0 -s MODULARIZE=1 -rdynamic -g0 -Os -Wno-warn-absolute-paths -Wno-unused-command-line-argument --memory-init-file 0 --embed-file share -s NO_EXIT_RUNTIME=1 -s TOTAL_MEMORY=134217728 -s EXPORTED_FUNCTIONS=["_main","_run","_errmsg"] -s EXPORTED_RUNTIME_METHODS=["ccall","cwrap","callMain","FS"] kernel/version_8b1eafc.o kernel/driver.o kernel/register.o kernel/rtlil.o kernel/log.o kernel/calc.o kernel/yosys.o kernel/binding.o kernel/cellaigs.o kernel/celledges.o kernel/satgen.o kernel/qcsat.o kernel/mem.o kernel/ffmerge.o kernel/ff.o libs/bigint/BigIntegerAlgorithms.o libs/bigint/BigInteger.o libs/bigint/BigIntegerUtils.o libs/bigint/BigUnsigned.o libs/bigint/BigUnsignedInABase.o libs/sha1/sha1.o libs/json11/json11.o libs/subcircuit/subcircuit.o libs/ezsat/ezsat.o libs/ezsat/ezminisat.o libs/minisat/Options.o libs/minisat/SimpSolver.o libs/minisat/Solver.o libs/minisat/System.o frontends/aiger/aigerparse.o frontends/ast/ast.o frontends/ast/simplify.o frontends/ast/genrtlil.o frontends/ast/dpicall.o frontends/ast/ast_binding.o frontends/blif/blifparse.o frontends/json/jsonparse.o frontends/liberty/liberty.o frontends/rtlil/rtlil_parser.tab.o frontends/rtlil/rtlil_lexer.o frontends/rtlil/rtlil_frontend.o frontends/verific/verific.o frontends/verilog/verilog_parser.tab.o frontends/verilog/verilog_lexer.o frontends/verilog/preproc.o frontends/verilog/verilog_frontend.o frontends/verilog/const2ast.o passes/cmds/add.o passes/cmds/delete.o passes/cmds/design.o passes/cmds/select.o passes/cmds/show.o passes/cmds/rename.o passes/cmds/autoname.o passes/cmds/connect.o passes/cmds/scatter.o passes/cmds/setundef.o passes/cmds/splitnets.o passes/cmds/stat.o passes/cmds/setattr.o passes/cmds/copy.o passes/cmds/splice.o passes/cmds/scc.o passes/cmds/torder.o passes/cmds/logcmd.o passes/cmds/tee.o passes/cmds/write_file.o passes/cmds/connwrappers.o passes/cmds/cover.o passes/cmds/trace.o passes/cmds/plugin.o passes/cmds/check.o passes/cmds/qwp.o passes/cmds/edgetypes.o passes/cmds/portlist.o passes/cmds/chformal.o passes/cmds/chtype.o passes/cmds/blackbox.o passes/cmds/ltp.o passes/cmds/scratchpad.o passes/cmds/logger.o passes/cmds/printattrs.o passes/cmds/sta.o passes/cmds/clean_zerowidth.o passes/equiv/equiv_make.o passes/equiv/equiv_miter.o passes/equiv/equiv_simple.o passes/equiv/equiv_status.o passes/equiv/equiv_add.o passes/equiv/equiv_remove.o passes/equiv/equiv_induct.o passes/equiv/equiv_struct.o passes/equiv/equiv_purge.o passes/equiv/equiv_mark.o passes/equiv/equiv_opt.o passes/fsm/fsm.o passes/fsm/fsm_detect.o passes/fsm/fsm_extract.o passes/fsm/fsm_opt.o passes/fsm/fsm_expand.o passes/fsm/fsm_recode.o passes/fsm/fsm_info.o passes/fsm/fsm_export.o passes/fsm/fsm_map.o passes/hierarchy/hierarchy.o passes/hierarchy/uniquify.o passes/hierarchy/submod.o passes/memory/memory.o passes/memory/memory_dff.o passes/memory/memory_share.o passes/memory/memory_collect.o passes/memory/memory_unpack.o passes/memory/memory_bram.o passes/memory/memory_map.o passes/memory/memory_memx.o passes/memory/memory_nordff.o passes/memory/memory_narrow.o passes/opt/opt.o passes/opt/opt_merge.o passes/opt/opt_mem.o passes/opt/opt_mem_feedback.o passes/opt/opt_mem_priority.o passes/opt/opt_mem_widen.o passes/opt/opt_muxtree.o passes/opt/opt_reduce.o passes/opt/opt_dff.o passes/opt/opt_share.o passes/opt/opt_clean.o passes/opt/opt_expr.o passes/opt/share.o passes/opt/wreduce.o passes/opt/opt_demorgan.o passes/opt/rmports.o passes/opt/opt_lut.o passes/opt/opt_lut_ins.o passes/opt/pmux2shiftx.o passes/opt/muxpack.o passes/pmgen/test_pmgen.o passes/pmgen/ice40_dsp.o passes/pmgen/ice40_wrapcarry.o passes/pmgen/xilinx_dsp.o passes/pmgen/peepopt.o passes/pmgen/xilinx_srl.o passes/proc/proc.o passes/proc/proc_prune.o passes/proc/proc_clean.o passes/proc/proc_rmdead.o passes/proc/proc_init.o passes/proc/proc_arst.o passes/proc/proc_mux.o passes/proc/proc_dlatch.o passes/proc/proc_dff.o passes/proc/proc_memwr.o passes/sat/sat.o passes/sat/freduce.o passes/sat/eval.o passes/sat/sim.o passes/sat/miter.o passes/sat/expose.o passes/sat/assertpmux.o passes/sat/clk2fflogic.o passes/sat/async2sync.o passes/sat/supercover.o passes/sat/fmcombine.o passes/sat/mutate.o passes/sat/cutpoint.o passes/sat/fminit.o passes/techmap/flatten.o passes/techmap/techmap.o passes/techmap/simplemap.o passes/techmap/dfflibmap.o passes/techmap/maccmap.o passes/techmap/libparse.o passes/techmap/iopadmap.o passes/techmap/clkbufmap.o passes/techmap/hilomap.o passes/techmap/extract.o passes/techmap/extract_fa.o passes/techmap/extract_counter.o passes/techmap/extract_reduce.o passes/techmap/alumacc.o passes/techmap/dffinit.o passes/techmap/pmuxtree.o passes/techmap/muxcover.o passes/techmap/aigmap.o passes/techmap/tribuf.o passes/techmap/lut2mux.o passes/techmap/nlutmap.o passes/techmap/shregmap.o passes/techmap/deminout.o passes/techmap/insbuf.o passes/techmap/attrmvcp.o passes/techmap/attrmap.o passes/techmap/zinit.o passes/techmap/dfflegalize.o passes/techmap/dffunmap.o passes/techmap/flowmap.o passes/techmap/extractinv.o passes/tests/test_autotb.o passes/tests/test_cell.o passes/tests/test_abcloop.o backends/aiger/aiger.o backends/aiger/xaiger.o backends/blif/blif.o backends/btor/btor.o backends/cxxrtl/cxxrtl_backend.o backends/edif/edif.o backends/firrtl/firrtl.o backends/intersynth/intersynth.o backends/json/json.o backends/rtlil/rtlil_backend.o backends/simplec/simplec.o backends/smt2/smt2.o backends/smv/smv.o backends/spice/spice.o backends/table/table.o backends/verilog/verilog_backend.o techlibs/achronix/synth_achronix.o techlibs/anlogic/synth_anlogic.o techlibs/anlogic/anlogic_eqn.o techlibs/anlogic/anlogic_fixcarry.o techlibs/common/synth.o techlibs/common/prep.o techlibs/coolrunner2/synth_coolrunner2.o techlibs/coolrunner2/coolrunner2_sop.o techlibs/coolrunner2/coolrunner2_fixup.o techlibs/easic/synth_easic.o techlibs/ecp5/synth_ecp5.o techlibs/ecp5/ecp5_gsr.o techlibs/efinix/synth_efinix.o techlibs/efinix/efinix_fixcarry.o techlibs/gatemate/synth_gatemate.o techlibs/gowin/synth_gowin.o techlibs/greenpak4/synth_greenpak4.o techlibs/greenpak4/greenpak4_dffinv.o techlibs/ice40/synth_ice40.o techlibs/ice40/ice40_braminit.o techlibs/ice40/ice40_opt.o techlibs/intel_alm/synth_intel_alm.o techlibs/intel/synth_intel.o techlibs/machxo2/synth_machxo2.o techlibs/nexus/synth_nexus.o techlibs/quicklogic/synth_quicklogic.o techlibs/sf2/synth_sf2.o techlibs/xilinx/synth_xilinx.o techlibs/xilinx/xilinx_dffopt.o 
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libGL.a... (this will be cached in "/usr/lib/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libGL.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libal.a... (this will be cached in "/usr/lib/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libal.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libhtml5.a... (this will be cached in "/usr/lib/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libhtml5.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libstubs.a... (this will be cached in "/usr/lib/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libstubs.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libc.a... (this will be cached in "/usr/lib/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libc.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libcompiler_rt.a... (this will be cached in "/usr/lib/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libcompiler_rt.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libc++-noexcept.a... (this will be cached in "/usr/lib/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libc++-noexcept.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libc++abi-noexcept.a... (this will be cached in "/usr/lib/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libc++abi-noexcept.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libdlmalloc.a... (this will be cached in "/usr/lib/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libdlmalloc.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libc_rt.a... (this will be cached in "/usr/lib/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libc_rt.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libsockets.a... (this will be cached in "/usr/lib/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libsockets.a" for subsequent builds)
cache:INFO:  - ok
wasm-ld: error: /usr/lib/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libc.a(ldexp.o): attempt to add bitcode file after LTO.
emcc: error: '/opt/emscripten-llvm/bin/wasm-ld -o yosys.wasm kernel/version_8b1eafc.o kernel/driver.o kernel/register.o kernel/rtlil.o kernel/log.o kernel/calc.o kernel/yosys.o kernel/binding.o kernel/cellaigs.o kernel/celledges.o kernel/satgen.o kernel/qcsat.o kernel/mem.o kernel/ffmerge.o kernel/ff.o libs/bigint/BigIntegerAlgorithms.o libs/bigint/BigInteger.o libs/bigint/BigIntegerUtils.o libs/bigint/BigUnsigned.o libs/bigint/BigUnsignedInABase.o libs/sha1/sha1.o libs/json11/json11.o libs/subcircuit/subcircuit.o libs/ezsat/ezsat.o libs/ezsat/ezminisat.o libs/minisat/Options.o libs/minisat/SimpSolver.o libs/minisat/Solver.o libs/minisat/System.o frontends/aiger/aigerparse.o frontends/ast/ast.o frontends/ast/simplify.o frontends/ast/genrtlil.o frontends/ast/dpicall.o frontends/ast/ast_binding.o frontends/blif/blifparse.o frontends/json/jsonparse.o frontends/liberty/liberty.o frontends/rtlil/rtlil_parser.tab.o frontends/rtlil/rtlil_lexer.o frontends/rtlil/rtlil_frontend.o frontends/verific/verific.o frontends/verilog/verilog_parser.tab.o frontends/verilog/verilog_lexer.o frontends/verilog/preproc.o frontends/verilog/verilog_frontend.o frontends/verilog/const2ast.o passes/cmds/add.o passes/cmds/delete.o passes/cmds/design.o passes/cmds/select.o passes/cmds/show.o passes/cmds/rename.o passes/cmds/autoname.o passes/cmds/connect.o passes/cmds/scatter.o passes/cmds/setundef.o passes/cmds/splitnets.o passes/cmds/stat.o passes/cmds/setattr.o passes/cmds/copy.o passes/cmds/splice.o passes/cmds/scc.o passes/cmds/torder.o passes/cmds/logcmd.o passes/cmds/tee.o passes/cmds/write_file.o passes/cmds/connwrappers.o passes/cmds/cover.o passes/cmds/trace.o passes/cmds/plugin.o passes/cmds/check.o passes/cmds/qwp.o passes/cmds/edgetypes.o passes/cmds/portlist.o passes/cmds/chformal.o passes/cmds/chtype.o passes/cmds/blackbox.o passes/cmds/ltp.o passes/cmds/scratchpad.o passes/cmds/logger.o passes/cmds/printattrs.o passes/cmds/sta.o passes/cmds/clean_zerowidth.o passes/equiv/equiv_make.o passes/equiv/equiv_miter.o passes/equiv/equiv_simple.o passes/equiv/equiv_status.o passes/equiv/equiv_add.o passes/equiv/equiv_remove.o passes/equiv/equiv_induct.o passes/equiv/equiv_struct.o passes/equiv/equiv_purge.o passes/equiv/equiv_mark.o passes/equiv/equiv_opt.o passes/fsm/fsm.o passes/fsm/fsm_detect.o passes/fsm/fsm_extract.o passes/fsm/fsm_opt.o passes/fsm/fsm_expand.o passes/fsm/fsm_recode.o passes/fsm/fsm_info.o passes/fsm/fsm_export.o passes/fsm/fsm_map.o passes/hierarchy/hierarchy.o passes/hierarchy/uniquify.o passes/hierarchy/submod.o passes/memory/memory.o passes/memory/memory_dff.o passes/memory/memory_share.o passes/memory/memory_collect.o passes/memory/memory_unpack.o passes/memory/memory_bram.o passes/memory/memory_map.o passes/memory/memory_memx.o passes/memory/memory_nordff.o passes/memory/memory_narrow.o passes/opt/opt.o passes/opt/opt_merge.o passes/opt/opt_mem.o passes/opt/opt_mem_feedback.o passes/opt/opt_mem_priority.o passes/opt/opt_mem_widen.o passes/opt/opt_muxtree.o passes/opt/opt_reduce.o passes/opt/opt_dff.o passes/opt/opt_share.o passes/opt/opt_clean.o passes/opt/opt_expr.o passes/opt/share.o passes/opt/wreduce.o passes/opt/opt_demorgan.o passes/opt/rmports.o passes/opt/opt_lut.o passes/opt/opt_lut_ins.o passes/opt/pmux2shiftx.o passes/opt/muxpack.o passes/pmgen/test_pmgen.o passes/pmgen/ice40_dsp.o passes/pmgen/ice40_wrapcarry.o passes/pmgen/xilinx_dsp.o passes/pmgen/peepopt.o passes/pmgen/xilinx_srl.o passes/proc/proc.o passes/proc/proc_prune.o passes/proc/proc_clean.o passes/proc/proc_rmdead.o passes/proc/proc_init.o passes/proc/proc_arst.o passes/proc/proc_mux.o passes/proc/proc_dlatch.o passes/proc/proc_dff.o passes/proc/proc_memwr.o passes/sat/sat.o passes/sat/freduce.o passes/sat/eval.o passes/sat/sim.o passes/sat/miter.o passes/sat/expose.o passes/sat/assertpmux.o passes/sat/clk2fflogic.o passes/sat/async2sync.o passes/sat/supercover.o passes/sat/fmcombine.o passes/sat/mutate.o passes/sat/cutpoint.o passes/sat/fminit.o passes/techmap/flatten.o passes/techmap/techmap.o passes/techmap/simplemap.o passes/techmap/dfflibmap.o passes/techmap/maccmap.o passes/techmap/libparse.o passes/techmap/iopadmap.o passes/techmap/clkbufmap.o passes/techmap/hilomap.o passes/techmap/extract.o passes/techmap/extract_fa.o passes/techmap/extract_counter.o passes/techmap/extract_reduce.o passes/techmap/alumacc.o passes/techmap/dffinit.o passes/techmap/pmuxtree.o passes/techmap/muxcover.o passes/techmap/aigmap.o passes/techmap/tribuf.o passes/techmap/lut2mux.o passes/techmap/nlutmap.o passes/techmap/shregmap.o passes/techmap/deminout.o passes/techmap/insbuf.o passes/techmap/attrmvcp.o passes/techmap/attrmap.o passes/techmap/zinit.o passes/techmap/dfflegalize.o passes/techmap/dffunmap.o passes/techmap/flowmap.o passes/techmap/extractinv.o passes/tests/test_autotb.o passes/tests/test_cell.o passes/tests/test_abcloop.o backends/aiger/aiger.o backends/aiger/xaiger.o backends/blif/blif.o backends/btor/btor.o backends/cxxrtl/cxxrtl_backend.o backends/edif/edif.o backends/firrtl/firrtl.o backends/intersynth/intersynth.o backends/json/json.o backends/rtlil/rtlil_backend.o backends/simplec/simplec.o backends/smt2/smt2.o backends/smv/smv.o backends/spice/spice.o backends/table/table.o backends/verilog/verilog_backend.o techlibs/achronix/synth_achronix.o techlibs/anlogic/synth_anlogic.o techlibs/anlogic/anlogic_eqn.o techlibs/anlogic/anlogic_fixcarry.o techlibs/common/synth.o techlibs/common/prep.o techlibs/coolrunner2/synth_coolrunner2.o techlibs/coolrunner2/coolrunner2_sop.o techlibs/coolrunner2/coolrunner2_fixup.o techlibs/easic/synth_easic.o techlibs/ecp5/synth_ecp5.o techlibs/ecp5/ecp5_gsr.o techlibs/efinix/synth_efinix.o techlibs/efinix/efinix_fixcarry.o techlibs/gatemate/synth_gatemate.o techlibs/gowin/synth_gowin.o techlibs/greenpak4/synth_greenpak4.o techlibs/greenpak4/greenpak4_dffinv.o techlibs/ice40/synth_ice40.o techlibs/ice40/ice40_braminit.o techlibs/ice40/ice40_opt.o techlibs/intel_alm/synth_intel_alm.o techlibs/intel/synth_intel.o techlibs/machxo2/synth_machxo2.o techlibs/nexus/synth_nexus.o techlibs/quicklogic/synth_quicklogic.o techlibs/sf2/synth_sf2.o techlibs/xilinx/synth_xilinx.o techlibs/xilinx/xilinx_dffopt.o -L/usr/lib/emscripten/cache/sysroot/lib/wasm32-emscripten/lto -lGL -lal -lhtml5 -lstubs -lc -lcompiler_rt -lc++-noexcept -lc++abi-noexcept -ldlmalloc -lc_rt -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=run --export-if-defined=errmsg --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=_get_tzname --export-if-defined=_get_daylight --export-if-defined=_get_timezone --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-table -z stack-size=5242880 --initial-memory=134217728 --no-entry --max-memory=134217728 --global-base=1024' failed (returned 1)

@sbc100
Copy link
Collaborator

sbc100 commented Jan 13, 2022

Thanks! I was not able to repro locally, but I'm fairly sure #16002 will fix the issue

@yuyichao
Copy link

This is with llvm/clang 13, in case that’s a new transformation they added…

@sbc100
Copy link
Collaborator

sbc100 commented Jan 13, 2022

Emscripten is based on tip-of-tree llvm, which is currently llvm 14 (we roll in the latest changes from llvm several times a day).

Are you sure you are using llvm 13? I'd be surprised if that was working/possible. See #11362 for discussions around possibly supporting older stable llvm versions. However, I also doubt this issue is related to the specific llvm version.. i think its just a matter of crafting an imput with a certain form... which I've not managed to do yet, but I'm happy to land #16002 anyway.

@yuyichao
Copy link

Yes you are right. The archlinux package was using a specific llvm upstream commit.

sbc100 added a commit that referenced this issue Jan 14, 2022
Like the math functions here these can be generated by the compiler
and therefore cannot themselves be part of LTO.

See #15506
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants