Skip to content

Disable import/export name mangling in -O3 builds #16695

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
allsey87 opened this issue Apr 11, 2022 · 4 comments
Closed

Disable import/export name mangling in -O3 builds #16695

allsey87 opened this issue Apr 11, 2022 · 4 comments

Comments

@allsey87
Copy link

I am working with a custom runtime and would like to disable the name mangling in the generated runtime, i.e., the renaming of imports/exports inside the WebAssembly module to a, b, c, etc. While STANDALONE_WASM sounds ideal for this use case, unfortunately it is nowhere near ready for more complicated applications that need runtime support for Pthreads and Asyncify. Is there a hack or a workaround to disable this name mangling so that the module imports/exports have deterministic names?

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.0.1 (5ebe1d4)
clang version 14.0.0 (https://github.com/llvm/llvm-project d98dfb2baabb647a6ac4c4f4399999cfc44433db)
Target: wasm32-unknown-emscripten
Thread model: posix

@allsey87 allsey87 changed the title Disable naming mangling in -O3 builds Disable import/export name mangling in -O3 builds Apr 11, 2022
@allsey87
Copy link
Author

There is an option in one of the Binaryen tools wasm-emscripten-finalize.cpp on line 60 that could be relevant. Also this issue is marked as relevant in the code: WebAssembly/binaryen#3043.

@kripken
Copy link
Member

kripken commented Apr 11, 2022

You can build at -O2 instead of -O3 to disable that optimization.

@sbc100
Copy link
Collaborator

sbc100 commented Jul 15, 2022

We did have another request to explicitly disable this minification from @eyebrowsoffire.. should we consider making this separately configurable?

@kripken
Copy link
Member

kripken commented Jul 15, 2022

I guess that would mean moving MINIFY_WASM_IMPORTS_AND_EXPORTS from an internal setting to an external one (plus some minor changes in emcc.py). I wouldn't be opposed, but it is a new public setting. Is -O2 not good enough, @eyebrowsoffire ?

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