From 90b494294cd0b5a2c81cc8e7502fde7dee8f03e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Thu, 14 Sep 2023 15:22:27 +0200 Subject: [PATCH 01/19] Expand README --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 578c0dc..d2f9bde 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,15 @@ Standard C library implementation for WebAssembly System Interface. -## Quick How-to use +## Quick How-to ``` -$ clang --target=wasm32-wasi ... +$ clang --target=wasm32-wasi --sysroot=/usr/wasm32-wasi -nodefaultlibs -lc -o hello hello.c ``` + +Important flags: + +* `--target=wasm32-wasi` specifies the compilation architecture (WASM System Interface). +* `--sysroot=/usr/wasm32-wasi` tells clang where the library files are. +* `-nodefaultlibs` disables linking of libc and libcompiler-rt (the latter is not available). +* `-lc` re-enables linking of libc. From ac6e5fb1d0484087365e218f4c955ca2ed90572e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 10 Jan 2024 16:08:12 -0800 Subject: [PATCH 02/19] Upgrade to tag wasi-sdk-21 --- .gitignore | 1 + ...-don-t-rebuild-files-on-make-install.patch | 41 +++++++++++-------- ...fno-strict-aliasing-for-emmalloc-424.patch | 29 ------------- ...use-__heap_end-instead-of-sbrk-0-462.patch | 41 +++++++++++++++++++ ...for-LLVM-trunk-17-as-of-2023-06-18-4.patch | 37 ----------------- sources | 2 +- wasi-libc.spec | 11 ++--- 7 files changed, 72 insertions(+), 90 deletions(-) delete mode 100644 0002-Use-fno-strict-aliasing-for-emmalloc-424.patch create mode 100644 0002-emmalloc-use-__heap_end-instead-of-sbrk-0-462.patch delete mode 100644 0003-Adjust-Makefile-for-LLVM-trunk-17-as-of-2023-06-18-4.patch diff --git a/.gitignore b/.gitignore index efd6729..aedf961 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /wasi-libc-wasi-sdk-20.tar.gz +/wasi-libc-wasi-sdk-21.tar.gz diff --git a/0001-make-don-t-rebuild-files-on-make-install.patch b/0001-make-don-t-rebuild-files-on-make-install.patch index 527a863..83448ba 100644 --- a/0001-make-don-t-rebuild-files-on-make-install.patch +++ b/0001-make-don-t-rebuild-files-on-make-install.patch @@ -1,7 +1,7 @@ -From 112b521d2f64f8e812e6f40d7cde46e47d704f3a Mon Sep 17 00:00:00 2001 +From b94086f284cc68091e056141be5db873953403a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Mon, 29 Aug 2022 15:07:34 +0200 -Subject: [PATCH 1/3] make: don't rebuild files on `make install` +Subject: [PATCH 1/2] make: don't rebuild files on `make install` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -18,14 +18,14 @@ Adapted from [Debian patch][]. Signed-off-by: Jan Staněk Signed-off-by: rpm-build --- - Makefile | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) + Makefile | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile -index f350ecb..9ef000b 100644 +index 16d7ed6000e0..23e6259ce355 100644 --- a/Makefile +++ b/Makefile -@@ -583,6 +583,9 @@ include_dirs: +@@ -655,6 +655,9 @@ include_dirs: # Remove selected header files. $(RM) $(patsubst %,$(SYSROOT_INC)/%,$(MUSL_OMIT_HEADERS)) @@ -35,26 +35,35 @@ index f350ecb..9ef000b 100644 startup_files: include_dirs $(LIBC_BOTTOM_HALF_CRT_OBJS) # # Install the startup files (crt1.o etc). -@@ -590,6 +593,9 @@ startup_files: include_dirs $(LIBC_BOTTOM_HALF_CRT_OBJS) +@@ -662,6 +665,9 @@ startup_files: include_dirs $(LIBC_BOTTOM_HALF_CRT_OBJS) mkdir -p "$(SYSROOT_LIB)" && \ cp $(LIBC_BOTTOM_HALF_CRT_OBJS) "$(SYSROOT_LIB)" + # Mark this rule finished ++ touch $@ ++ + # TODO: As of this writing, wasi_thread_start.s uses non-position-independent + # code, and I'm not sure how to make it position-independent. Once we've done + # that, we can enable libc.so for the wasi-threads build. +@@ -677,6 +683,8 @@ endif + + libc_so: include_dirs $(LIBC_SO) + + touch $@ + libc: include_dirs \ $(SYSROOT_LIB)/libc.a \ $(SYSROOT_LIB)/libc-printscan-long-double.a \ -@@ -599,6 +605,8 @@ libc: include_dirs \ - $(SYSROOT_LIB)/libwasi-emulated-getpid.a \ - $(SYSROOT_LIB)/libwasi-emulated-signal.a +@@ -687,6 +695,8 @@ libc: include_dirs \ + $(SYSROOT_LIB)/libwasi-emulated-signal.a \ + $(SYSROOT_LIB)/libdl.a + touch $@ + finish: startup_files libc # # Create empty placeholder libraries. -@@ -611,6 +619,8 @@ finish: startup_files libc +@@ -699,6 +709,8 @@ finish: startup_files libc # The build succeeded! The generated sysroot is in $(SYSROOT). # @@ -63,14 +72,14 @@ index f350ecb..9ef000b 100644 # The check for defined and undefined symbols expects there to be a heap # alloctor (providing malloc, calloc, free, etc). Skip this step if the build # is done without a malloc implementation. -@@ -715,5 +725,6 @@ install: finish +@@ -813,5 +825,6 @@ install: finish clean: $(RM) -r "$(OBJDIR)" $(RM) -r "$(SYSROOT)" -+ $(RM) include_dirs startup_files libc finish ++ $(RM) include_dirs startup_files libc_so libc finish --.PHONY: default startup_files libc finish install include_dirs clean -+.PHONY: default install clean +-.PHONY: default startup_files libc libc_so finish install include_dirs clean check-symbols ++.PHONY: default install clean check-symbols -- -2.41.0 +2.43.0 diff --git a/0002-Use-fno-strict-aliasing-for-emmalloc-424.patch b/0002-Use-fno-strict-aliasing-for-emmalloc-424.patch deleted file mode 100644 index 0c4a649..0000000 --- a/0002-Use-fno-strict-aliasing-for-emmalloc-424.patch +++ /dev/null @@ -1,29 +0,0 @@ -From bac6be2aaa57cb26daddaac241151f8d43555228 Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Fri, 23 Jun 2023 13:24:52 -0700 -Subject: [PATCH 2/3] Use -fno-strict-aliasing for emmalloc (#424) - -Signed-off-by: rpm-build ---- - Makefile | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/Makefile b/Makefile -index 9ef000b..c42f68e 100644 ---- a/Makefile -+++ b/Makefile -@@ -560,6 +560,11 @@ $(LIBC_TOP_HALF_ALL_OBJS) $(MUSL_PRINTSCAN_LONG_DOUBLE_OBJS) $(MUSL_PRINTSCAN_NO - $(LIBWASI_EMULATED_PROCESS_CLOCKS_OBJS): CFLAGS += \ - -I$(LIBC_BOTTOM_HALF_CLOUDLIBC_SRC) - -+# emmalloc uses a lot of pointer type-punning, which is UB under strict aliasing, -+# and this was found to have real miscompilations in wasi-libc#421. -+$(EMMALLOC_OBJS): CFLAGS += \ -+ -fno-strict-aliasing -+ - include_dirs: - # - # Install the include files. --- -2.41.0 - diff --git a/0002-emmalloc-use-__heap_end-instead-of-sbrk-0-462.patch b/0002-emmalloc-use-__heap_end-instead-of-sbrk-0-462.patch new file mode 100644 index 0000000..2f994ff --- /dev/null +++ b/0002-emmalloc-use-__heap_end-instead-of-sbrk-0-462.patch @@ -0,0 +1,41 @@ +From 4922cc7be17a2570799d1f3724d27b3e3305352a Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Wed, 10 Jan 2024 13:31:37 -0800 +Subject: [PATCH 2/2] emmalloc: use __heap_end instead of sbrk(0) (#462) + +--- + emmalloc/emmalloc.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/emmalloc/emmalloc.c b/emmalloc/emmalloc.c +index c98e42eb89bb..e97ef44dc058 100644 +--- a/emmalloc/emmalloc.c ++++ b/emmalloc/emmalloc.c +@@ -56,6 +56,7 @@ + + // Defind by the linker to have the address of the start of the heap. + extern unsigned char __heap_base; ++extern unsigned char __heap_end; + + // Behavior of right shifting a signed integer is compiler implementation defined. + static_assert((((int32_t)0x80000000U) >> 31) == -1, "This malloc implementation requires that right-shifting a signed integer produces a sign-extending (arithmetic) shift!"); +@@ -545,9 +546,13 @@ static bool claim_more_memory(size_t numBytes) + // If this is the first time we're called, see if we can use + // the initial heap memory set up by wasm-ld. + if (!listOfAllRegions) { +- unsigned char *heap_end = sbrk(0); +- if (numBytes <= (size_t)(heap_end - &__heap_base)) { +- startPtr = &__heap_base; ++ unsigned char *heap_base = &__heap_base; ++ unsigned char *heap_end = &__heap_end; ++ if (heap_end < heap_base) { ++ __builtin_trap(); ++ } ++ if (numBytes <= (size_t)(heap_end - heap_base)) { ++ startPtr = heap_base; + endPtr = heap_end; + break; + } +-- +2.43.0 + diff --git a/0003-Adjust-Makefile-for-LLVM-trunk-17-as-of-2023-06-18-4.patch b/0003-Adjust-Makefile-for-LLVM-trunk-17-as-of-2023-06-18-4.patch deleted file mode 100644 index 046f1b0..0000000 --- a/0003-Adjust-Makefile-for-LLVM-trunk-17-as-of-2023-06-18-4.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 8951be3fed5a9723db262e08aa1be708213ae9b5 Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Wed, 21 Jun 2023 02:47:19 +0900 -Subject: [PATCH 3/3] Adjust Makefile for LLVM trunk (17) as of 2023-06-18 - (#422) - -https://github.com/llvm/llvm-project/commit/7dd387d2971d7759cadfffeb2082439f6c7ddd49 -added a bunch of __FPCLASS_* macros. - -Signed-off-by: rpm-build ---- - Makefile | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/Makefile b/Makefile -index c42f68e..705ab89 100644 ---- a/Makefile -+++ b/Makefile -@@ -686,6 +686,7 @@ check-symbols: startup_files libc - @# - @# TODO: Filter out __NO_MATH_ERRNO_ and a few __*WIDTH__ that are new to clang 14. - @# TODO: Filter out __GCC_HAVE_SYNC_COMPARE_AND_SWAP_* that are new to clang 16. -+ @# TODO: Filter out __FPCLASS_* that are new to clang 17. - @# TODO: clang defined __FLT_EVAL_METHOD__ until clang 15, so we force-undefine it - @# for older versions. - @# TODO: Undefine __wasm_mutable_globals__ and __wasm_sign_ext__, that are new to -@@ -717,6 +718,7 @@ check-symbols: startup_files libc - | sed -e 's/__GNUC_VA_LIST $$/__GNUC_VA_LIST 1/' \ - | grep -v '^#define __\(BOOL\|INT_\(LEAST\|FAST\)\(8\|16\|32\|64\)\|INT\|LONG\|LLONG\|SHRT\)_WIDTH__' \ - | grep -v '^#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_\(1\|2\|4\|8\)' \ -+ | grep -v '^#define __FPCLASS_' \ - > "$(SYSROOT_SHARE)/predefined-macros.txt" - - # Check that the computed metadata matches the expected metadata. --- -2.41.0 - diff --git a/sources b/sources index 1bf53d6..c5f09fa 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (wasi-libc-wasi-sdk-20.tar.gz) = e264240dc7dbcf6398c8ca09bc108298f4a8aa955af22de5a3015fbcde81cb09dd83cd48349090082d5de0e8a3dbcf746c7b14657c67657b3f2f1ab28bb9cf05 +SHA512 (wasi-libc-wasi-sdk-21.tar.gz) = 3e46dde27730fba72f190c7a9871b3017b7733cd6d71984ed7fba936a3c8a19c49e75cd5c32904d570b812b31ea313ce92d1aac7aa686114a0a12e6b8dbb4f85 diff --git a/wasi-libc.spec b/wasi-libc.spec index b64ea49..9f456db 100644 --- a/wasi-libc.spec +++ b/wasi-libc.spec @@ -1,6 +1,6 @@ Name: wasi-libc Summary: C library implementation for WebAssembly System Interface -Version: 20 +Version: 21 Release: %autorelease License: Apache-2.0 WITH LLVM-exception AND Apache-2.0 AND MIT AND BSD-2-Clause @@ -11,12 +11,9 @@ Source1: smoke-test.c # Allow using artifacts from %%build in %%install instead of recompiling Patch: 0001-make-don-t-rebuild-files-on-make-install.patch -# emmalloc uses a lot of pointer type-punning, which is UB under strict aliasing. -# https://github.com/WebAssembly/wasi-libc/pull/424 -Patch: 0002-Use-fno-strict-aliasing-for-emmalloc-424.patch - -# New constants in clang 17 that should not be checked -Patch: 0003-Adjust-Makefile-for-LLVM-trunk-17-as-of-2023-06-18-4.patch +# emmalloc: use __heap_end instead of sbrk(0) +# https://github.com/WebAssembly/wasi-libc/pull/462 +Patch: 0002-emmalloc-use-__heap_end-instead-of-sbrk-0-462.patch # This contains parts of the musl C library; specify as bundled so we get notified about potential vulnerabilities %global musl_version 1.2.3 From faf7fce1e63a289bac422a607d4d93591f8cba3e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 27 Jan 2024 08:23:48 +0000 Subject: [PATCH 03/19] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 8556bbb0c75eec6b39003ebaca2c296dd0d78b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Mon, 6 May 2024 15:52:39 +0200 Subject: [PATCH 04/19] Upgrade to tag wasi-sdk-22 (rhbz#2278786) --- .gitignore | 1 + ...-don-t-rebuild-files-on-make-install.patch | 48 +++++++++---------- ...use-__heap_end-instead-of-sbrk-0-462.patch | 41 ---------------- sources | 2 +- wasi-libc.spec | 6 +-- 5 files changed, 26 insertions(+), 72 deletions(-) delete mode 100644 0002-emmalloc-use-__heap_end-instead-of-sbrk-0-462.patch diff --git a/.gitignore b/.gitignore index aedf961..2b2e21d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /wasi-libc-wasi-sdk-20.tar.gz /wasi-libc-wasi-sdk-21.tar.gz +/wasi-libc-wasi-sdk-22.tar.gz diff --git a/0001-make-don-t-rebuild-files-on-make-install.patch b/0001-make-don-t-rebuild-files-on-make-install.patch index 83448ba..92fa6c2 100644 --- a/0001-make-don-t-rebuild-files-on-make-install.patch +++ b/0001-make-don-t-rebuild-files-on-make-install.patch @@ -1,7 +1,7 @@ -From b94086f284cc68091e056141be5db873953403a1 Mon Sep 17 00:00:00 2001 +From bbbeca0fe770b7014eb16e9e88d8d1ca85f6adeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Mon, 29 Aug 2022 15:07:34 +0200 -Subject: [PATCH 1/2] make: don't rebuild files on `make install` +Subject: [PATCH] make: don't rebuild files on `make install` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -18,16 +18,16 @@ Adapted from [Debian patch][]. Signed-off-by: Jan Staněk Signed-off-by: rpm-build --- - Makefile | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) + Makefile | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile -index 16d7ed6000e0..23e6259ce355 100644 +index 2f9e9fd..e83ca57 100644 --- a/Makefile +++ b/Makefile -@@ -655,6 +655,9 @@ include_dirs: - # Remove selected header files. - $(RM) $(patsubst %,$(SYSROOT_INC)/%,$(MUSL_OMIT_HEADERS)) +@@ -743,6 +743,9 @@ ifeq ($(WASI_SNAPSHOT), p2) + > "$(SYSROOT_INC)/__wasi_snapshot.h" + endif + # Mark this rule as done + touch $@ @@ -35,7 +35,7 @@ index 16d7ed6000e0..23e6259ce355 100644 startup_files: include_dirs $(LIBC_BOTTOM_HALF_CRT_OBJS) # # Install the startup files (crt1.o etc). -@@ -662,6 +665,9 @@ startup_files: include_dirs $(LIBC_BOTTOM_HALF_CRT_OBJS) +@@ -750,6 +753,9 @@ startup_files: include_dirs $(LIBC_BOTTOM_HALF_CRT_OBJS) mkdir -p "$(SYSROOT_LIB)" && \ cp $(LIBC_BOTTOM_HALF_CRT_OBJS) "$(SYSROOT_LIB)" @@ -45,25 +45,23 @@ index 16d7ed6000e0..23e6259ce355 100644 # TODO: As of this writing, wasi_thread_start.s uses non-position-independent # code, and I'm not sure how to make it position-independent. Once we've done # that, we can enable libc.so for the wasi-threads build. -@@ -677,6 +683,8 @@ endif +@@ -768,6 +774,7 @@ endif + endif libc_so: include_dirs $(LIBC_SO) - + touch $@ -+ - libc: include_dirs \ + + STATIC_LIBS = \ $(SYSROOT_LIB)/libc.a \ - $(SYSROOT_LIB)/libc-printscan-long-double.a \ -@@ -687,6 +695,8 @@ libc: include_dirs \ - $(SYSROOT_LIB)/libwasi-emulated-signal.a \ - $(SYSROOT_LIB)/libdl.a +@@ -784,6 +791,7 @@ STATIC_LIBS += \ + endif + libc: include_dirs $(STATIC_LIBS) + touch $@ -+ + finish: startup_files libc # - # Create empty placeholder libraries. -@@ -699,6 +709,8 @@ finish: startup_files libc +@@ -797,6 +805,8 @@ finish: startup_files libc # The build succeeded! The generated sysroot is in $(SYSROOT). # @@ -72,14 +70,14 @@ index 16d7ed6000e0..23e6259ce355 100644 # The check for defined and undefined symbols expects there to be a heap # alloctor (providing malloc, calloc, free, etc). Skip this step if the build # is done without a malloc implementation. -@@ -813,5 +825,6 @@ install: finish - clean: +@@ -982,5 +992,6 @@ clean: + $(RM) -r "$(BINDING_WORK_DIR)" $(RM) -r "$(OBJDIR)" $(RM) -r "$(SYSROOT)" + $(RM) include_dirs startup_files libc_so libc finish --.PHONY: default startup_files libc libc_so finish install include_dirs clean check-symbols -+.PHONY: default install clean check-symbols +-.PHONY: default startup_files libc libc_so finish install include_dirs clean check-symbols bindings ++.PHONY: default install clean check-symbols bindings -- -2.43.0 +2.45.0 diff --git a/0002-emmalloc-use-__heap_end-instead-of-sbrk-0-462.patch b/0002-emmalloc-use-__heap_end-instead-of-sbrk-0-462.patch deleted file mode 100644 index 2f994ff..0000000 --- a/0002-emmalloc-use-__heap_end-instead-of-sbrk-0-462.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 4922cc7be17a2570799d1f3724d27b3e3305352a Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Wed, 10 Jan 2024 13:31:37 -0800 -Subject: [PATCH 2/2] emmalloc: use __heap_end instead of sbrk(0) (#462) - ---- - emmalloc/emmalloc.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/emmalloc/emmalloc.c b/emmalloc/emmalloc.c -index c98e42eb89bb..e97ef44dc058 100644 ---- a/emmalloc/emmalloc.c -+++ b/emmalloc/emmalloc.c -@@ -56,6 +56,7 @@ - - // Defind by the linker to have the address of the start of the heap. - extern unsigned char __heap_base; -+extern unsigned char __heap_end; - - // Behavior of right shifting a signed integer is compiler implementation defined. - static_assert((((int32_t)0x80000000U) >> 31) == -1, "This malloc implementation requires that right-shifting a signed integer produces a sign-extending (arithmetic) shift!"); -@@ -545,9 +546,13 @@ static bool claim_more_memory(size_t numBytes) - // If this is the first time we're called, see if we can use - // the initial heap memory set up by wasm-ld. - if (!listOfAllRegions) { -- unsigned char *heap_end = sbrk(0); -- if (numBytes <= (size_t)(heap_end - &__heap_base)) { -- startPtr = &__heap_base; -+ unsigned char *heap_base = &__heap_base; -+ unsigned char *heap_end = &__heap_end; -+ if (heap_end < heap_base) { -+ __builtin_trap(); -+ } -+ if (numBytes <= (size_t)(heap_end - heap_base)) { -+ startPtr = heap_base; - endPtr = heap_end; - break; - } --- -2.43.0 - diff --git a/sources b/sources index c5f09fa..9b4ec90 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (wasi-libc-wasi-sdk-21.tar.gz) = 3e46dde27730fba72f190c7a9871b3017b7733cd6d71984ed7fba936a3c8a19c49e75cd5c32904d570b812b31ea313ce92d1aac7aa686114a0a12e6b8dbb4f85 +SHA512 (wasi-libc-wasi-sdk-22.tar.gz) = 3fcd5d6c0e09d824702165d8f1236e400b1d5e95fad14f1821d40de05340a044f0ec8a587d8478854252cc938a663aa9f854e6a5e683ef8f8349c60dc6c628ed diff --git a/wasi-libc.spec b/wasi-libc.spec index 9f456db..a546467 100644 --- a/wasi-libc.spec +++ b/wasi-libc.spec @@ -1,6 +1,6 @@ Name: wasi-libc Summary: C library implementation for WebAssembly System Interface -Version: 21 +Version: 22 Release: %autorelease License: Apache-2.0 WITH LLVM-exception AND Apache-2.0 AND MIT AND BSD-2-Clause @@ -11,10 +11,6 @@ Source1: smoke-test.c # Allow using artifacts from %%build in %%install instead of recompiling Patch: 0001-make-don-t-rebuild-files-on-make-install.patch -# emmalloc: use __heap_end instead of sbrk(0) -# https://github.com/WebAssembly/wasi-libc/pull/462 -Patch: 0002-emmalloc-use-__heap_end-instead-of-sbrk-0-462.patch - # This contains parts of the musl C library; specify as bundled so we get notified about potential vulnerabilities %global musl_version 1.2.3 From 9e5709384b6530ac7457304ffbf49988d23772ab Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 20 Jul 2024 09:07:52 +0000 Subject: [PATCH 05/19] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From 15bcecb2bf1b598b4968506772e637cef6bf79c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Thu, 10 Oct 2024 13:52:59 +0200 Subject: [PATCH 06/19] Update checks for LLVM 19 --- ...-don-t-rebuild-files-on-make-install.patch | 4 +- 0002-Adjust-Makefile-for-LLVM-19.patch | 73 +++++++++++++++++++ wasi-libc.spec | 3 + 3 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 0002-Adjust-Makefile-for-LLVM-19.patch diff --git a/0001-make-don-t-rebuild-files-on-make-install.patch b/0001-make-don-t-rebuild-files-on-make-install.patch index 92fa6c2..7bbbe0c 100644 --- a/0001-make-don-t-rebuild-files-on-make-install.patch +++ b/0001-make-don-t-rebuild-files-on-make-install.patch @@ -1,4 +1,4 @@ -From bbbeca0fe770b7014eb16e9e88d8d1ca85f6adeb Mon Sep 17 00:00:00 2001 +From 5585b1bf7a0d3c250e2e2a15e36d29637c3276d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Mon, 29 Aug 2022 15:07:34 +0200 Subject: [PATCH] make: don't rebuild files on `make install` @@ -79,5 +79,5 @@ index 2f9e9fd..e83ca57 100644 -.PHONY: default startup_files libc libc_so finish install include_dirs clean check-symbols bindings +.PHONY: default install clean check-symbols bindings -- -2.45.0 +2.47.0 diff --git a/0002-Adjust-Makefile-for-LLVM-19.patch b/0002-Adjust-Makefile-for-LLVM-19.patch new file mode 100644 index 0000000..5d1163b --- /dev/null +++ b/0002-Adjust-Makefile-for-LLVM-19.patch @@ -0,0 +1,73 @@ +From 9c192c4f094ab86480de85b7b5948419be1044d0 Mon Sep 17 00:00:00 2001 +From: Mike Hommey +Date: Tue, 30 Apr 2024 06:46:03 +0900 +Subject: [PATCH] Adjust Makefile for LLVM 19 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- Added __GCC_(CON|DE)STRUCTIVE_SIZE macros. +- Added __wasm_multivalue__ and __wasm_reference_types__, and the latter + also makes libraries reference the undefined __indirect_function_table + symbol, which is provided by the linker. + +Latest integrated upstream commit: d43dcc63d26013264bb58241e53bde9318349443 +https://github.com/WebAssembly/wasi-libc/commit/d43dcc63d26013264bb58241e53bde9318349443 + +Signed-off-by: Jan Staněk +Signed-off-by: rpm-build +--- + Makefile | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index e83ca57..e3b4804 100644 +--- a/Makefile ++++ b/Makefile +@@ -846,7 +846,7 @@ check-symbols: startup_files libc + for undef_sym in $$("$(NM)" --undefined-only "$(SYSROOT_LIB)"/libc.a "$(SYSROOT_LIB)"/libc-*.a "$(SYSROOT_LIB)"/*.o \ + |grep ' U ' |sed 's/.* U //' |LC_ALL=C sort |uniq); do \ + grep -q '\<'$$undef_sym'\>' "$(DEFINED_SYMBOLS)" || echo $$undef_sym; \ +- done | grep -E -v "^__mul|__memory_base" > "$(UNDEFINED_SYMBOLS)" ++ done | grep -E -v "^__mul|__memory_base|__indirect_function_table" > "$(UNDEFINED_SYMBOLS)" + grep '^_*imported_wasi_' "$(UNDEFINED_SYMBOLS)" \ + > "$(SYSROOT_LIB)/libc.imports" + +@@ -883,10 +883,15 @@ check-symbols: startup_files libc + @# TODO: Filter out __FPCLASS_* that are new to clang 17. + @# TODO: Filter out __FLT128_* that are new to clang 18. + @# TODO: Filter out __MEMORY_SCOPE_* that are new to clang 18. ++ @# TODO: Filter out __GCC_(CON|DE)STRUCTIVE_SIZE that are new to clang 19. ++ @# TODO: Filter out __STDC_EMBED_* that are new to clang 19. ++ @# TODO: Filter out __*_NORM_MAX__ that are new to clang 19. + @# TODO: clang defined __FLT_EVAL_METHOD__ until clang 15, so we force-undefine it + @# for older versions. + @# TODO: Undefine __wasm_mutable_globals__ and __wasm_sign_ext__, that are new to + @# clang 16 for -mcpu=generic. ++ @# TODO: Undefine __wasm_multivalue__ and __wasm_reference_types__, that are new to ++ @# clang 19 for -mcpu=generic. + @# TODO: As of clang 16, __GNUC_VA_LIST is #defined without a value. + $(CC) $(CFLAGS) "$(SYSROOT_SHARE)/include-all.c" \ + -isystem $(SYSROOT_INC) \ +@@ -903,6 +908,8 @@ check-symbols: startup_files libc + -U__clang_wide_literal_encoding__ \ + -U__wasm_mutable_globals__ \ + -U__wasm_sign_ext__ \ ++ -U__wasm_multivalue__ \ ++ -U__wasm_reference_types__ \ + -U__GNUC__ \ + -U__GNUC_MINOR__ \ + -U__GNUC_PATCHLEVEL__ \ +@@ -917,6 +924,9 @@ check-symbols: startup_files libc + | grep -v '^#define __FPCLASS_' \ + | grep -v '^#define __FLT128_' \ + | grep -v '^#define __MEMORY_SCOPE_' \ ++ | grep -v '^#define __GCC_\(CON\|DE\)STRUCTIVE_SIZE' \ ++ | grep -v '^#define __STDC_EMBED_' \ ++ | grep -v '^#define __\(DBL\|FLT\|LDBL\)_NORM_MAX__' \ + | grep -v '^#define NDEBUG' \ + | grep -v '^#define __OPTIMIZE__' \ + | grep -v '^#define assert' \ +-- +2.47.0 + diff --git a/wasi-libc.spec b/wasi-libc.spec index a546467..61e7799 100644 --- a/wasi-libc.spec +++ b/wasi-libc.spec @@ -10,6 +10,9 @@ Source1: smoke-test.c # Allow using artifacts from %%build in %%install instead of recompiling Patch: 0001-make-don-t-rebuild-files-on-make-install.patch +# Update Makefile for LLVM 19 +# Re-created from upstream commits; remove on update +Patch: 0002-Adjust-Makefile-for-LLVM-19.patch # This contains parts of the musl C library; specify as bundled so we get notified about potential vulnerabilities %global musl_version 1.2.3 From 9ba207ec94d199e054b7a501e80fcaa2c9a82fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Wed, 13 Nov 2024 16:38:24 +0100 Subject: [PATCH 07/19] Update to version 24 (rhbz#2325627) --- .gitignore | 4 +- ...-don-t-rebuild-files-on-make-install.patch | 35 +++++---- 0002-Adjust-Makefile-for-LLVM-19.patch | 73 ------------------- sources | 2 +- wasi-libc.spec | 5 +- 5 files changed, 23 insertions(+), 96 deletions(-) delete mode 100644 0002-Adjust-Makefile-for-LLVM-19.patch diff --git a/.gitignore b/.gitignore index 2b2e21d..a330ab7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -/wasi-libc-wasi-sdk-20.tar.gz -/wasi-libc-wasi-sdk-21.tar.gz -/wasi-libc-wasi-sdk-22.tar.gz +/wasi-libc-wasi-sdk-*.tar.gz diff --git a/0001-make-don-t-rebuild-files-on-make-install.patch b/0001-make-don-t-rebuild-files-on-make-install.patch index 7bbbe0c..2dd7818 100644 --- a/0001-make-don-t-rebuild-files-on-make-install.patch +++ b/0001-make-don-t-rebuild-files-on-make-install.patch @@ -1,4 +1,4 @@ -From 5585b1bf7a0d3c250e2e2a15e36d29637c3276d7 Mon Sep 17 00:00:00 2001 +From bf718b4d75a3a22c9e0b9426c0502fe066bd56b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Mon, 29 Aug 2022 15:07:34 +0200 Subject: [PATCH] make: don't rebuild files on `make install` @@ -22,10 +22,10 @@ Signed-off-by: rpm-build 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile -index 2f9e9fd..e83ca57 100644 +index 542b43e..7b70477 100644 --- a/Makefile +++ b/Makefile -@@ -743,6 +743,9 @@ ifeq ($(WASI_SNAPSHOT), p2) +@@ -771,6 +771,9 @@ ifeq ($(WASI_SNAPSHOT), p2) > "$(SYSROOT_INC)/__wasi_snapshot.h" endif @@ -35,7 +35,7 @@ index 2f9e9fd..e83ca57 100644 startup_files: include_dirs $(LIBC_BOTTOM_HALF_CRT_OBJS) # # Install the startup files (crt1.o etc). -@@ -750,6 +753,9 @@ startup_files: include_dirs $(LIBC_BOTTOM_HALF_CRT_OBJS) +@@ -778,6 +781,9 @@ startup_files: include_dirs $(LIBC_BOTTOM_HALF_CRT_OBJS) mkdir -p "$(SYSROOT_LIB)" && \ cp $(LIBC_BOTTOM_HALF_CRT_OBJS) "$(SYSROOT_LIB)" @@ -45,7 +45,7 @@ index 2f9e9fd..e83ca57 100644 # TODO: As of this writing, wasi_thread_start.s uses non-position-independent # code, and I'm not sure how to make it position-independent. Once we've done # that, we can enable libc.so for the wasi-threads build. -@@ -768,6 +774,7 @@ endif +@@ -796,6 +802,7 @@ endif endif libc_so: include_dirs $(LIBC_SO) @@ -53,30 +53,35 @@ index 2f9e9fd..e83ca57 100644 STATIC_LIBS = \ $(SYSROOT_LIB)/libc.a \ -@@ -784,6 +791,7 @@ STATIC_LIBS += \ +@@ -812,6 +819,7 @@ STATIC_LIBS += \ endif libc: include_dirs $(STATIC_LIBS) + touch $@ - finish: startup_files libc + dummy_libs: + # +@@ -821,11 +829,13 @@ dummy_libs: + for name in m rt pthread crypt util xnet resolv; do \ + $(AR) crs "$(SYSROOT_LIB)/lib$${name}.a"; \ + done ++ touch $@ + + finish: startup_files libc dummy_libs # -@@ -797,6 +805,8 @@ finish: startup_files libc # The build succeeded! The generated sysroot is in $(SYSROOT). # - + touch $@ -+ + + ifeq ($(LTO),no) # The check for defined and undefined symbols expects there to be a heap - # alloctor (providing malloc, calloc, free, etc). Skip this step if the build - # is done without a malloc implementation. -@@ -982,5 +992,6 @@ clean: +@@ -1024,5 +1034,6 @@ clean: $(RM) -r "$(BINDING_WORK_DIR)" $(RM) -r "$(OBJDIR)" $(RM) -r "$(SYSROOT)" -+ $(RM) include_dirs startup_files libc_so libc finish ++ $(RM) include_dirs startup_files dummy_libs libc_so libc finish --.PHONY: default startup_files libc libc_so finish install include_dirs clean check-symbols bindings +-.PHONY: default startup_files libc libc_so dummy_libs finish install include_dirs clean check-symbols bindings +.PHONY: default install clean check-symbols bindings -- 2.47.0 diff --git a/0002-Adjust-Makefile-for-LLVM-19.patch b/0002-Adjust-Makefile-for-LLVM-19.patch deleted file mode 100644 index 5d1163b..0000000 --- a/0002-Adjust-Makefile-for-LLVM-19.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 9c192c4f094ab86480de85b7b5948419be1044d0 Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Tue, 30 Apr 2024 06:46:03 +0900 -Subject: [PATCH] Adjust Makefile for LLVM 19 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -- Added __GCC_(CON|DE)STRUCTIVE_SIZE macros. -- Added __wasm_multivalue__ and __wasm_reference_types__, and the latter - also makes libraries reference the undefined __indirect_function_table - symbol, which is provided by the linker. - -Latest integrated upstream commit: d43dcc63d26013264bb58241e53bde9318349443 -https://github.com/WebAssembly/wasi-libc/commit/d43dcc63d26013264bb58241e53bde9318349443 - -Signed-off-by: Jan Staněk -Signed-off-by: rpm-build ---- - Makefile | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index e83ca57..e3b4804 100644 ---- a/Makefile -+++ b/Makefile -@@ -846,7 +846,7 @@ check-symbols: startup_files libc - for undef_sym in $$("$(NM)" --undefined-only "$(SYSROOT_LIB)"/libc.a "$(SYSROOT_LIB)"/libc-*.a "$(SYSROOT_LIB)"/*.o \ - |grep ' U ' |sed 's/.* U //' |LC_ALL=C sort |uniq); do \ - grep -q '\<'$$undef_sym'\>' "$(DEFINED_SYMBOLS)" || echo $$undef_sym; \ -- done | grep -E -v "^__mul|__memory_base" > "$(UNDEFINED_SYMBOLS)" -+ done | grep -E -v "^__mul|__memory_base|__indirect_function_table" > "$(UNDEFINED_SYMBOLS)" - grep '^_*imported_wasi_' "$(UNDEFINED_SYMBOLS)" \ - > "$(SYSROOT_LIB)/libc.imports" - -@@ -883,10 +883,15 @@ check-symbols: startup_files libc - @# TODO: Filter out __FPCLASS_* that are new to clang 17. - @# TODO: Filter out __FLT128_* that are new to clang 18. - @# TODO: Filter out __MEMORY_SCOPE_* that are new to clang 18. -+ @# TODO: Filter out __GCC_(CON|DE)STRUCTIVE_SIZE that are new to clang 19. -+ @# TODO: Filter out __STDC_EMBED_* that are new to clang 19. -+ @# TODO: Filter out __*_NORM_MAX__ that are new to clang 19. - @# TODO: clang defined __FLT_EVAL_METHOD__ until clang 15, so we force-undefine it - @# for older versions. - @# TODO: Undefine __wasm_mutable_globals__ and __wasm_sign_ext__, that are new to - @# clang 16 for -mcpu=generic. -+ @# TODO: Undefine __wasm_multivalue__ and __wasm_reference_types__, that are new to -+ @# clang 19 for -mcpu=generic. - @# TODO: As of clang 16, __GNUC_VA_LIST is #defined without a value. - $(CC) $(CFLAGS) "$(SYSROOT_SHARE)/include-all.c" \ - -isystem $(SYSROOT_INC) \ -@@ -903,6 +908,8 @@ check-symbols: startup_files libc - -U__clang_wide_literal_encoding__ \ - -U__wasm_mutable_globals__ \ - -U__wasm_sign_ext__ \ -+ -U__wasm_multivalue__ \ -+ -U__wasm_reference_types__ \ - -U__GNUC__ \ - -U__GNUC_MINOR__ \ - -U__GNUC_PATCHLEVEL__ \ -@@ -917,6 +924,9 @@ check-symbols: startup_files libc - | grep -v '^#define __FPCLASS_' \ - | grep -v '^#define __FLT128_' \ - | grep -v '^#define __MEMORY_SCOPE_' \ -+ | grep -v '^#define __GCC_\(CON\|DE\)STRUCTIVE_SIZE' \ -+ | grep -v '^#define __STDC_EMBED_' \ -+ | grep -v '^#define __\(DBL\|FLT\|LDBL\)_NORM_MAX__' \ - | grep -v '^#define NDEBUG' \ - | grep -v '^#define __OPTIMIZE__' \ - | grep -v '^#define assert' \ --- -2.47.0 - diff --git a/sources b/sources index 9b4ec90..b2d9e33 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (wasi-libc-wasi-sdk-22.tar.gz) = 3fcd5d6c0e09d824702165d8f1236e400b1d5e95fad14f1821d40de05340a044f0ec8a587d8478854252cc938a663aa9f854e6a5e683ef8f8349c60dc6c628ed +SHA512 (wasi-libc-wasi-sdk-24.tar.gz) = ab9322dbcd0bb151ba3f5a8b722e04d39ea5d7632d0322257c3b67e4193d0de1b0820dd4db84923e7967f24189d02dd242693ea95ad184a309eec4d27df8ba21 diff --git a/wasi-libc.spec b/wasi-libc.spec index 61e7799..4f3efb0 100644 --- a/wasi-libc.spec +++ b/wasi-libc.spec @@ -1,6 +1,6 @@ Name: wasi-libc Summary: C library implementation for WebAssembly System Interface -Version: 22 +Version: 24 Release: %autorelease License: Apache-2.0 WITH LLVM-exception AND Apache-2.0 AND MIT AND BSD-2-Clause @@ -10,9 +10,6 @@ Source1: smoke-test.c # Allow using artifacts from %%build in %%install instead of recompiling Patch: 0001-make-don-t-rebuild-files-on-make-install.patch -# Update Makefile for LLVM 19 -# Re-created from upstream commits; remove on update -Patch: 0002-Adjust-Makefile-for-LLVM-19.patch # This contains parts of the musl C library; specify as bundled so we get notified about potential vulnerabilities %global musl_version 1.2.3 From 1a3b0cf8de5c577010a85c4902e3d8d461cf1f0c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 19 Jan 2025 14:45:49 +0000 Subject: [PATCH 08/19] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From 59a52ed3912d3e2ee74f2f1aa31ae6283839c52e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 30 Jan 2025 17:49:27 -0800 Subject: [PATCH 09/19] Update to version 25 (rhbz#2331913) --- ...-don-t-rebuild-files-on-make-install.patch | 67 +++++++------------ sources | 2 +- wasi-libc.spec | 12 ++-- 3 files changed, 31 insertions(+), 50 deletions(-) diff --git a/0001-make-don-t-rebuild-files-on-make-install.patch b/0001-make-don-t-rebuild-files-on-make-install.patch index 2dd7818..9c3c9e5 100644 --- a/0001-make-don-t-rebuild-files-on-make-install.patch +++ b/0001-make-don-t-rebuild-files-on-make-install.patch @@ -1,4 +1,4 @@ -From bf718b4d75a3a22c9e0b9426c0502fe066bd56b3 Mon Sep 17 00:00:00 2001 +From 74a068d26a61e744f607fbf6d8355f2b69e82e4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Mon, 29 Aug 2022 15:07:34 +0200 Subject: [PATCH] make: don't rebuild files on `make install` @@ -18,56 +18,30 @@ Adapted from [Debian patch][]. Signed-off-by: Jan Staněk Signed-off-by: rpm-build --- - Makefile | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) + Makefile | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile -index 542b43e..7b70477 100644 +index 00dd30812884..c340da4e0153 100644 --- a/Makefile +++ b/Makefile -@@ -771,6 +771,9 @@ ifeq ($(WASI_SNAPSHOT), p2) - > "$(SYSROOT_INC)/__wasi_snapshot.h" +@@ -768,6 +768,7 @@ endif endif -+ # Mark this rule as done -+ touch $@ -+ - startup_files: include_dirs $(LIBC_BOTTOM_HALF_CRT_OBJS) - # - # Install the startup files (crt1.o etc). -@@ -778,6 +781,9 @@ startup_files: include_dirs $(LIBC_BOTTOM_HALF_CRT_OBJS) - mkdir -p "$(SYSROOT_LIB)" && \ - cp $(LIBC_BOTTOM_HALF_CRT_OBJS) "$(SYSROOT_LIB)" - -+ # Mark this rule finished -+ touch $@ -+ - # TODO: As of this writing, wasi_thread_start.s uses non-position-independent - # code, and I'm not sure how to make it position-independent. Once we've done - # that, we can enable libc.so for the wasi-threads build. -@@ -796,6 +802,7 @@ endif - endif - - libc_so: include_dirs $(LIBC_SO) + libc_so: $(INCLUDE_DIRS) $(LIBC_SO) + touch $@ STATIC_LIBS = \ $(SYSROOT_LIB)/libc.a \ -@@ -812,6 +819,7 @@ STATIC_LIBS += \ +@@ -788,6 +789,7 @@ STATIC_LIBS += \ endif - libc: include_dirs $(STATIC_LIBS) + libc: $(INCLUDE_DIRS) $(STATIC_LIBS) + touch $@ - dummy_libs: - # -@@ -821,11 +829,13 @@ dummy_libs: - for name in m rt pthread crypt util xnet resolv; do \ - $(AR) crs "$(SYSROOT_LIB)/lib$${name}.a"; \ - done -+ touch $@ - - finish: startup_files libc dummy_libs + DUMMY := m rt pthread crypt util xnet resolv + DUMMY_LIBS := $(patsubst %,$(SYSROOT_LIB)/lib%.a,$(DUMMY)) +@@ -804,6 +806,7 @@ finish: $(STARTUP_FILES) libc $(DUMMY_LIBS) # # The build succeeded! The generated sysroot is in $(SYSROOT). # @@ -75,14 +49,23 @@ index 542b43e..7b70477 100644 ifeq ($(LTO),no) # The check for defined and undefined symbols expects there to be a heap -@@ -1024,5 +1034,6 @@ clean: +@@ -946,6 +949,8 @@ check-symbols: $(STARTUP_FILES) libc + # This ignores whitespace because on Windows the output has CRLF line endings. + diff -wur "$(EXPECTED_TARGET_DIR)" "$(SYSROOT_SHARE)" + ++ touch $@ ++ + + ##### BINDINGS ################################################################# + # The `bindings` target retrieves the necessary WIT files for the wasi-cli world +@@ -1021,5 +1026,6 @@ clean: $(RM) -r "$(BINDING_WORK_DIR)" $(RM) -r "$(OBJDIR)" $(RM) -r "$(SYSROOT)" -+ $(RM) include_dirs startup_files dummy_libs libc_so libc finish ++ $(RM) check-symbols libc_so libc finish --.PHONY: default startup_files libc libc_so dummy_libs finish install include_dirs clean check-symbols bindings -+.PHONY: default install clean check-symbols bindings +-.PHONY: default libc libc_so finish install clean check-symbols bindings ++.PHONY: default install clean bindings -- -2.47.0 +2.48.1 diff --git a/sources b/sources index b2d9e33..ed766a1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (wasi-libc-wasi-sdk-24.tar.gz) = ab9322dbcd0bb151ba3f5a8b722e04d39ea5d7632d0322257c3b67e4193d0de1b0820dd4db84923e7967f24189d02dd242693ea95ad184a309eec4d27df8ba21 +SHA512 (wasi-libc-wasi-sdk-25.tar.gz) = 580716fbc152be19e2e9724f3483a0a580a168be0cd6d105d37b0ebd0d11bd36d7d9db63984eb2cc7b3aaff2fc9446d9558d1469b538a79b7de465a1113560ea diff --git a/wasi-libc.spec b/wasi-libc.spec index 4f3efb0..67cdd2e 100644 --- a/wasi-libc.spec +++ b/wasi-libc.spec @@ -1,6 +1,6 @@ Name: wasi-libc Summary: C library implementation for WebAssembly System Interface -Version: 24 +Version: 25 Release: %autorelease License: Apache-2.0 WITH LLVM-exception AND Apache-2.0 AND MIT AND BSD-2-Clause @@ -32,6 +32,10 @@ BuildRequires: make # See rhbz#2228297 for details. %global __brp_llvm_compile_lto_elf %{nil} +# brp-strip-static-archive breaks the archive index for wasm +%global __brp_strip_static_archive %{nil} +%global __brp_strip_lto %{nil} + # WASI is a specific architecture; host (build machine) arch flags should not apply by default %global build_cflags --target=wasm32-wasi -fstack-protector # Define cross-compiling prefix @@ -75,12 +79,6 @@ make %{?_smp_mflags} %{wasi_make_flags} check-symbols %install %make_install %{wasi_make_flags} -# brp-strip-static-archive breaks the archive index for wasm -%global __os_install_post %{expand: - %__os_install_post - find %{buildroot}%{wasi_libdir} -type f -regex '.*\\.\\(a\\|rlib\\)' -print -exec llvm-ranlib '{}' ';' -} - %check # Bundled version checks xargs test '%{musl_version}' = Date: Fri, 31 Jan 2025 16:51:03 +0100 Subject: [PATCH 10/19] gating: remove rpmdeplint case from branched Fedoras According to matrix discussion in #fedora-ci:fedoraproject.org, rpmdeplint is run only on rawhide builds. --- gating.yaml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/gating.yaml b/gating.yaml index f2f68de..e943849 100644 --- a/gating.yaml +++ b/gating.yaml @@ -1,6 +1,6 @@ --- !Policy # testing repository product_versions: - - fedora-* + - fedora-rawhide decision_contexts: [bodhi_update_push_testing] subject_type: koji_build rules: @@ -10,7 +10,7 @@ rules: - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.installability.functional} --- !Policy # stable repository product_versions: - - fedora-* + - fedora-rawhide decision_contexts: [bodhi_update_push_stable] subject_type: koji_build rules: @@ -19,3 +19,22 @@ rules: - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.rpminspect.static-analysis} - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.installability.functional} ... +--- !Policy # testing repository +product_versions: + - fedora-* +decision_contexts: [bodhi_update_push_testing] +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.rpminspect.static-analysis} + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.installability.functional} +--- !Policy # stable repository +product_versions: + - fedora-* +decision_contexts: [bodhi_update_push_stable] +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.rpminspect.static-analysis} + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.installability.functional} +... From c2b2d65c5fedb67a50de1a89fc00e8a4ae434d46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Fri, 27 Jun 2025 13:50:49 +0200 Subject: [PATCH 11/19] Fix build with LLVM/Clang 20 Closes: #7 --- .gitignore | 1 + ...for-LLVM-trunk-20-as-of-2025-01-26-5.patch | 34 +++++++++++++++++++ wasi-libc.spec | 2 ++ 3 files changed, 37 insertions(+) create mode 100644 0002-Adjust-Makefile-for-LLVM-trunk-20-as-of-2025-01-26-5.patch diff --git a/.gitignore b/.gitignore index a330ab7..e128b75 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /wasi-libc-wasi-sdk-*.tar.gz +/wasi-libc-*-build/ diff --git a/0002-Adjust-Makefile-for-LLVM-trunk-20-as-of-2025-01-26-5.patch b/0002-Adjust-Makefile-for-LLVM-trunk-20-as-of-2025-01-26-5.patch new file mode 100644 index 0000000..7bb37f4 --- /dev/null +++ b/0002-Adjust-Makefile-for-LLVM-trunk-20-as-of-2025-01-26-5.patch @@ -0,0 +1,34 @@ +From 293ea3296973c85a02cf7db6a1fe8b9c6d28e941 Mon Sep 17 00:00:00 2001 +From: Mike Hommey +Date: Wed, 29 Jan 2025 08:26:30 +0900 +Subject: [PATCH] Adjust Makefile for LLVM trunk (20) as of 2025-01-26 (#564) + +https://github.com/llvm/llvm-project/commit/33ad474c45e6d7a0de7bc75e15e27cf6cb9ff895 +Signed-off-by: rpm-build +--- + Makefile | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Makefile b/Makefile +index c340da4..b14f6cf 100644 +--- a/Makefile ++++ b/Makefile +@@ -893,6 +893,7 @@ check-symbols: $(STARTUP_FILES) libc + @# TODO: Filter out __GCC_(CON|DE)STRUCTIVE_SIZE that are new to clang 19. + @# TODO: Filter out __STDC_EMBED_* that are new to clang 19. + @# TODO: Filter out __*_NORM_MAX__ that are new to clang 19. ++ @# TODO: Filter out __INT*_C() that are new to clang 20. + @# TODO: clang defined __FLT_EVAL_METHOD__ until clang 15, so we force-undefine it + @# for older versions. + @# TODO: Undefine __wasm_mutable_globals__ and __wasm_sign_ext__, that are new to +@@ -943,6 +944,7 @@ check-symbols: $(STARTUP_FILES) libc + | grep -v '^#define __OPTIMIZE__' \ + | grep -v '^#define assert' \ + | grep -v '^#define __NO_INLINE__' \ ++ | grep -v '^#define __U\?INT.*_C(' \ + > "$(SYSROOT_SHARE)/predefined-macros.txt" + + # Check that the computed metadata matches the expected metadata. +-- +2.50.0 + diff --git a/wasi-libc.spec b/wasi-libc.spec index 67cdd2e..64c56d8 100644 --- a/wasi-libc.spec +++ b/wasi-libc.spec @@ -10,6 +10,8 @@ Source1: smoke-test.c # Allow using artifacts from %%build in %%install instead of recompiling Patch: 0001-make-don-t-rebuild-files-on-make-install.patch +# Compatibility patches from upstream main +Patch: 0002-Adjust-Makefile-for-LLVM-trunk-20-as-of-2025-01-26-5.patch # This contains parts of the musl C library; specify as bundled so we get notified about potential vulnerabilities %global musl_version 1.2.3 From 5dcb09ac1297ff1f6396f0c308f43a75f63e7ca6 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 25 Jul 2025 20:17:36 +0000 Subject: [PATCH 12/19] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From b43d471b620726377e2a8b335092af70ac0e1950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Mon, 28 Jul 2025 13:51:18 +0200 Subject: [PATCH 13/19] Update to version 27 (rhbz#2383871) --- ...-don-t-rebuild-files-on-make-install.patch | 26 +++++++++---------- sources | 2 +- wasi-libc.spec | 5 ++-- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/0001-make-don-t-rebuild-files-on-make-install.patch b/0001-make-don-t-rebuild-files-on-make-install.patch index 9c3c9e5..0514171 100644 --- a/0001-make-don-t-rebuild-files-on-make-install.patch +++ b/0001-make-don-t-rebuild-files-on-make-install.patch @@ -1,4 +1,4 @@ -From 74a068d26a61e744f607fbf6d8355f2b69e82e4e Mon Sep 17 00:00:00 2001 +From ff153ab204af3a48479ed25d90ad9cc34ad4af49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Mon, 29 Aug 2022 15:07:34 +0200 Subject: [PATCH] make: don't rebuild files on `make install` @@ -22,10 +22,10 @@ Signed-off-by: rpm-build 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile -index 00dd30812884..c340da4e0153 100644 +index 26bdcfa..919fc54 100644 --- a/Makefile +++ b/Makefile -@@ -768,6 +768,7 @@ endif +@@ -835,6 +835,7 @@ endif endif libc_so: $(INCLUDE_DIRS) $(LIBC_SO) @@ -33,7 +33,7 @@ index 00dd30812884..c340da4e0153 100644 STATIC_LIBS = \ $(SYSROOT_LIB)/libc.a \ -@@ -788,6 +789,7 @@ STATIC_LIBS += \ +@@ -851,6 +852,7 @@ STATIC_LIBS += \ endif libc: $(INCLUDE_DIRS) $(STATIC_LIBS) @@ -41,15 +41,15 @@ index 00dd30812884..c340da4e0153 100644 DUMMY := m rt pthread crypt util xnet resolv DUMMY_LIBS := $(patsubst %,$(SYSROOT_LIB)/lib%.a,$(DUMMY)) -@@ -804,6 +806,7 @@ finish: $(STARTUP_FILES) libc $(DUMMY_LIBS) +@@ -867,6 +869,7 @@ no-check-symbols: $(STARTUP_FILES) libc $(DUMMY_LIBS) # # The build succeeded! The generated sysroot is in $(SYSROOT). # + touch $@ - ifeq ($(LTO),no) - # The check for defined and undefined symbols expects there to be a heap -@@ -946,6 +949,8 @@ check-symbols: $(STARTUP_FILES) libc + finish: no-check-symbols + +@@ -1014,6 +1017,8 @@ check-symbols: $(STARTUP_FILES) libc # This ignores whitespace because on Windows the output has CRLF line endings. diff -wur "$(EXPECTED_TARGET_DIR)" "$(SYSROOT_SHARE)" @@ -58,14 +58,14 @@ index 00dd30812884..c340da4e0153 100644 ##### BINDINGS ################################################################# # The `bindings` target retrieves the necessary WIT files for the wasi-cli world -@@ -1021,5 +1026,6 @@ clean: +@@ -1089,5 +1094,6 @@ clean: $(RM) -r "$(BINDING_WORK_DIR)" $(RM) -r "$(OBJDIR)" $(RM) -r "$(SYSROOT)" -+ $(RM) check-symbols libc_so libc finish ++ $(RM) check-symbols no-check-symbols libc_so libc --.PHONY: default libc libc_so finish install clean check-symbols bindings -+.PHONY: default install clean bindings +-.PHONY: default libc libc_so finish install clean check-symbols no-check-symbols bindings ++.PHONY: default finish install clean bindings -- -2.48.1 +2.50.1 diff --git a/sources b/sources index ed766a1..67250bc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (wasi-libc-wasi-sdk-25.tar.gz) = 580716fbc152be19e2e9724f3483a0a580a168be0cd6d105d37b0ebd0d11bd36d7d9db63984eb2cc7b3aaff2fc9446d9558d1469b538a79b7de465a1113560ea +SHA512 (wasi-libc-wasi-sdk-27.tar.gz) = dfc2c36fabf32f465fc833ed0b10efffc9a35c68162ecc3e8d656d1d684d170b734d55e790614d12d925d17f49d60f0d2d01c46cecac941cf62d68eda84df13e diff --git a/wasi-libc.spec b/wasi-libc.spec index 64c56d8..db90ea3 100644 --- a/wasi-libc.spec +++ b/wasi-libc.spec @@ -1,6 +1,6 @@ Name: wasi-libc Summary: C library implementation for WebAssembly System Interface -Version: 25 +Version: 27 Release: %autorelease License: Apache-2.0 WITH LLVM-exception AND Apache-2.0 AND MIT AND BSD-2-Clause @@ -11,10 +11,9 @@ Source1: smoke-test.c # Allow using artifacts from %%build in %%install instead of recompiling Patch: 0001-make-don-t-rebuild-files-on-make-install.patch # Compatibility patches from upstream main -Patch: 0002-Adjust-Makefile-for-LLVM-trunk-20-as-of-2025-01-26-5.patch # This contains parts of the musl C library; specify as bundled so we get notified about potential vulnerabilities -%global musl_version 1.2.3 +%global musl_version 1.2.5 # Although these packages provide binary files, they are not targeted # for the build platform, but for wasm32-wasi. From 844381a0cf584ff29e20eaedc508f2959d713da8 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 17 Jan 2026 20:07:20 +0000 Subject: [PATCH 14/19] Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild From 0e92b6afd07a4fb338daaaf78f009fa27560d861 Mon Sep 17 00:00:00 2001 From: Paul Murphy Date: Fri, 9 Jan 2026 11:45:48 -0600 Subject: [PATCH 15/19] Update to version 29 (rhbz#2415063) The makefile now aggressively tries to link compiler-rt libraries which are neither built nor provided via fedora's llvm. This seems to be a requirement for PIC variants which fedora does not appear to provide. This probably indicates there are portions of the library which are not usable due to the lack of compiler-rt. If there are such users, they should (and likely should have) receive a linker error. --- ...-don-t-rebuild-files-on-make-install.patch | 43 +++++++++++------ ...linking-compiler-rt-builtins-library.patch | 47 +++++++++++++++++++ sources | 2 +- wasi-libc.spec | 6 ++- 4 files changed, 82 insertions(+), 16 deletions(-) create mode 100644 0002-Disable-linking-compiler-rt-builtins-library.patch diff --git a/0001-make-don-t-rebuild-files-on-make-install.patch b/0001-make-don-t-rebuild-files-on-make-install.patch index 0514171..9dd8bff 100644 --- a/0001-make-don-t-rebuild-files-on-make-install.patch +++ b/0001-make-don-t-rebuild-files-on-make-install.patch @@ -1,7 +1,7 @@ -From ff153ab204af3a48479ed25d90ad9cc34ad4af49 Mon Sep 17 00:00:00 2001 +From 49cd232ebf6d8e35da47ebe9d27f69e3dab9cdeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Mon, 29 Aug 2022 15:07:34 +0200 -Subject: [PATCH] make: don't rebuild files on `make install` +Subject: [PATCH 1/2] make: don't rebuild files on `make install` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -18,14 +18,22 @@ Adapted from [Debian patch][]. Signed-off-by: Jan Staněk Signed-off-by: rpm-build --- - Makefile | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) + Makefile | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile -index 26bdcfa..919fc54 100644 +index cd8deb4..e0776fb 100644 --- a/Makefile +++ b/Makefile -@@ -835,6 +835,7 @@ endif +@@ -831,6 +831,7 @@ $(STARTUP_FILES): $(INCLUDE_DIRS) $(LIBC_BOTTOM_HALF_CRT_OBJS) + touch $@ + + startup_files: $(STARTUP_FILES) ++ touch $@ + + # TODO: As of this writing, wasi_thread_start.s uses non-position-independent + # code, and I'm not sure how to make it position-independent. Once we've done +@@ -850,6 +851,7 @@ endif endif libc_so: $(INCLUDE_DIRS) $(LIBC_SO) @@ -33,15 +41,15 @@ index 26bdcfa..919fc54 100644 STATIC_LIBS = \ $(SYSROOT_LIB)/libc.a \ -@@ -851,6 +852,7 @@ STATIC_LIBS += \ +@@ -866,6 +868,7 @@ STATIC_LIBS += \ endif - libc: $(INCLUDE_DIRS) $(STATIC_LIBS) + libc: $(INCLUDE_DIRS) $(STATIC_LIBS) builtins + touch $@ DUMMY := m rt pthread crypt util xnet resolv DUMMY_LIBS := $(patsubst %,$(SYSROOT_LIB)/lib%.a,$(DUMMY)) -@@ -867,6 +869,7 @@ no-check-symbols: $(STARTUP_FILES) libc $(DUMMY_LIBS) +@@ -882,6 +885,7 @@ no-check-symbols: $(STARTUP_FILES) libc $(DUMMY_LIBS) # # The build succeeded! The generated sysroot is in $(SYSROOT). # @@ -49,7 +57,7 @@ index 26bdcfa..919fc54 100644 finish: no-check-symbols -@@ -1014,6 +1017,8 @@ check-symbols: $(STARTUP_FILES) libc +@@ -1026,6 +1030,8 @@ endif # This ignores whitespace because on Windows the output has CRLF line endings. diff -wur "$(EXPECTED_TARGET_DIR)" "$(SYSROOT_SHARE)" @@ -58,14 +66,21 @@ index 26bdcfa..919fc54 100644 ##### BINDINGS ################################################################# # The `bindings` target retrieves the necessary WIT files for the wasi-cli world -@@ -1089,5 +1094,6 @@ clean: +@@ -1098,10 +1104,13 @@ bindings: $(BINDING_WORK_DIR)/wasi-cli $(BINDING_WORK_DIR)/wit-bindgen + sed -i 's/extern void exit_exit/_Noreturn extern void exit_exit/' libc-bottom-half/headers/public/wasi/wasip2.h + sed -i 's/extern void __wasm_import_exit_exit/_Noreturn extern void __wasm_import_exit_exit/' libc-bottom-half/sources/wasip2.c + ++ touch $@ ++ + + clean: $(RM) -r "$(BINDING_WORK_DIR)" $(RM) -r "$(OBJDIR)" $(RM) -r "$(SYSROOT)" -+ $(RM) check-symbols no-check-symbols libc_so libc ++ $(RM) check-symbols no-check-symbols libc_so libc bindings startup_files --.PHONY: default libc libc_so finish install clean check-symbols no-check-symbols bindings +-.PHONY: default libc libc_so finish install clean check-symbols no-check-symbols bindings startup_files +.PHONY: default finish install clean bindings -- -2.50.1 +2.52.0 diff --git a/0002-Disable-linking-compiler-rt-builtins-library.patch b/0002-Disable-linking-compiler-rt-builtins-library.patch new file mode 100644 index 0000000..7e6ab6c --- /dev/null +++ b/0002-Disable-linking-compiler-rt-builtins-library.patch @@ -0,0 +1,47 @@ +From e23112ea2e6e3422794388035129a052918983ff Mon Sep 17 00:00:00 2001 +From: Paul Murphy +Date: Fri, 9 Jan 2026 11:28:46 -0600 +Subject: [PATCH 2/2] Disable linking compiler-rt builtins library + +The instructions lead us to believe it was always necessary, +but so far we haven't and had no complaints yet. +--- + Makefile | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/Makefile b/Makefile +index e0776fb..b1fac34 100644 +--- a/Makefile ++++ b/Makefile +@@ -643,17 +643,15 @@ builtins: $(BUILTINS_LIB_PATH) + + # Note: libc.so is special because it shouldn't link to libc.so, and the + # -nodefaultlibs flag here disables the default `-lc` logic that clang +-# has. Note though that this also disables linking of compiler-rt +-# libraries so that is explicitly passed in via `$(BUILTINS_LIB_PATH)` ++# has. + # + # Note: --allow-undefined-file=linker-provided-symbols.txt is + # a workaround for https://github.com/llvm/llvm-project/issues/103592 +-$(SYSROOT_LIB)/libc.so: $(OBJDIR)/libc.so.a $(BUILTINS_LIB_PATH) ++$(SYSROOT_LIB)/libc.so: $(OBJDIR)/libc.so.a + $(CC) --target=${TARGET_TRIPLE} -nodefaultlibs \ + -shared --sysroot=$(SYSROOT) \ + -o $@ -Wl,--whole-archive $< -Wl,--no-whole-archive \ + -Wl,--allow-undefined-file=linker-provided-symbols.txt \ +- $(BUILTINS_LIB_PATH) \ + $(EXTRA_CFLAGS) $(LDFLAGS) + + # Note that unlike `libc.so` above this rule does not pass `-nodefaultlibs` +@@ -867,7 +865,7 @@ STATIC_LIBS += \ + $(SYSROOT_LIB)/libsetjmp.a + endif + +-libc: $(INCLUDE_DIRS) $(STATIC_LIBS) builtins ++libc: $(INCLUDE_DIRS) $(STATIC_LIBS) + touch $@ + + DUMMY := m rt pthread crypt util xnet resolv +-- +2.52.0 + diff --git a/sources b/sources index 67250bc..79e8283 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (wasi-libc-wasi-sdk-27.tar.gz) = dfc2c36fabf32f465fc833ed0b10efffc9a35c68162ecc3e8d656d1d684d170b734d55e790614d12d925d17f49d60f0d2d01c46cecac941cf62d68eda84df13e +SHA512 (wasi-libc-wasi-sdk-29.tar.gz) = ee803c0eb6c5dab119660926cb2d3ce044cc6f1f32b7cc266d89c25c031480f34c27ab2638df34e192321add629699c6a473438b94f899a28ae9e806ab07d87b diff --git a/wasi-libc.spec b/wasi-libc.spec index db90ea3..d34d17e 100644 --- a/wasi-libc.spec +++ b/wasi-libc.spec @@ -1,6 +1,6 @@ Name: wasi-libc Summary: C library implementation for WebAssembly System Interface -Version: 27 +Version: 29 Release: %autorelease License: Apache-2.0 WITH LLVM-exception AND Apache-2.0 AND MIT AND BSD-2-Clause @@ -10,6 +10,10 @@ Source1: smoke-test.c # Allow using artifacts from %%build in %%install instead of recompiling Patch: 0001-make-don-t-rebuild-files-on-make-install.patch + +# Remove explicit linking to compiler-rt.builtins library +Patch: 0002-Disable-linking-compiler-rt-builtins-library.patch + # Compatibility patches from upstream main # This contains parts of the musl C library; specify as bundled so we get notified about potential vulnerabilities From a5fed477131c4ea2b5baceb21d98ac2933bcb078 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 16 Apr 2026 18:30:51 -0700 Subject: [PATCH 16/19] Update to version 32 (rhbz#2439212) --- ...-don-t-rebuild-files-on-make-install.patch | 86 ------------------- ...linking-compiler-rt-builtins-library.patch | 47 ---------- sources | 2 +- wasi-libc.spec | 26 +++--- 4 files changed, 14 insertions(+), 147 deletions(-) delete mode 100644 0001-make-don-t-rebuild-files-on-make-install.patch delete mode 100644 0002-Disable-linking-compiler-rt-builtins-library.patch diff --git a/0001-make-don-t-rebuild-files-on-make-install.patch b/0001-make-don-t-rebuild-files-on-make-install.patch deleted file mode 100644 index 9dd8bff..0000000 --- a/0001-make-don-t-rebuild-files-on-make-install.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 49cd232ebf6d8e35da47ebe9d27f69e3dab9cdeb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= -Date: Mon, 29 Aug 2022 15:07:34 +0200 -Subject: [PATCH 1/2] make: don't rebuild files on `make install` -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The original Makefile does not allow for clean separation of build and -install steps, and re-compiles the library on `make install`. - -Using [empty target files][], the re-compilation is skipped on install. -Adapted from [Debian patch][]. - -[empty target files]: https://www.gnu.org/software/make/manual/make.html#Empty-Targets -[Debian patch]: https://salsa.debian.org/rust-team/wasi-libc/-/blob/master/debian/patches/dont-rebuild-install.patch - -Signed-off-by: Jan Staněk -Signed-off-by: rpm-build ---- - Makefile | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index cd8deb4..e0776fb 100644 ---- a/Makefile -+++ b/Makefile -@@ -831,6 +831,7 @@ $(STARTUP_FILES): $(INCLUDE_DIRS) $(LIBC_BOTTOM_HALF_CRT_OBJS) - touch $@ - - startup_files: $(STARTUP_FILES) -+ touch $@ - - # TODO: As of this writing, wasi_thread_start.s uses non-position-independent - # code, and I'm not sure how to make it position-independent. Once we've done -@@ -850,6 +851,7 @@ endif - endif - - libc_so: $(INCLUDE_DIRS) $(LIBC_SO) -+ touch $@ - - STATIC_LIBS = \ - $(SYSROOT_LIB)/libc.a \ -@@ -866,6 +868,7 @@ STATIC_LIBS += \ - endif - - libc: $(INCLUDE_DIRS) $(STATIC_LIBS) builtins -+ touch $@ - - DUMMY := m rt pthread crypt util xnet resolv - DUMMY_LIBS := $(patsubst %,$(SYSROOT_LIB)/lib%.a,$(DUMMY)) -@@ -882,6 +885,7 @@ no-check-symbols: $(STARTUP_FILES) libc $(DUMMY_LIBS) - # - # The build succeeded! The generated sysroot is in $(SYSROOT). - # -+ touch $@ - - finish: no-check-symbols - -@@ -1026,6 +1030,8 @@ endif - # This ignores whitespace because on Windows the output has CRLF line endings. - diff -wur "$(EXPECTED_TARGET_DIR)" "$(SYSROOT_SHARE)" - -+ touch $@ -+ - - ##### BINDINGS ################################################################# - # The `bindings` target retrieves the necessary WIT files for the wasi-cli world -@@ -1098,10 +1104,13 @@ bindings: $(BINDING_WORK_DIR)/wasi-cli $(BINDING_WORK_DIR)/wit-bindgen - sed -i 's/extern void exit_exit/_Noreturn extern void exit_exit/' libc-bottom-half/headers/public/wasi/wasip2.h - sed -i 's/extern void __wasm_import_exit_exit/_Noreturn extern void __wasm_import_exit_exit/' libc-bottom-half/sources/wasip2.c - -+ touch $@ -+ - - clean: - $(RM) -r "$(BINDING_WORK_DIR)" - $(RM) -r "$(OBJDIR)" - $(RM) -r "$(SYSROOT)" -+ $(RM) check-symbols no-check-symbols libc_so libc bindings startup_files - --.PHONY: default libc libc_so finish install clean check-symbols no-check-symbols bindings startup_files -+.PHONY: default finish install clean bindings --- -2.52.0 - diff --git a/0002-Disable-linking-compiler-rt-builtins-library.patch b/0002-Disable-linking-compiler-rt-builtins-library.patch deleted file mode 100644 index 7e6ab6c..0000000 --- a/0002-Disable-linking-compiler-rt-builtins-library.patch +++ /dev/null @@ -1,47 +0,0 @@ -From e23112ea2e6e3422794388035129a052918983ff Mon Sep 17 00:00:00 2001 -From: Paul Murphy -Date: Fri, 9 Jan 2026 11:28:46 -0600 -Subject: [PATCH 2/2] Disable linking compiler-rt builtins library - -The instructions lead us to believe it was always necessary, -but so far we haven't and had no complaints yet. ---- - Makefile | 8 +++----- - 1 file changed, 3 insertions(+), 5 deletions(-) - -diff --git a/Makefile b/Makefile -index e0776fb..b1fac34 100644 ---- a/Makefile -+++ b/Makefile -@@ -643,17 +643,15 @@ builtins: $(BUILTINS_LIB_PATH) - - # Note: libc.so is special because it shouldn't link to libc.so, and the - # -nodefaultlibs flag here disables the default `-lc` logic that clang --# has. Note though that this also disables linking of compiler-rt --# libraries so that is explicitly passed in via `$(BUILTINS_LIB_PATH)` -+# has. - # - # Note: --allow-undefined-file=linker-provided-symbols.txt is - # a workaround for https://github.com/llvm/llvm-project/issues/103592 --$(SYSROOT_LIB)/libc.so: $(OBJDIR)/libc.so.a $(BUILTINS_LIB_PATH) -+$(SYSROOT_LIB)/libc.so: $(OBJDIR)/libc.so.a - $(CC) --target=${TARGET_TRIPLE} -nodefaultlibs \ - -shared --sysroot=$(SYSROOT) \ - -o $@ -Wl,--whole-archive $< -Wl,--no-whole-archive \ - -Wl,--allow-undefined-file=linker-provided-symbols.txt \ -- $(BUILTINS_LIB_PATH) \ - $(EXTRA_CFLAGS) $(LDFLAGS) - - # Note that unlike `libc.so` above this rule does not pass `-nodefaultlibs` -@@ -867,7 +865,7 @@ STATIC_LIBS += \ - $(SYSROOT_LIB)/libsetjmp.a - endif - --libc: $(INCLUDE_DIRS) $(STATIC_LIBS) builtins -+libc: $(INCLUDE_DIRS) $(STATIC_LIBS) - touch $@ - - DUMMY := m rt pthread crypt util xnet resolv --- -2.52.0 - diff --git a/sources b/sources index 79e8283..6160af5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (wasi-libc-wasi-sdk-29.tar.gz) = ee803c0eb6c5dab119660926cb2d3ce044cc6f1f32b7cc266d89c25c031480f34c27ab2638df34e192321add629699c6a473438b94f899a28ae9e806ab07d87b +SHA512 (wasi-libc-wasi-sdk-32.tar.gz) = 5a07d2d21789c7ad8669d87a33bd0d397b2c64ebb11de81ee3c1c027754a9a88e06c524526b4b7170fa4dfd7e1bfec0a5f58757103a6fe1a8ab136abc7e8a190 diff --git a/wasi-libc.spec b/wasi-libc.spec index d34d17e..9ee3b6b 100644 --- a/wasi-libc.spec +++ b/wasi-libc.spec @@ -1,6 +1,6 @@ Name: wasi-libc Summary: C library implementation for WebAssembly System Interface -Version: 29 +Version: 32 Release: %autorelease License: Apache-2.0 WITH LLVM-exception AND Apache-2.0 AND MIT AND BSD-2-Clause @@ -8,12 +8,6 @@ URL: https://github.com/WebAssembly/wasi-libc/ Source: %{url}/archive/refs/tags/wasi-sdk-%{version}.tar.gz#/%{name}-wasi-sdk-%{version}.tar.gz Source1: smoke-test.c -# Allow using artifacts from %%build in %%install instead of recompiling -Patch: 0001-make-don-t-rebuild-files-on-make-install.patch - -# Remove explicit linking to compiler-rt.builtins library -Patch: 0002-Disable-linking-compiler-rt-builtins-library.patch - # Compatibility patches from upstream main # This contains parts of the musl C library; specify as bundled so we get notified about potential vulnerabilities @@ -27,9 +21,9 @@ Patch: 0002-Disable-linking-compiler-rt-builtins-library.patch BuildArch: noarch BuildRequires: clang >= 10 +BuildRequires: cmake >= 3.26 BuildRequires: git-core BuildRequires: llvm >= 10 -BuildRequires: make %global toolchain clang # Re-packaging the static library tends to overwrite files @@ -42,13 +36,12 @@ BuildRequires: make %global __brp_strip_lto %{nil} # WASI is a specific architecture; host (build machine) arch flags should not apply by default -%global build_cflags --target=wasm32-wasi -fstack-protector +%global build_cflags -O2 --target=wasm32-wasi -fstack-protector # Define cross-compiling prefix %global wasi_prefix %{_prefix}/wasm32-wasi %global wasi_datadir %{wasi_prefix}/share %global wasi_includedir %{wasi_prefix}/include %global wasi_libdir %{wasi_prefix}/lib -%global wasi_make_flags MALLOC_IMPL=emmalloc INSTALL_DIR='%{buildroot}%{wasi_prefix}' SYSROOT='%{_builddir}/sysroot' %global _description %{expand: WASI Libc is a libc for WebAssembly programs built on top of WASI system calls. @@ -78,11 +71,18 @@ Summary: C library for WASI - headers and development files cp -p libc-bottom-half/cloudlibc/LICENSE LICENSE-cloudlibc %build -%make_build %{wasi_make_flags} -make %{?_smp_mflags} %{wasi_make_flags} check-symbols +%cmake \ + -DCMAKE_INSTALL_PREFIX='%{wasi_prefix}' \ + -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \ + -DBUILD_SHARED=OFF \ + -DCHECK_SYMBOLS=ON \ + -DMALLOC=emmalloc \ + -DTARGET_TRIPLE=wasm32-wasi +%cmake_build %install -%make_install %{wasi_make_flags} +%cmake_install +cp -av -t '%{buildroot}%{wasi_prefix}' '%{__cmake_builddir}/sysroot/share' %check # Bundled version checks From 6cd7f100ab74b29e5f1788ddb0803dd198f1e05b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jul 2026 08:41:32 +0000 Subject: [PATCH 17/19] Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild From bd5d0c02463a36866cfd6c53800b475eb287a4fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Wed, 19 Aug 2026 12:26:42 +0200 Subject: [PATCH 18/19] Update to version 33 (rhbz#2513553) --- ...for-LLVM-trunk-20-as-of-2025-01-26-5.patch | 34 ------------------- sources | 2 +- wasi-libc.spec | 2 +- 3 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 0002-Adjust-Makefile-for-LLVM-trunk-20-as-of-2025-01-26-5.patch diff --git a/0002-Adjust-Makefile-for-LLVM-trunk-20-as-of-2025-01-26-5.patch b/0002-Adjust-Makefile-for-LLVM-trunk-20-as-of-2025-01-26-5.patch deleted file mode 100644 index 7bb37f4..0000000 --- a/0002-Adjust-Makefile-for-LLVM-trunk-20-as-of-2025-01-26-5.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 293ea3296973c85a02cf7db6a1fe8b9c6d28e941 Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Wed, 29 Jan 2025 08:26:30 +0900 -Subject: [PATCH] Adjust Makefile for LLVM trunk (20) as of 2025-01-26 (#564) - -https://github.com/llvm/llvm-project/commit/33ad474c45e6d7a0de7bc75e15e27cf6cb9ff895 -Signed-off-by: rpm-build ---- - Makefile | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/Makefile b/Makefile -index c340da4..b14f6cf 100644 ---- a/Makefile -+++ b/Makefile -@@ -893,6 +893,7 @@ check-symbols: $(STARTUP_FILES) libc - @# TODO: Filter out __GCC_(CON|DE)STRUCTIVE_SIZE that are new to clang 19. - @# TODO: Filter out __STDC_EMBED_* that are new to clang 19. - @# TODO: Filter out __*_NORM_MAX__ that are new to clang 19. -+ @# TODO: Filter out __INT*_C() that are new to clang 20. - @# TODO: clang defined __FLT_EVAL_METHOD__ until clang 15, so we force-undefine it - @# for older versions. - @# TODO: Undefine __wasm_mutable_globals__ and __wasm_sign_ext__, that are new to -@@ -943,6 +944,7 @@ check-symbols: $(STARTUP_FILES) libc - | grep -v '^#define __OPTIMIZE__' \ - | grep -v '^#define assert' \ - | grep -v '^#define __NO_INLINE__' \ -+ | grep -v '^#define __U\?INT.*_C(' \ - > "$(SYSROOT_SHARE)/predefined-macros.txt" - - # Check that the computed metadata matches the expected metadata. --- -2.50.0 - diff --git a/sources b/sources index 6160af5..04d9551 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (wasi-libc-wasi-sdk-32.tar.gz) = 5a07d2d21789c7ad8669d87a33bd0d397b2c64ebb11de81ee3c1c027754a9a88e06c524526b4b7170fa4dfd7e1bfec0a5f58757103a6fe1a8ab136abc7e8a190 +SHA512 (wasi-libc-wasi-sdk-33.tar.gz) = 7b07509db0ce6817a9616988b8b4ea9c7a87a2318e68ed350a2d0a8f7e839bb97e1cb766a568b008654149835b430a5a090f767ed9db0ca30503c4efe864a49c diff --git a/wasi-libc.spec b/wasi-libc.spec index 9ee3b6b..ff2f0a8 100644 --- a/wasi-libc.spec +++ b/wasi-libc.spec @@ -1,6 +1,6 @@ Name: wasi-libc Summary: C library implementation for WebAssembly System Interface -Version: 32 +Version: 33 Release: %autorelease License: Apache-2.0 WITH LLVM-exception AND Apache-2.0 AND MIT AND BSD-2-Clause From b6723f836f6287c3b036b5c9f589e8bf49d6b3ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Wed, 19 Aug 2026 13:09:50 +0200 Subject: [PATCH 19/19] add rpmlint config to filter expected errors [skip changelog] --- wasi-libc.rpmlintrc | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 wasi-libc.rpmlintrc diff --git a/wasi-libc.rpmlintrc b/wasi-libc.rpmlintrc new file mode 100644 index 0000000..70329d5 --- /dev/null +++ b/wasi-libc.rpmlintrc @@ -0,0 +1,4 @@ +# cross-compilation files are expected +addFilter(r"\barch-independent-package-contains-binary-or-object /usr/wasm32-wasi/.*") +# some header files are empty, and that's expected +addFilter(r"\bzero-length /usr/wasm32-wasi/include/wasm32-wasi/bits/.*\.h")