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
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