[llvm-bugs] [Bug 37168] New: LLD doesn't preserve import modules on wasm32-unknown-unknown-wasm

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 18 13:40:44 PDT 2018


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

            Bug ID: 37168
           Summary: LLD doesn't preserve import modules on
                    wasm32-unknown-unknown-wasm
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: alex at crichton.co
                CC: llvm-bugs at lists.llvm.org, sbc at chromium.org

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"

-- 
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/20180418/14c91055/attachment-0001.html>


More information about the llvm-bugs mailing list