<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/177250>177250</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lld][WebAssembly] With `--stack-first` as default, it's unintuitive to reserve a segment of memory at the start of the linear memory
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Taywee
</td>
</tr>
</table>
<pre>
[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.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VM1u-zYMfxrlQiSw5bhODjmkLQL0sO2wAj3TNm1rkaVApON6Tz9ISdAA2_4nA5JI_75IZDa9Izqo8lWV7yucZPDh8InLTLSqfbvEGzHNepcpXejdLlPlu9K7QeTCqjgqfVL61BsZpnrT-FHpkyOu_bfSp8-Pt1R2MswTsdKnVK_30JsrMbAfCQJZuqITaLwT-pYNwCt1PhAoXeRlnuUlKP0Gl-D_okYYrDkT3FoDuha-jn_-tgXfCTmYmFpQL9l63Vtfo13XyKReMhAPfKHGdAsgBGIKV2qBqRHjHfgOrHGEAUYafVhABhSYkYEHDNTCbGQAGQgGzxLR4Nm42PT2fj3i5UItfCh9-mMD8LufbyUJCgs253VnAot6yWJ17JROwTCwGGvhMgnUd97_xh-L5sE0AzQ4MfGPGgnpgC3MPpypffQQD3UgPMM8kIvkzg8WjmYKcK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