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

    <tr>
        <th>Summary</th>
        <td>
            [WebAssembly] wasm-ld assertion failure on isa<UndefinedData>(sym)
        </td>
    </tr>

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

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

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

<pre>
    ```
wasm-ld: /b/s/w/ir/cache/builder/emscripten-releases/llvm-project/lld/wasm/SyntheticSections.cpp:522: virtual void lld::wasm::GlobalSection::writeBody(): Assertion `isa<UndefinedData>(sym)' failed.
```

More context and details here, including steps to reproduce:

https://github.com/emscripten-core/emscripten/issues/22008#issuecomment-2142992412

As mentioned there this is a regression, and bisection leads to it likely caused by one of these:
```
   2024-01-20 sbc@chromium.org [lld][WebAssembly] Fix regression in function signature checking (#78831)
    2024-01-20 sbc@chromium.org [lld][WebAssembly] Match the ELF linker in transitioning away from archive indexes. (#78658)
    2024-01-19 sbc@chromium.org [lld][WebAssembly] Use the archive offset with --whole-archive (#78791)
 2024-01-19 sbc@chromium.org [lld][WebAssembly] Reset context object after each link (#78770)
    2024-01-19 sbc@chromium.org [lld][ELF] Simplify handleLibcall. NFC (#78659)
```


I'll also email @sbc100 with the output of `-Wl,--reproduce` as requested (too big to attach here).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVU2PozgQ_TXOpURkDIRw4NBfrFbq2cO2RnM2dhG8bWzWNp3Ov18V6XRnZkcjTUsRCi5c79Ur17OM0RwcYsuqW1bdb-SSRh_a52DmZ3Sb3utTy3b87cfvGb85yjhlVrPiBpjoeia6yER3ZKIzgYlOSTUiBRZjNdIKTlEFMyd0WUCLMiJtsPZlyubg_0GV1ldNWWScmOieTi6NmIx6QpWMd3Gr5pkVN5UQBPtiQlqkhRdvNNiVCit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