I recently ran into a toolchain issue, I believe with wasm-ld
, where the name
custom section was not emitted in the linked WebAssembly module. My current understanding is that the name
custom section is added by the LLVM toolchain so that one can easily identify which function is which, instead of getting Wasm backtraces containing uninformative lines like <unknown>!<wasm function 23>
. I believe wasm2wat
also uses the name
custom section to use named IDs (e.g., $foo
) for the function names in the translated WAT. In a small example where I -c
compile two Wasm object files, I can see that they contain linking
custom sections with name information and, when I link these files together, I do see the expected name
custom section. But in a larger project, the name
section is missing--does anyone know why this would be the case?
cc: @Sam Clegg, who probably could give me a hint at what is going on here...
If you have wasm-opt
in PATH then I think trecent clang toolchains run it by default and I believe by-default it strips the name
section
And it's sad that there's no way to control the clang driver what flags to pass to wasm-opt, or whether to invoke wasm-opt at all. I've submitted https://github.com/llvm/llvm-project/issues/55781 some time ago for this
Thanks, wasm-opt
is the culprit! Once I removed that from my PATH
, wasm-ld
emitted the name
custom section. @Cheng Shao, I'll comment on the issue you linked to.
Andrew Brown has marked this topic as resolved.
Last updated: Dec 23 2024 at 12:05 UTC