alexcrichton opened issue #10244:
Currently Wasmtime will allocate space in
*.cwasm
files to ensure that sections are page-aligned on disk. This is done for two reasons:
- When mmap-ing a
*.cwasm
into the address space the.text
section needs to be made executable and we don't want to make non-code executable, meaning that the start/end of the.text
section are both page aligned. The base alignment is set here and the alignment for the end is set here.- When
memory_init_cow
is enabled then it's necessary to mmap the.rodata
section from the*.cwasm
into the address space, meaning the start of the data section is also aligned. The data section alignment is set here. Thedata_align
value is set hereWhen writing up this issue I thought we'd need to fix both these locations but it turns out we already conditionally set
data_align
by skipping that method ifmemory_init_cow
isn't called. That means that I think the only thing we need to do here is to update compilation to Pulley to use a different alignment for the text section. We already have some logic for conditionally making the.text
section executable, so we mostly just need to propagate similar logic back to the actual creation of the*.cwasm
file.
alexcrichton added the enhancement label to Issue #10244.
alexcrichton added the wasmtime label to Issue #10244.
alexcrichton added the wasmtime:code-size label to Issue #10244.
Last updated: Feb 28 2025 at 02:27 UTC