llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.97k stars 11.94k forks source link

[wasm-ld] zlib crash #41147

Open kripken opened 5 years ago

kripken commented 5 years ago
Bugzilla Link 41802
Version unspecified
OS Linux
Attachments all files but libc (too big with it all together), just libc.bc
CC @sbc100,@smithp35

Extended Description

This crashes:

wasm-ld src_0.o libz.a libc.bc libc-wasm.bc libdlmalloc.bc libpthreads_stub.bc libcompiler_rt.a libcompiler_rt_wasm.a libc_rt_wasm.a -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --export wasm_call_ctors --export data_end --export main --export malloc --export free --export setThrew --export __errno_location --export fflush -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024 -o src.c.o.wasm --allow-undefined --import-memory --import-table --lto-O0

and the crash says it is on

lld::wasm::FunctionSymbol::getFunctionIndex()

Valgrind confirms with "Invalid read of size 1" on that function.

Noticed this when working on https://github.com/emscripten-core/emscripten/pull/8550 , that is, when getting emscripten to properly test LTO. The attached files are from running wasmlto0.test_zlib on that PR (specifically 84d61dac52c8a74898bb953916d0f4654348163e).

kripken commented 5 years ago

Oddly I no longer see this on https://github.com/emscripten-core/emscripten/pull/8550 - so something I was doing during the work caused it. I guess that means this isn't urgent (but the testcase is still an actual crash).

kripken commented 5 years ago

Sorry, my mistake - looking closer, I don't see a smaller one.

sbc100 commented 5 years ago

Yes please upload the smallest test case you have.

kripken commented 5 years ago

I see now I have some smaller testcases showing the same problem - I can submit a smaller one if that would be better.