diff mbox series

[v3] systemd: fix musl build by fixing limits.h override

Message ID 20260924110424.674180-1-ross.burton@arm.com
State New
Headers show
Series [v3] systemd: fix musl build by fixing limits.h override | expand

Commit Message

Ross Burton Sept. 24, 2026, 11:04 a.m. UTC
From: Jaipaul Cheernam <jaipaul.cheernam@est.tech>

Backport the upstream fix for the limits.h override, which breaks GCC's
<limits.h> include cycle (notably GCC 16.x) and fails musl builds.

Upstream fix: https://github.com/systemd/systemd/pull/43831
(cherry picked from commit 4e08fdf59ffcafef6ca2df6342101e7e82b6183b)

[ changed SRC_URI addition to not use overrides - RB ]

Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 .../0001-include-fix-limits.h-override.patch  | 47 +++++++++++++++++++
 meta/recipes-core/systemd/systemd_261.3.bb    |  1 +
 2 files changed, 48 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd/0001-include-fix-limits.h-override.patch

Comments

Jaipaul Cheernam Sept. 24, 2026, 1 p.m. UTC | #1
On 2026-09-24 13:04, Ross Burton via lists.openembedded.org wrote:
> +From: Yu Watanabe<watanabe.yu+github@gmail.com>
> +Date: Tue, 22 Sep 2026 01:55:01 +0900
> +Subject: [PATCH] include: fix limits.h override
> +
> +This is especially necessary since GCC 16.x.
> +
> +Replaces #43824.
> +
> +(cherry picked from commit 4e08fdf59ffcafef6ca2df6342101e7e82b6183b)


Hi Ross,


I will send V4 as submitter changed the commit message

https://github.com/systemd/systemd/pull/43831/changes/4065fa34a8c9a00ddd7802d1b00bbb6ca2d0cc45


Content wise nothing changed only commit message.


Regards,

Jaipaul
diff mbox series

Patch

diff --git a/meta/recipes-core/systemd/systemd/0001-include-fix-limits.h-override.patch b/meta/recipes-core/systemd/systemd/0001-include-fix-limits.h-override.patch
new file mode 100644
index 00000000000..6316b3ddf61
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-include-fix-limits.h-override.patch
@@ -0,0 +1,47 @@ 
+From 4e08fdf59ffcafef6ca2df6342101e7e82b6183b Mon Sep 17 00:00:00 2001
+From: Yu Watanabe <watanabe.yu+github@gmail.com>
+Date: Tue, 22 Sep 2026 01:55:01 +0900
+Subject: [PATCH] include: fix limits.h override
+
+This is especially necessary since GCC 16.x.
+
+Replaces #43824.
+
+(cherry picked from commit 4e08fdf59ffcafef6ca2df6342101e7e82b6183b)
+
+Upstream-Status: Backport [https://github.com/systemd/systemd/pull/43831]
+Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
+---
+ src/include/musl/limits.h | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+diff --git a/src/include/musl/limits.h b/src/include/musl/limits.h
+index 9620a3b0acc..cffb8ddd274 100644
+--- a/src/include/musl/limits.h
++++ b/src/include/musl/limits.h
+@@ -1,6 +1,25 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+ 
++/* GCC introduces a spurious, tricky inclusion cycle:
++ *    GCC's limits.h
++ *      -> GCC's syslimits.h
++ *         -> GCC's limits.h (again!!!)
++ *            -> glibc/musl's limits.h
++ *               -> define POSIX defines
++ *      -> define ISO C defines
++ * This works only when GCC's limits.h is included first, but a user override breaks the cycle. Hence, we
++ * need to manually achieve the cycle here. If GCC is not used (e.g., Clang), then including the compiler's
++ * limits.h twice should be redundant but harmless. */
++
++/* First, get the POSIX defines from glibc/musl's limits.h. When the two macros below are defined, GCC's
++ * limits.h includes the next limits.h, that is, one from glibc/musl. */
++#define _GCC_LIMITS_H_
++#define _GCC_NEXT_LIMITS_H
++#include_next <limits.h>        /* IWYU pragma: export */
++
++/* Next, get the ISO C defines from GCC's limits.h. */
++#undef _GCC_LIMITS_H_
+ #include_next <limits.h>        /* IWYU pragma: export */
+ 
+ #include <assert.h>
diff --git a/meta/recipes-core/systemd/systemd_261.3.bb b/meta/recipes-core/systemd/systemd_261.3.bb
index 1a256a598a8..0901736e7c9 100644
--- a/meta/recipes-core/systemd/systemd_261.3.bb
+++ b/meta/recipes-core/systemd/systemd_261.3.bb
@@ -36,6 +36,7 @@  SRC_URI += "file://touchscreen.rules \
            file://systemd-pager.sh \
            file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
            file://0003-Do-not-create-var-log-README.patch \
+           file://0001-include-fix-limits.h-override.patch \
            "
 
 PAM_PLUGINS = " \