From 6926302eb36d25de35d57ebf1867e974b08188fa Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 12 Oct 2024 03:02:58 +0000 Subject: [PATCH 1/3] Fix fts build for shared library https://github.com/WebAssembly/wasi-libc/pull/522 did not include the necessary changes to the Makefile for libc_so build. --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 935b012b..e787087c 100644 --- a/Makefile +++ b/Makefile @@ -619,6 +619,7 @@ BULK_MEMORY_SO_OBJS = $(patsubst %.o,%.pic.o,$(BULK_MEMORY_OBJS)) DLMALLOC_SO_OBJS = $(patsubst %.o,%.pic.o,$(DLMALLOC_OBJS)) LIBC_BOTTOM_HALF_ALL_SO_OBJS = $(patsubst %.o,%.pic.o,$(LIBC_BOTTOM_HALF_ALL_OBJS)) LIBC_TOP_HALF_ALL_SO_OBJS = $(patsubst %.o,%.pic.o,$(LIBC_TOP_HALF_ALL_OBJS)) +FTS_SO_OBJS = $(patsubst %.o,%.pic.o,$(FTS_OBJS)) PIC_OBJS = \ $(LIBC_SO_OBJS) \ @@ -635,7 +636,8 @@ PIC_OBJS = \ $(DLMALLOC_SO_OBJS) \ $(LIBC_BOTTOM_HALF_ALL_SO_OBJS) \ $(LIBC_TOP_HALF_ALL_SO_OBJS) \ - $(LIBC_BOTTOM_HALF_CRT_OBJS) + $(LIBC_BOTTOM_HALF_CRT_OBJS) \ + $(FTS_SO_OBJS) # TODO: Specify SDK version, e.g. libc.so.wasi-sdk-21, as SO_NAME once `wasm-ld` # supports it. @@ -787,7 +789,7 @@ $(LIBC_TOP_HALF_ALL_OBJS) $(LIBC_TOP_HALF_ALL_SO_OBJS) $(MUSL_PRINTSCAN_LONG_DOU -Wno-dangling-else \ -Wno-unknown-pragmas -$(FTS_OBJS): CFLAGS += \ +$(FTS_OBJS) $(FTS_SO_OBJS): CFLAGS += \ -I$(MUSL_FTS_SRC_DIR) \ -I$(FTS_SRC_DIR) # for config.h From 45991a25c89237c4a7ce802c3ea2299fb7170323 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 12 Oct 2024 03:07:00 +0000 Subject: [PATCH 2/3] CI: Include `libc_so` in the build check --- .github/workflows/main.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bf503418..751dc0aa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,11 +23,13 @@ jobs: - os: ubuntu-latest clang_version: 16.0.0 llvm_asset_suffix: x86_64-linux-gnu-ubuntu-18.04 + enable_pic: true - os: macos-latest clang_version: 15.0.7 llvm_asset_suffix: x86_64-apple-darwin21.0 - os: windows-latest clang_version: 16.0.0 + enable_pic: true steps: - uses: actions/checkout@v4.1.7 with: @@ -88,12 +90,18 @@ jobs: echo "BUILD_LIBSETJMP=no" >> $GITHUB_ENV if: matrix.clang_version == '10.0.0' + - name: Enable PIC build for new LLVM + shell: bash + run: | + echo "MAKE_TARGETS=default libc_so" >> $GITHUB_ENV + if: matrix.enable_pic + - name: Build libc shell: bash run: | - make -j4 TARGET_TRIPLE=wasm32-wasi - make -j4 TARGET_TRIPLE=wasm32-wasip1 - make -j4 TARGET_TRIPLE=wasm32-wasip2 WASI_SNAPSHOT=p2 + make -j4 TARGET_TRIPLE=wasm32-wasi $MAKE_TARGETS + make -j4 TARGET_TRIPLE=wasm32-wasip1 $MAKE_TARGETS + make -j4 TARGET_TRIPLE=wasm32-wasip2 $MAKE_TARGETS - name: Build libc + threads # Only build the thread-capable wasi-libc in the latest supported Clang From 91e2119c202f94d02b00f8ea51ab0c967e9e99fa Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 15 Oct 2024 01:39:46 +0000 Subject: [PATCH 3/3] CI: Restore `WASI_SNAPSHOT=p2` for `wasm32-wasip2` target build --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 751dc0aa..afdff5f0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -101,7 +101,7 @@ jobs: run: | make -j4 TARGET_TRIPLE=wasm32-wasi $MAKE_TARGETS make -j4 TARGET_TRIPLE=wasm32-wasip1 $MAKE_TARGETS - make -j4 TARGET_TRIPLE=wasm32-wasip2 $MAKE_TARGETS + make -j4 TARGET_TRIPLE=wasm32-wasip2 WASI_SNAPSHOT=p2 $MAKE_TARGETS - name: Build libc + threads # Only build the thread-capable wasi-libc in the latest supported Clang