```
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).
[WebAssembly] wasm-ld assertion failure on isa<UndefinedData>(sym)
This is a GitHub Issue
repo:llvm-project
owner:llvm
Title : [WebAssembly] wasm-ld assertion failure on isa<UndefinedData>(sym)
Issue date:

--- start body ---
```
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).
--- end body ---
