[llvm-bugs] [Bug 43393] New: wasm-ld: error: test.o: relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol version_getter; recompile with -fPIC

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 21 03:18:14 PDT 2019


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

            Bug ID: 43393
           Summary: wasm-ld: error: test.o: relocation
                    R_WASM_MEMORY_ADDR_LEB cannot be used against symbol
                    version_getter; recompile with -fPIC
           Product: new-bugs
           Version: 9.0
          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

This used to work at revision 358327, but seems to have stopped working with
the 9 release. Consider the file (test.c:

int get_version() { return 0; }
int (*version_getter)() = &get_version;
__attribute__ ((visibility("default"))) int version() { return
(*version_getter)(); }

Compiling this with

clang-9 --compile -fpic -fvisibility=hidden
--target=wasm32-unknown-unknown-wasm -fno-builtin -ffreestanding test.c -o
test.o
wasm-ld -o test.wasm --import-memory --shared --no-entry --gc-sections
--export=__wasm_call_ctors test.o

yields

wasm-ld: error: test.o: relocation R_WASM_MEMORY_ADDR_LEB cannot be used
against symbol version_getter; recompile with -fPIC

But note that I am compiling it with -fPIC (and it used to work).

-- 
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/20190921/2ddbcd82/attachment-0001.html>


More information about the llvm-bugs mailing list