[llvm-bugs] [Bug 41610] New: Importing mutable global in WebAssembly

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 26 01:47:32 PDT 2019


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

            Bug ID: 41610
           Summary: Importing mutable global in WebAssembly
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mail at joachim-breitner.de
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

I am trying to create a shared webassembly library from C code, and compiling
the  C file with `-fpic` and linking with `--shared` looks promising.

I want to import a mutable global from the host environment. My first attempt
was to write

    extern int imported_global;

and that indeed causes

    (import "GOT.mem" "imported_global" (global $gimport$4 i32))

but it turns out that this imports not a global that it reads from and writes
to, but rather a global that it takes a memory address from.

(This is not completely surprising; after all I might want to take the address,
&imported_global).

Is there a way to import, read and write a WebAssembly global from C code?

-- 
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/20190426/9e79b56d/attachment.html>


More information about the llvm-bugs mailing list