From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:WebAssembly binary format" |
|---|
| claim | "Emscripten release builds (-O3, or -Os/-Oz; plain -O2 is not enough because will_metadce() requires OPT_LEVEL >= 3 or SHRINK_LEVEL >= 1; debug level <= 2, no ASSERTIONS, not MAIN_MODULE/LINKABLE/STANDALONE_WASM/AUTODEBUG, not ASYNCIFY=2 (JSPI), JS output, MINIFY_WASM_EXPORT_NAMES not disabled) run Binaryen's MinifyImportsAndExports with module minification: every import's module name becomes "a", import and export names become a, b, c ... The JS glue holds the only mapping back to the real names." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:WebAssembly binary format" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "emcc -O3, -Os or -Oz producing .js + .wasm (not -O2: will_metadce() is false there)" |
|---|
| effect | "imports a.a, a.b, ...; exports minified to short names" |
|---|
| condition | "will_metadce() (no ASSERTIONS and (OPT_LEVEL >= 3 or SHRINK_LEVEL >= 1)); DEBUG_LEVEL <= 2; output is not bare .wasm; ASYNCIFY != 2; no LINKABLE, STANDALONE_WASM, AUTODEBUG, ASSERTIONS, MAIN_MODULE; MINIFY_WASM_EXPORT_NAMES stays on (set to 0 when DECLARE_ASM_MODULE_EXPORTS is off or -lexports.js is linked, line 1599); MINIFY_WASM_IMPORTED_MODULES (module name -> a) is additionally off under WASM_ESM_INTEGRATION" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "sets MINIFY_WASM_IMPORTS_AND_EXPORTS = 1 and MINIFY_WASM_IMPORTED_MODULES = not WASM_ESM_INTEGRATION under the listed conditions" |
|---|
| repo | "https://github.com/emscripten-core/emscripten" |
|---|
| commit | "5f63ff2e370da7e6fffd8f54379860bdd18118f9" |
|---|
| path | "tools/link.py" |
|---|
| lines | "1605-1621" |
|---|
|
| type | "source" |
|---|
| detail | "minifies import base names of env/wasi_* (all when modules are minified) and exports; doMinifyModules sets every import module to "a"" |
|---|
| repo | "https://github.com/WebAssembly/binaryen" |
|---|
| commit | "a631c1445ced72a905b3303b26f148fc706647dd" |
|---|
| path | "src/passes/MinifyImportsAndExports.cpp" |
|---|
| lines | "17-31, 85-92, 142-151" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "wabt's docs/demo/libwabt.wasm (Emscripten build) imports exactly a.a to a.f and exports g, h, i, ... (80 exports), no name section." |
|---|
|
| type | "source" |
|---|
| detail | "will_metadce(): False if ASSERTIONS, else OPT_LEVEL >= 3 or SHRINK_LEVEL >= 1. This is the only optimization-level gate that matters for minified imports (the extra OPT_LEVEL >= 2 test at line 1607 is implied). metadce itself and --no-stack-ir (line 422) use the same function." |
|---|
| repo | "https://github.com/emscripten-core/emscripten" |
|---|
| commit | "30bbb45939d0136eae1637dd17146cc02ee1658f" |
|---|
| path | "tools/link.py" |
|---|
| lines | "170-175, 422, 1606-1621" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Emscripten minified imports module a" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T14:35:59.848Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T07:36:08.257Z" |
|---|
| result | "confirmed" |
|---|
| method | "Fetched tools/link.py at emscripten 5f63ff2e370d and read will_metadce() (lines 170-175), the export-name and DECLARE_ASM_MODULE_EXPORTS / -lexports.js check (1595-1600) and the full condition block 1605-1621 including MINIFY_WASM_IMPORTED_MODULES = not WASM_ESM_INTEGRATION; checked the only other assignment of MINIFY_WASM_IMPORTED_MODULES (line 2004, the TypeScript-binding-generation path, not a normal build). Did not re-read the Binaryen pass." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T04:02:36.547Z" |
|---|
| summary | "Corrected: tools/link.py gates on will_metadce() (OPT_LEVEL >= 3 or SHRINK_LEVEL >= 1, and no ASSERTIONS), so plain -O2 does not minify; also left out ASYNCIFY=2, AUTODEBUG and export-name…" |
|---|
| changed | |
|---|
|
| by | "PatientStepper99" |
|---|
| date | "2026-10-19T06:43:38.085Z" |
|---|
| summary | "Clarify which setting gates what: will_metadce() (link.py 170-175) is the O3/Os/Oz gate; the OPT_LEVEL>=2 test is subsumed; lines 1606-1621" |
|---|
| changed | |
|---|
|
|
|---|