Skip to content
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

Links OK with -O1, but crashes in asm2wasm with -O2 or -O3 #7123

Closed
yksoft1 opened this issue Sep 14, 2018 · 2 comments
Closed

Links OK with -O1, but crashes in asm2wasm with -O2 or -O3 #7123

yksoft1 opened this issue Sep 14, 2018 · 2 comments

Comments

@yksoft1
Copy link

yksoft1 commented Sep 14, 2018

Here is my build command line.
emcc -O3 -s USE_SDL=2 -s TOTAL_MEMORY=104857600 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s EMTERPRETIFY_WHITELIST=@d3.txt dosbox-x.bc --memory-init-file 0 -o dosbox-x.html
It crashes with such output.

user@yksoft-mbp2011 /d/tmpp/dbxvsxx/src
$ emcc -O3 -s USE_SDL=2 -s TOTAL_MEMORY=104857600 -s EMTERPRETIFY=1 -s EMTERP
RETIFY_ASYNC=1 -s EMTERPRETIFY_WHITELIST=@d3.txt dosbox-x.bc --memory-init-fil
e 0 -o dosbox-x.html
warning: Output contains some very large functions (20196 lines in __Z19CPU_Core
_Normal_Runv), consider building source files with -Os or -Oz, and/or trying OUT
LINING_LIMIT to break them up (see settings.js; note that the parameter there af
fects AST nodes, while we measure lines here, so the two may not match up)
warning: Output contains some very large functions (20196 lines in __Z19CPU_Core
_Normal_Runv), consider building source files with -Os or -Oz, and/or trying OUT
LINING_LIMIT to break them up (see settings.js; note that the parameter there af
fects AST nodes, while we measure lines here, so the two may not match up)
["binary", "%", "d8", "d1"]
ERROR:root:'C:\mingwd\home\user.emscripten_ports\binaryen\binaryen-version_50\b
in\asm2wasm dosbox-x.temp.asm.js --total-memory=104857600 --trap-mode=allow -O3
--mem-init=dosbox-x.html.mem --mem-base=1024 -o dosbox-x.wasm' failed

If I replace -O3 with -O1, it worked but would still crash asm2wasm with -O2. Did I trigger a bug in binaryen? asm2wasm didn't use very large amount of memory before it's crashing.

Here are the files mentioned in the command line.
https://drive.google.com/open?id=1XSM7OI7K_Gw-sIJgPUq-q5OLS0Bp0D2x

@kripken
Copy link
Member

kripken commented Sep 14, 2018

Thanks for reporting @yksoft1, turns out this was a missing case in binaryen. Fix is in WebAssembly/binaryen#1681 . I think we didn't notice it before because it only happens if the JS optimizer is run on very specific code (the JS optimizer runs here due to emterpretify).

@yksoft1
Copy link
Author

yksoft1 commented Sep 15, 2018

I tried your branch asm2wasm-mod-sign, and it worked for linking my Dosbox-X fork now. Thanks!

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

2 participants