Mangled exports and imports names

74 views
Skip to first unread message

Alexander Serov

unread,
Apr 30, 2021, 4:35:00 AM4/30/21
to emscripten-discuss
Hello!
If i build a simple wasm executable with this command:
em++ -O3 -std=c++14 -s NODERAWFS=1 filesystem.cpp -o filesystem.js

And then if i print imports and exports it will looks like this:
 Functions:
    "a"."b": [] -> []
    "a"."c": [I32, I32, I32, I32] -> [I32]
    "a"."d": [I32] -> [I32]
    "a"."e": [I32, I32, I32] -> [I32]
    "a"."f": [I32, I32] -> [I32]
    "a"."g": [I32, I32, I32, I32] -> [I32]
    "a"."h": [I32, I32, I32] -> [I32]
    "a"."i": [I32, I32, I32] -> [I32]
    "a"."j": [I32, I32, I32, I32, I32] -> [I32]
    "a"."k": [I32, I32, I32] -> [I32]
    "a"."l": [I32] -> [I32]
    "a"."m": [I32, I32, I32, I32, I32] -> [I32]
    "a"."n": [I32, I32] -> [I32]
    "a"."o": [I32, I32, I32] -> []
    "a"."p": [I32] -> [I32]

Then if i builde with the same command but add -s STANDALONE_WASM=1 then imports and exports is pretty readable like so:

Functions:
    "wasi_snapshot_preview1"."fd_read": [I32, I32, I32, I32] -> [I32]
    "wasi_snapshot_preview1"."fd_close": [I32] -> [I32]
    "wasi_snapshot_preview1"."fd_seek": [I32, I64, I32, I32] -> [I32]
    "wasi_snapshot_preview1"."fd_write": [I32, I32, I32, I32] -> [I32]
    "wasi_snapshot_preview1"."environ_sizes_get": [I32, I32] -> [I32]
    "wasi_snapshot_preview1"."environ_get": [I32, I32] -> [I32]
    "wasi_snapshot_preview1"."proc_exit": [I32] -> []
  Memories:
  Tables:
  Globals:
Exports:
  Functions:
    "fflush": [I32] -> [I32]
    "_start": [] -> []
    "__errno_location": [] -> [I32]
    "free": [I32] -> []
    "malloc": [I32] -> [I32]
    "stackSave": [] -> [I32]
    "stackRestore": [I32] -> []
    "stackAlloc": [I32] -> [I32]
    "setThrew": [I32, I32] -> []

Question: Is somebody know how to force emcc to not mangle my export names? due to they need to me in readable format.

Alexander Serov

unread,
Apr 30, 2021, 4:57:39 AM4/30/21
to emscripten-discuss
Thsnks. I find an answer here
Reply all
Reply to author
Forward
0 new messages