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

    <tr>
        <th>Summary</th>
        <td>
            Shared libraries that don't use a memory are currently assumed to be wasm32
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:WebAssembly,
            lld:wasm
      </td>
    </tr>

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

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

<pre>
    wasm-ld must be using some kind of heuristic to determine the architecture of shared libraries.

If I create a shared library from the following source, and compile with the a wasm64 target

```
int library_func() {
 return 42;                                   
}
```

I get the following error from the linker:

```
wasm-ld: error: library.so: wasm32 object file can't be linked in wasm64 mode
```

I'm guessing the same thing might also happen for non-shared object files.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEU0tvozAQ_jXmMkrkGBKSA4e0VaSe97DHlR8DeOtH5LFb5d-vHKjarVZdhADD4O81I4nsFBAHtn9gQpDSO86ZEGz_1MiS55iG5V2jorkNb5L8xhnwhTIohEI2TEDRI7zYYCCOMGNJlrLVkCMYzJi8DQh5RpBJzzajziVhLaVZJjTgrEoyWaQt40-Mn5fr8wjPoBPKjCD_Lr3BmKK_bzlG5-LbQqIkjUw8ggwGdPRX6xDebJ4XbKjcDx1kmSbMn5HYga_nfWlDfsf5NZagmTgycQLWPyzfIWEuKUAnWPsA_z9WkP7pn2irWJgwfxGEKcX0odTZ8IKJtedvqK_xsPa8_F0fVilbinVVK1oBUf1GnWGsFmkZmOjvcd4xDNjwbpaPBr-jzUTvYSpI9z6oNEn6GnZdejvNGaSjCLO8XjHAGBOEGDZrmp9Y0LYxQ2tO7Uk2OOx6wU-7nvO-mYfd4XgSu5PpR3Fod63pdKsP-_GAXCEeuW7sILjoeL_rOG8577dGdq1WvZBjq_f7rmcdRy-t2zr36rcxTY0lKjicjn1_bJxU6GgdACX1C4bq4E9UZyL0yt3qPIhHJoS7e1u9WUckDXXLjSoTsY47S5k-QLLNDocfX5oc8iwzmLiYXqi2pkcf0w1kQtAlJQzZ3UASFY-mjpHCNbimJDfMOV-pNoK4MHGZbJ6L2urombhU7PW2uaZY7WXicldLTFwWwa-D-BMAAP__ycw8XA">