<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: Same symbol erroneously imported from the same module"
   href="https://bugs.llvm.org/show_bug.cgi?id=44316">44316</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>wasm32: Same symbol erroneously imported from the same module
          </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>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>wasm
          </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>I believe I've run into a case where:

* The same symbol is imported defined in two codegen units
* Each codegen unit imports the symbol from a different wasm module
* When linked, the symbols get coalesced to being imported from the same wasm
module



For example if you have a.c as:


void foo(void)
  __attribute__((__import_module__("a")));

void a(void) {
  foo();
}




and you have b.c as 




void foo(void)
  __attribute__((__import_module__("b")));

void b(void) {
  foo();
}




and you have c.c as:




void a(void);
void b(void);

void start(void) {
  a();
  b();
}




then when compiled and linked you get:


     $ clang --target=wasm32-unknown-unknown -c a.c
     $ clang --target=wasm32-unknown-unknown -c b.c
     $ clang --target=wasm32-unknown-unknown -c c.c
     $ wasm-ld a.o b.o c.o -o foo.wasm --no-entry --export start
--allow-undefined
     $ wasm2wat foo.wasm | grep import
       (import "a" "foo" (func $foo (type 0)))


I would expect, though, that the name `foo` should be imported from both the
"a" module and the "b" module.</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>