<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 - LLD doesn't preserve import modules on wasm32-unknown-unknown-wasm"
   href="https://bugs.llvm.org/show_bug.cgi?id=37168">37168</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLD doesn't preserve import modules on wasm32-unknown-unknown-wasm
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </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>All Bugs
          </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>llvm-bugs@lists.llvm.org, sbc@chromium.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>LLD currently doesn't preserve the import module of imports when generating a
final binary. I've been testing this first by creating an IR file:



define void @main() {
  call void @foo();
  ret void
}

declare void @foo() #0

attributes #0 = { "wasm-import-module"="bar" }



Then compiling that with LLC:

  $ llc foo.ll -filetype=obj -mtriple=wasm32-unknown-unknown-wasm

Then linking it with LLD

  $ lld -flavor wasm foo.o -o foo.wasm --no-entry --allow-undefined

And finally looking at it with `wasm2wat`

  $ wasm2wat foo.o | grep '"foo"'
    (import "bar" "foo"  (func (;0;) (type 0)))
  $ wasm2wat foo.wasm | grep '"foo"'
    (import "env" "foo" (func $foo (type 0)))

Here the import of the function `@foo` was correctly listed in the object file
as from the module "bar", but after running through LLD it was rewritten back
to "env"</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>