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

    <tr>
        <th>Summary</th>
        <td>
            Backport Wasm 64-bit table fix to 19.x
        </td>
    </tr>

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

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

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

<pre>
    In `rustc`, the `wasm64-unknown-unknown` target produces invalid Wasm modules due to an issue with 64-bit tables that was fixed in https://github.com/llvm/llvm-project/pull/107780. Would it be possible to backport that fix to the 19.x release branch so that rust can pick it up?

Here are steps to reproduce the issue with cargo/rustc:
```
❯ rustc +nightly --version
rustc 1.85.0-nightly (a224f3807 2024-12-09)

❯ cargo new --bin foo

❯ cd foo

❯ cargo +nightly build -Z build-std=std,panic_abort --target wasm64-unknown-unknown

❯ wasm-objdump -j Elem -x target/wasm64-unknown-unknown/debug/foo.wasm | head

foo.wasm:       file format wasm 0x1
module name: <foo-87b5668ca08bcff0.wasm>

Section Details:

Elem[1]:
 - segment[0] flags=0 table=0 count=91 - init i64=94235877441537
  - elem[94235877441537] = ref.func:3 <_ZN3foo4main17h3e4566f0ffb33d02E>
  - elem[94235877441538] = ref.func:5 <_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17ha696e16b756653ccE>
```
Here we can see the init expression for the table is reading uninitialized memory.

cc @sbc100 @alexcrichton @lwshang
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVEuP4zYM_jXKhXCghx_xIYfMZIL20h56WGAvC0mmbe3IkiHJk0x_fSE76Q62O4cGgU2T1MeHyE_GaAaHeCTVE6nOO7mk0Yej7OSkgkxRj-ZVvuNO-e79-LsDUtOwxKRJTQl_hjRiVl1lnOqyWNyr81f3eJOaQpJhwARz8N2iMYJxb9KaDr7IOMH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