systemd/systemd: enable bootloader support on 32-bit architecture

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8718>
This commit is contained in:
Yu Watanabe
2026-06-15 13:42:37 +09:00
parent 87c4c8c4e0
commit 0bc8f74905
2 changed files with 49 additions and 2 deletions
@@ -0,0 +1,46 @@
From ca0c28b968d5b5c410784c60df37beaefaa72e96 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Mon, 15 Jun 2026 13:03:00 +0900
Subject: [PATCH] musl: fix build on 32-bit architecture
```
../src/boot/test-efi-string.c: In function 'test_xvasprintf_status':
../src/boot/test-efi-string.c:744:34: error: format '%zi' expects argument of type 'signed size_t', but argument 4 has type 'long int' [-Werror=format=]
744 | test_printf_one("%i %i %zi", INT_MIN, INT_MAX, SSIZE_MAX);
| ~~^
| |
| int
| %li
cc1: some warnings being treated as errors
ninja: subcommand failed
```
---
src/include/musl/limits.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100644 src/include/musl/limits.h
diff --git a/src/include/musl/limits.h b/src/include/musl/limits.h
new file mode 100644
index 0000000000..c00934c3d3
--- /dev/null
+++ b/src/include/musl/limits.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#define __NEED_ssize_t
+#include_next <limits.h>
+
+#include <assert.h>
+
+/* musl defines SSIZE_MAX as LONG_MAX, so its type is always long. However, on 32-bit architectures, musl
+ * defines ssize_t as int. Strictly speaking, this is not a bug in musl. POSIX only requires SSIZE_MAX to
+ * evaluate to the maximum value representable by ssize_t; it does not require SSIZE_MAX itself to have type
+ * ssize_t. However, our code assumes that SSIZE_MAX has type ssize_t, as is the case with glibc. Cast the
+ * value explicitly so that SSIZE_MAX has type ssize_t. */
+static_assert(SSIZE_MAX == LONG_MAX, "");
+#undef SSIZE_MAX
+#define SSIZE_MAX ((ssize_t) LONG_MAX)
--
2.54.0
+3 -2
View File
@@ -190,6 +190,7 @@ subpackages="
"
source="$pkgname-$pkgver.tar.gz::https://github.com/systemd/systemd/archive/refs/tags/v$_pkgver.tar.gz
0001-musl-fix-build-on-32-bit-architecture.patch
wired.network
"
builddir="$srcdir/$pkgname-$_pkgver"
@@ -219,8 +220,7 @@ build() {
local bootloader="enabled"
case "$CARCH" in
# ppc64le s390x: no EFI support
# armv7 x86: build broken for 32-bit
armv7|ppc64le|s390x|x86) bootloader="disabled" ;;
ppc64le|s390x) bootloader="disabled" ;;
esac
# TODO: after usr-merge completion: remove hardcoded "-D*-path" options
@@ -568,5 +568,6 @@ _resolve_packages() {
sha512sums="
facbcb7831fb84a38eaee5804d9aa03382486006cdb559010d6d353ad9a3986b516522cde1f0e0808fb49365859f790dd1caed24875a1c9e339e892d09d2cf30 systemd-261_rc3.tar.gz
a060c2d4eca986fdb7940a5330f91fbeee5ca27ea809cb2005a2b4ea301a441c74157644638c7b17de200751cb0d94fbe6034568d3f7977969ebe510e58853f1 0001-musl-fix-build-on-32-bit-architecture.patch
81c897fed8a3fbfb67ec591b2398a5d65e4af1b3ef379376c157c98d71f085b707f8ebc896d5571a94f99f8fc84fd6b43e3b879ca9b0d57fc6c4596034c7a777 wired.network
"