<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - wasm32: Runtime signature for __muloti4 may be wrong"
   href="https://bugs.llvm.org/show_bug.cgi?id=37401">37401</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>wasm32: Runtime signature for __muloti4 may be wrong
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: WebAssembly
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>alex@crichton.co
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dan433584@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20279" name="attach_20279" title="IR">attachment 20279</a> <a href="attachment.cgi?id=20279&action=edit" title="IR">[details]</a></span>
IR

When Rust code uses LLD and turns on `--fatal-warnings` with LLD recent builds
of LLD will fail with:


lld: error: Function type mismatch: __muloti4
<span class="quote">>>> defined as (I32, I64, I64, I64, I64) -> void in core-e5bf43c84917cf15.core5-ceca1e00e36ddf6282e22e0bc4528df.rs.rcgu.o
>>> defined as (I32, I64, I64, I64, I64, I32) -> void in compiler_builtins-9dbaa47e4e7765c7.compiler_builtins4-c780f72fce4e9840f0ab093af18d8809.rs.rcgu.o</span >


Our __muloti4 implementation [1] is located in compiler_builtins (the second of
those two object files) and the last extra argument is the flag as to whether
the call overflowed. It looks like, though, that the wasm code generator isn't
expecting that flag to be there, which seems odd?

If the attached IR is compiled and disassembled with `wasm2wat` you can see
that LLVM is emitting the first signature above (no flag at the end). The
internal IR (I think?) looks to have a final trailing argument but it seems to
be chopped off somewhere in the wasm backend.

Is this signature different on wasm? Or is this a bug in the wasm codegen?

[1]:
<a href="https://github.com/rust-lang-nursery/compiler-builtins/blob/cb04a0718b2437a32436d4cc2eb66d012066c835/src/int/mul.rs#L105-L108">https://github.com/rust-lang-nursery/compiler-builtins/blob/cb04a0718b2437a32436d4cc2eb66d012066c835/src/int/mul.rs#L105-L108</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>