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

    <tr>
        <th>Summary</th>
        <td>
            wasm-ld misidentifies library as non-wasm when linking no symbols
        </td>
    </tr>

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

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

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

<pre>
    I built a simple static library, libkx.a. The way my build system works, when you include a library it will make the headers available to the code and automatically add the library to the list of libraries to link.

In my case the libkx.a library is needed just for the headers. When the library is added and the project linked I get a warning:

wasm-ld: warning: ../../../../kst/bin/wasi/debug/libkst.a: archive member 'libkx.a' is neither Wasm object file nor LLVM bitcode

If I unpack the library (llvm-ar -x ../bin/wasi/debug/libkx.a) and inspect each object (llvm-readobj-14 -h) I can confirm that all included objects are in fact WASM, this is typical, but all included objects are ok:

"File: kx_murmur3.o
Format: WASM
Arch: wasm32
AddressSize: 32bit
Version: 0x1
Inspecting kx_mutex_common.o:
"

This same library compiles fine, without errors or warnings when linking it when things in it are actually needed. But in this particular case where  the library is not actually needed I get this spurious warning.

I eliminated the library from the link line - so its solved for me - but this is an incorrect warning and will lead to confusion for many people (as it did for me)



</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VE9v28gP_TTyhbBgjZ06PviQ_goD-aG9bIv2WFAaymI9f4zhKI730y84spA4wO5FNsgh-Ui-RxThYyDaVw-fq4cvCxzzENP-L-yR3P8_4zmzZFy00V73z9CO7DIgCPuzI5CMmTtw3CZM18r8T_-eXmus4cdAcMEr-GsJsiBXyeThEtNJ9OVloADXOAKHzo2WAOc8wBku7Bx4PBHkgWAgtJQE8AXZYesIciyOLmpgsIBjjl7BoHNXQGuLe054e-1YMsT-ZmYSdTgOp7pafalWT9P3OSjoDoXmHNrRGziBQGTJwp9RMvQxvYdYwy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