Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol errno; recompile with -fPIC #209

Closed
ApsarasX opened this issue Nov 25, 2021 · 2 comments

Comments

@ApsarasX
Copy link

I'm linking some object files(compiled with -fPIC) into a shared library using wasm-ld and wasi-sdk, but I get errors like the following

/opt/emsdk/upstream/bin/wasm-ld --shared -L/opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi -lc --no-entry --allow-undefined --export=eval --export=__wasm_call_ctors --lto-O2 -o build/quickjs.wasm .obj/wasm.o .obj/cutils.o .obj/libbf.o .obj/libregexp.o .obj/libunicode.o .obj/quickjs.o
wasm-ld: warning: creating shared libraries, with -shared, is not yet stable
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(close.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol errno; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(writev.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol errno; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(writev.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol errno; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(isatty.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol errno; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(__stdout_write.o): relocation R_WASM_TABLE_INDEX_SLEB cannot be used against symbol __stdio_write; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(lseek.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol errno; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(strerror.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol __libc; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(strerror.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol __libc; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(strerror.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol __libc; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(strerror.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol __libc; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(strerror.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol errmsgidx; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(strerror.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol errmsgstr; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(wcrtomb.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol __libc; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(wcrtomb.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol errno; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(wcrtomb.o): relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol errno; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(vfprintf.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol states; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(vfprintf.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(vfprintf.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(vfprintf.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol xdigits; recompile with -fPIC
wasm-ld: error: /opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi/libc.a(vfprintf.o): relocation R_WASM_MEMORY_ADDR_SLEB cannot be used against symbol .L.str; recompile with -fPIC
@sunfishcode
Copy link
Member

Upstream LLVM does not yet support the -shared flag.

@abrown
Copy link
Collaborator

abrown commented Aug 22, 2023

You may be interested in #338? Let's close this issue in favor of that PR.

@abrown abrown closed this as completed Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants