[llvm-bugs] [Bug 44316] New: wasm32: Same symbol erroneously imported from the same module

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 16 13:50:17 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44316

            Bug ID: 44316
           Summary: wasm32: Same symbol erroneously imported from the same
                    module
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: wasm
          Assignee: unassignedbugs at nondot.org
          Reporter: alex at crichton.co
                CC: llvm-bugs at lists.llvm.org, sbc at chromium.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191216/6a378689/attachment.html>


More information about the llvm-bugs mailing list