<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/146713>146713</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [wasm-ld] using `--import-memory` cancels out `--page-size=N` options without telling user.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          anlavandier
      </td>
    </tr>
</table>

<pre>
    The current version of the Webassembly linker `wasm-ld` allows the argument `--page-size=N` with N being either `1` or `65536` since the merging of #128942. For some reason, when also passing the `--import-memory` flag, the `page-size` is completely disregarded without telling the caller. This results in `.wasm` files that try to import a memory with the default page-size even if `--page-size=1` was given. 

# How to reproduce 
I don't know anything about linkers and discovered that while compiling rust code to wasm bytecode so it's what I'll describe.
Setup : 
```bash
rustc -Vv
rustc 1.88.0 (6b00bc388 2025-06-23)
binary: rustc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: x86_64-unknown-linux-gnu
release: 1.88.0
LLVM version: 20.1.5

wasm-ld --version
LLD 21.0.0 (https://github.com/llvm/llvm-project.git 1b7cbe1f871ebe572e383a2531257b88168eea1b) # Compiled from source on 2.07.25 
```
```
cargo new --lib wasm-ld-bug-test
cd wasm-ld-bug-test
```
add 
```toml
[lib]
crate-type=["cdylib", "rlib]
``` 
to the `Cargo.toml`
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVMuu2zYQ_Rp6M5BAUS96oYUTw2iANJsG6bLgYySxoUiDpOy4X19Qur5JmrspIEB8zJw5Z4YzIkYzOcSBtO9Iez6INc0-DMJZcRNOGwwH6fVj-DwjqDUEdAluGKLxDvwIaUb4E6WIERdpH2CN-4oBSEfvIi6F1aSjIKz197jZijCtS8YgHS2Kq5iwiOYfJPX5U7a8mzTDJ5Bo3ARo0rxjVfnOb8uubesub6Nx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