You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Avoid creating JS symbols for symbols only used in dynamic linking
Symbols that are exported using EMSCRIPTEN_KEEPALIVE are supposed
to be exported to the outside world (i.e. on the Module object) and
also be available to call JS within the module.
Symbols exports for the purposed of dynamic linking so not need to be
exported on the Module and are added (at runtime) to `wasmImports` which
acts as a kind of global symbol table for the program.
In in the case of `-sMAIN_MODULE=1` we export *all* symbols from
all libraries, and prior to this change it was not possible to
distingish between all the exported generated because of
`--export-dynamic`, and the exports generated due to
`EMSCRIPTEN_KEEPALIVE`.
This change allows us to differentiate by running `wasm-ld` twice: once
without `--export-dynamic` (to get the smaller list of
`EMSCRIPTEN_KEEPALIVE`) and then once with `--export-dynamic` to
produce the actual wasm that we output.
This takes the list of exports that we turn in to JS globals from 7993
to 28, massively reducing the overhead of `-sMAIN_MODULE=1`.
0 commit comments