Skip to content

Emscripten compiler/ABI version in the Wasm binary #9951

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
MarkMcCaskey opened this issue Dec 3, 2019 · 3 comments
Closed

Emscripten compiler/ABI version in the Wasm binary #9951

MarkMcCaskey opened this issue Dec 3, 2019 · 3 comments

Comments

@MarkMcCaskey
Copy link

Hello! Does Emscripten store the version used to compile it anywhere in the Wasm itself? Perhaps this is using Emscripten incorrectly, but it'd be nice to be able to find out which version of Emscripten a Wasm binary is from so that tools can more intelligently interact with it.

I looked through the documentation and tried compiling a module but wasn't able to find that information anywhere.

If this isn't something that currently exists is it something you'd consider adding?

@kripken
Copy link
Member

kripken commented Dec 3, 2019

deleting as @sbc100 's comment is better :)

@sbc100
Copy link
Collaborator

sbc100 commented Dec 3, 2019

There is a specification for the producers section:
https://github.com/WebAssembly/tool-conventions/blob/master/ProducersSection.md
You can enable this in emscripten by passing -s EMIT_PRODUCERS_SECTION at link time.

However emscripten doesn't not include this by default. For the rational you can see the discussion here: WebAssembly/tool-conventions#93.

If your goal is to load wasm modules that are built by emscripten outside of emscripten then there are also other options available to you:

  1. EMIT_EMSCRIPTEN_METADATA: T his is an option that was added a while back by somebody who, IIRC, wanted to include extra metadata so that they could load the resulting wasm file without any JS. It includes things like the static data size, and memory layout, etc.

  2. STANDALONE_WASM: Building with this option is results in a binary that looks a lot more like the WASI standard binaryies.

Of these two options I would always prefer STANDALONE_WASM. Its being actively worked and supported. IMHO EMIT_EMSCRIPTEN_METADATA was kind of ah-hoc stop gap and I personally would like to see it disappear one day.

@MarkMcCaskey
Copy link
Author

Great -- thanks for the quick and detailed replies!

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