Stream: git-wasmtime

Topic: wasmtime / issue #10286 Investigate removing symbol table...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2025 at 21:44):

alexcrichton opened issue #10286:

In https://github.com/bytecodealliance/wasmtime/pull/10285 it was shown that sections such as .symtab, .strtab, and .shstrtab account for a non-trivial portion of the size of an object file:

$ objdump --section-headers target/wasm32-wasip1/release/hello-wasm-world-0x00.cwasm

target/wasm32-wasip1/release/hello-wasm-world-0x00.cwasm:       file format elf64-littleriscv

Sections:
Idx Name              Size     VMA              Type
...
  3 .text             00011bdc 0000000000000000
...
  9 .symtab           00001788 0000000000000000
 10 .strtab           000040f0 0000000000000000
 11 .shstrtab         00000089 0000000000000000

They're almost 25% of the size of the .text section itself, wow!

These sections are occasionally useful to have in a *.cwasm when profiling. Native profilers/debuggers can often use these sections and think that a dynamic library is loaded here when the profiler doesn't otherwise have native jit integration (e.g. via perfmap, jitdump, etc). In that sense I think it's useful to still emit these by default, but we should have a Config::* option for removing them.

In theory it should be possible to just directly remove them entirely and nothing should break in Wasmtime itself. Famous last words though. I'm not 100% sure how we'd do this but I suspect we'd use the object crate a bit differently and maybe assign the same empty string to all symbol names or somehow not assign symbols at all (I'm not sure if that's possible?).

If something in Wasmtime does break from the removal of these symbols we should fix that to not rely on symbol names and instead use something in the compiled metadata here and there instead. For example function indices, offsets, etc. Exactly what the solution might look like depends on what's using a symbol (if any) and in what context it's using it.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2025 at 21:45):

alexcrichton commented on issue #10286:

cc @posborne

view this post on Zulip Wasmtime GitHub notifications bot (Feb 27 2025 at 17:58):

alexcrichton added the wasmtime:code-size label to Issue #10286.


Last updated: Feb 28 2025 at 02:27 UTC