@ai-ecoverse/wasm-clang
v24.0.0-10
Published
Clang/LLD 24 for slicc (clang24 EH; asyncify via wasm-binaryen)
Downloads
1,022
Readme
@ai-ecoverse/wasm-clang
Clang/LLD 24 for the slicc wasm realm. Relinked with current libslicc
(Module.sliccKernel spawn) + ENVIRONMENT=web,worker,node.
Companions:
@ai-ecoverse/wasix-sysroot(WASIXCC_SYSROOT_PREFIX)@ai-ecoverse/wasm-binaryen(wasm-optfor fork Asyncify — onPATH)
Drivers
cc / gcc / c++ / g++ / wasixcc / wasix++ are #!/bin/sh scripts
(slicc.commands { "script": "bin/…" }). Use them as the normal compilers —
no extra WASI/EH flags needed for typical builds.
- Target:
--target=wasm32-wasip1(sysroot ships a reallib/wasm32-wasip1). - C++ links
-lc++ -lc++abi -lunwind(exnref exceptions, threads, iostream). - Output is a WASI program SLICC runs directly (no separate host wrapper).
- Executable link that imports
proc_fork/stack_checkpointrunswasm-opt --asyncify(from@ai-ecoverse/wasm-binaryen) automatically so fork works on the SLICC host. Plain programs skip asyncify. -shared: side module,-nostdlib(no libc) — resolve symbols against a PIE main that exports them.- PIE / dlopen main:
cc -rdynamic …orcc -fPIC foo.c -o foo(no-shared) →-pie --export-all, libc whole-archive, tag stubs. Thendlopen("./libsq.so")works. - CMake:
CC=cc CXX=c++ cmake …— Clang 24 is identified;pthread.hand the sysroot resolve under SLICC.
One module for every tool
bin/llvm.wasm holds clang, lld, llvm-ar, llvm-nm, llvm-objcopy and
llvm-symbolizer, linked together so they share one copy of LLVM; the tool is
chosen by its name (argv[0]), or llvm <tool> args…. bin/ ships a glue
file under every name emcc constructs under LLVM_ROOT (clang,
clang++, lld, wasm-ld, ld.lld, llvm-ar, llvm-ranlib, llvm-nm,
llvm-objcopy, llvm-strip, llvm-symbolizer): each is a byte-copy of
bin/llvm, which locates llvm.wasm beside it. slicc.commands covers the
same names plus ar, ranlib, nm, strip for PATH lookups.
Not shipped (emcc only needs these for -g / split-dwarf / coverage /
emsize / sourcemap demangle): llvm-dwarfdump, llvm-dwp,
clang-scan-deps, llvm-profdata, llvm-cov, llvm-size, llvm-cxxfilt.
cc hello.c -o hello
cc -fPIC -shared sq.c -o libsq.so
cc -rdynamic -fPIC dl.c -o dl # PIE main exporting libc for dlopen
c++ -O2 t.cpp -o t # iostream + exceptions + threads
CC=cc CXX=c++ cmake -S . -B build
cmake --build build