Comments (8)
What version of wasi-sdk are you using?
The symbol exists at least in wasi-sdk-12 and wasi-sdk-11:
wasi-sdk-12.0 $ ./bin/llvm-nm ./lib/clang/11.0.0/lib/wasi/libclang_rt.builtins-wasm32.a | grep "T __multi3"
00000001 T __multi3
wasi-sdk-11.0 $ ./bin/llvm-nm ./lib/clang/10.0.0/lib/wasi/libclang_rt.builtins-wasm32.a | grep "T __multi3"
00000001 T __multi3
Perhaps somehow libclang_rt.builtins-wasm32.a
is now being linked it? (what is the full linker command can clang is generating? you can use -v
with clang to show the full linker command).
from wasi-libc.
Problem solved. I missed the -lclang_rt.builtins-wasm32
linker flag. Thanks for the hint about libclang_rt.builtins-wasm32.a
!
from wasi-libc.
@sbc100, @sunfishcode, the related pull request #99 only affects the following symbols, but not __multi3
as the issue title says.
__muldc3
__muloti4
__mulsc3
__multc3
__multf3
Since I do indeed see an undefined __multi3
symbol when compiling some C source with https://github.com/llvm/llvm-project/tree/d28af7c654d8db0b68c175db5ce212d74fb5e9bc and wasi-libc
revision 659ff41 (tied together in https://github.com/WebAssembly/wasi-sdk/tree/a927856376271224d30c5d7732c00a0b359eaa45), I wonder how this can be fixed?
from wasi-libc.
#99 will cause the wasi-libc checking code to ignore all undefined symbols that start with __mul
.. (including __multi3
) when performing its check
phase.
What problem are you seeing exactly? Are you seeing the build of wasi-libc fail the check
phase? Or are you seeing linker failure due to missing __multi3
symbol? (if you are seeing the latter then that suggests a different issue, perhaps an out-of-date compiler-rt library?)
from wasi-libc.
I am seeing a linker failure due to an undefined __multi3
symbol coming out of the compilation of a medium-sized C code-base. Supplying --unresolved-symbols=import-functions
to wasm-ld
allows the linking to succeed, but this is just deferring the problem to the runtime.
I am plainly using wasi-sdk
and am doing nothing special. Maybe a recompilation of wasi-sdk
will help, but I doubt it.
from wasi-libc.
I am using the latest wasi-sdk, a927856376271224d30c5d7732c00a0b359eaa45
, which pulls in via git submodules:
8af7c654d8db0b68c175db5ce212d74fb5e9bc src/llvm-project (llvmorg-12.0.0)
659ff414560721b1660a19685110e484a081c3d4 src/wasi-libc (heads/main)
It indeed finds __multi3
:
./bin/llvm-nm ./lib/clang/12.0.0/lib/wasi/libclang_rt.builtins-wasm32.a | grep "T __multi3"
00000001 T __multi3
Running make check
in wasi-sdk
is successful (return value 0).
I compile and link separately. Compiling:
../wasi-sdk/build/install/opt/wasi-sdk/bin/clang -c -o file.bc file.c --sysroot ../wasi-sdk/build/install/opt/wasi-sdk/share/wasi-sysroot
Linking:
../wasi-sdk/build/install/opt/wasi-sdk/bin/wasm-ld --no-entry --export-dynamic --unresolved-symbols=import-functions -L ../wasi-sdk/build/install/opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi -lc --import-memory -o app.wasm file1.bc file2.bc etc.
Maybe I'm missing to link some additional library?
from wasi-libc.
I recommend using clang to drive your link step to avoid such problems and future proof your build against toolchain changes.
from wasi-libc.
I also recommend against using the .bc
extension for your object files. That is probably old artifact of a older version of emscripten.. and I'm trying to move folks away from using that since it can lead to confusion.
from wasi-libc.
Related Issues (20)
- `errno` is broken on `wasm32-wasi-threads` HOT 15
- undefined symbol: alarm (and maybe dup) HOT 2
- Please tag wasi-sdk-21 HOT 2
- is there any plan to support mqueue/rwlock api? HOT 1
- Support sigaction (for LLVM) HOT 1
- how does preview2 deal with wasm64? HOT 2
- locking issues in chdir.c
- O_RESOLVE_BENEATH is forced HOT 4
- both `/` and `.` preopens "normlaize" to empty string meaning it is not possible to preopen root and current dir simultaneously HOT 6
- main in a library regression HOT 2
- Enhancement request: interface to get the wasi-libc version at runtime HOT 2
- Support `mprotect` in wasi-emulated-mman HOT 6
- Consider including a pthread.h for all targets HOT 5
- httpclient module for API request HOT 1
- Dereferencing nullptr in __sec_to_zone function HOT 2
- wasi-libc should probably not define `_POSIX_CPUTIME` and `_POSIX_THREAD_CPUTIME`...
- Command line length limits are easily exceeded on Windows HOT 1
- Keep/separate out a list of symbols that are only stubs
- sysroot for wasm64
- FTS Support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasi-libc.