summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArshia Ghafoori <arshia001@live.com>2023-08-24 10:26:06 +0400
committerArshia Ghafoori <arshia001@live.com>2023-08-24 10:26:06 +0400
commit5fe27df27ec6d87952ea65c26a03218934e74137 (patch)
tree94997995815391dc139273dd69f47e447affb73a
parent172431937dab4353559cd36828de375d0659577d (diff)
Add clang builtin symbols to libc.a
-rw-r--r--Makefile7
-rwxr-xr-xbuild32.sh2
-rw-r--r--tools/append-builtins/wasm32-wasi.mri5
3 files changed, 14 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index f976c10..0dc6624 100644
--- a/Makefile
+++ b/Makefile
@@ -515,6 +515,13 @@ wasix-headers:
cargo run --manifest-path tools/wasix-headers/Cargo.toml generate-libc
post-finish: finish
+ifeq ($(TARGET_TRIPLE), wasm32-wasi)
+ cd $(SYSROOT)/lib/$(TARGET_TRIPLE) && \
+ mv libc.a libc-old.a && \
+ $(AR) -M < ../../../tools/append-builtins/$(TARGET_TRIPLE).mri && \
+ rm libc-old.a
+endif
+
rm -f sysroot/lib/wasm32-wasi/libc-printscan-log-double.a
rsync -rtvu --delete ./sysroot/ ./sysroot32/
diff --git a/build32.sh b/build32.sh
index c83af62..af5f0b7 100755
--- a/build32.sh
+++ b/build32.sh
@@ -9,6 +9,8 @@ git reset --hard
git pull origin main || true
cd ../../..
+make clean
+
# Build the extensions
cargo run --manifest-path tools/wasix-headers/Cargo.toml generate-libc
cp -f libc-bottom-half/headers/public/wasi/api.h libc-bottom-half/headers/public/wasi/api_wasix.h
diff --git a/tools/append-builtins/wasm32-wasi.mri b/tools/append-builtins/wasm32-wasi.mri
new file mode 100644
index 0000000..dd2765f
--- /dev/null
+++ b/tools/append-builtins/wasm32-wasi.mri
@@ -0,0 +1,5 @@
+create libc.a
+addlib libc-old.a
+addlib ../../../libclang_rt.builtins-wasm32.a
+save
+end \ No newline at end of file