Compare commits

...
Sign in to create a new pull request.

19 commits

Author SHA1 Message Date
Jan Staněk
b6723f836f
add rpmlint config to filter expected errors
[skip changelog]
2026-08-19 13:10:40 +02:00
Jan Staněk
bd5d0c0246
Update to version 33 (rhbz#2513553) 2026-08-19 12:26:42 +02:00
Fedora Release Engineering
6cd7f100ab Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild 2026-07-17 08:41:32 +00:00
Josh Stone
a5fed47713 Update to version 32 (rhbz#2439212) 2026-04-16 18:30:51 -07:00
Paul Murphy
0e92b6afd0 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.
2026-01-21 21:32:48 +00:00
Fedora Release Engineering
844381a0cf Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild 2026-01-17 20:07:20 +00:00
Jan Staněk
b43d471b62
Update to version 27 (rhbz#2383871) 2025-07-28 13:51:18 +02:00
Fedora Release Engineering
5dcb09ac12 Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-25 20:17:36 +00:00
Jan Staněk
c2b2d65c5f
Fix build with LLVM/Clang 20
Closes: #7
2025-06-27 13:51:01 +02:00
Jan Staněk
155e969f52
gating: remove rpmdeplint case from branched Fedoras
According to matrix discussion in #fedora-ci:fedoraproject.org,
rpmdeplint is run only on rawhide builds.
2025-01-31 16:51:10 +01:00
Josh Stone
59a52ed391 Update to version 25 (rhbz#2331913) 2025-01-30 17:49:27 -08:00
Fedora Release Engineering
1a3b0cf8de Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-19 14:45:49 +00:00
Jan Staněk
9ba207ec94
Update to version 24 (rhbz#2325627) 2024-11-13 16:38:24 +01:00
Jan Staněk
15bcecb2bf
Update checks for LLVM 19 2024-10-10 13:52:59 +02:00
Fedora Release Engineering
9e5709384b Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-20 09:07:52 +00:00
Jan Staněk
8556bbb0c7
Upgrade to tag wasi-sdk-22 (rhbz#2278786) 2024-05-06 15:52:39 +02:00
Fedora Release Engineering
faf7fce1e6 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-27 08:23:48 +00:00
Josh Stone
ac6e5fb1d0 Upgrade to tag wasi-sdk-21 2024-01-10 16:08:12 -08:00
Jan Staněk
90b494294c
Expand README 2023-09-14 15:22:27 +02:00
9 changed files with 56 additions and 171 deletions

3
.gitignore vendored
View file

@ -1 +1,2 @@
/wasi-libc-wasi-sdk-20.tar.gz
/wasi-libc-wasi-sdk-*.tar.gz
/wasi-libc-*-build/

View file

@ -1,76 +0,0 @@
From 112b521d2f64f8e812e6f40d7cde46e47d704f3a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= <jstanek@redhat.com>
Date: Mon, 29 Aug 2022 15:07:34 +0200
Subject: [PATCH 1/3] 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 <jstanek@redhat.com>
Signed-off-by: rpm-build <rpm-build>
---
Makefile | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index f350ecb..9ef000b 100644
--- a/Makefile
+++ b/Makefile
@@ -583,6 +583,9 @@ include_dirs:
# Remove selected header files.
$(RM) $(patsubst %,$(SYSROOT_INC)/%,$(MUSL_OMIT_HEADERS))
+ # Mark this rule as done
+ touch $@
+
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)
mkdir -p "$(SYSROOT_LIB)" && \
cp $(LIBC_BOTTOM_HALF_CRT_OBJS) "$(SYSROOT_LIB)"
+ # Mark this rule finished
+ 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
+ touch $@
+
finish: startup_files libc
#
# Create empty placeholder libraries.
@@ -611,6 +619,8 @@ finish: startup_files libc
# The build succeeded! The generated sysroot is in $(SYSROOT).
#
+ touch $@
+
# 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
clean:
$(RM) -r "$(OBJDIR)"
$(RM) -r "$(SYSROOT)"
+ $(RM) include_dirs startup_files libc finish
-.PHONY: default startup_files libc finish install include_dirs clean
+.PHONY: default install clean
--
2.41.0

View file

@ -1,29 +0,0 @@
From bac6be2aaa57cb26daddaac241151f8d43555228 Mon Sep 17 00:00:00 2001
From: Josh Stone <cuviper@gmail.com>
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 <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

View file

@ -1,37 +0,0 @@
From 8951be3fed5a9723db262e08aa1be708213ae9b5 Mon Sep 17 00:00:00 2001
From: Mike Hommey <mh@glandium.org>
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 <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

View file

@ -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.

View file

@ -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}
...

View file

@ -1 +1 @@
SHA512 (wasi-libc-wasi-sdk-20.tar.gz) = e264240dc7dbcf6398c8ca09bc108298f4a8aa955af22de5a3015fbcde81cb09dd83cd48349090082d5de0e8a3dbcf746c7b14657c67657b3f2f1ab28bb9cf05
SHA512 (wasi-libc-wasi-sdk-33.tar.gz) = 7b07509db0ce6817a9616988b8b4ea9c7a87a2318e68ed350a2d0a8f7e839bb97e1cb766a568b008654149835b430a5a090f767ed9db0ca30503c4efe864a49c

4
wasi-libc.rpmlintrc Normal file
View file

@ -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")

View file

@ -1,6 +1,6 @@
Name: wasi-libc
Summary: C library implementation for WebAssembly System Interface
Version: 20
Version: 33
Release: %autorelease
License: Apache-2.0 WITH LLVM-exception AND Apache-2.0 AND MIT AND BSD-2-Clause
@ -8,18 +8,10 @@ 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
# 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
# Compatibility patches from upstream main
# 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.
@ -29,9 +21,9 @@ Patch: 0003-Adjust-Makefile-for-LLVM-trunk-17-as-of-2023-06-18-4.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
@ -39,14 +31,17 @@ 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
%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.
@ -76,17 +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}
# 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 '{}' ';'
}
%cmake_install
cp -av -t '%{buildroot}%{wasi_prefix}' '%{__cmake_builddir}/sysroot/share'
%check
# Bundled version checks