llvm / llvm/llvm-project

[lld][WebAssembly] With `--stack-first` as default, it's unintuitive to reserve a segment of memory at the start of the linear memory

Open
#177,250 7 comments 1 reaction 0 assignees View on GitHub
lld:wasm
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

[tic-80#2880](https://github.com/nesbox/TIC-80/issues/2880) gives some relevant context. Before #151015 , projects like TIC-80 and WASM4 often used `--global-base` to specify a reserved section of linear memory that was shared with the host, akin to memory-mapped I/O. Now with `--stack-first`, the stack is still put before `--global-base`, which causes projects that had worked before to break when linked with newer versions of lld. This can be worked around by explicitly setting `--stack-first` (for older versions) and setting your stack big enough to encompass the entire reserved space + desired stack size, but that's not extremely intuitive (and I worry about future changes in the layout still breaking after the fact).

For these kinds of situations, it would be nice if there was something like `--stack-base`, or `--memory-base` to allow more easily reserving a host memory range.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.