package/jailhouse: backport gcc-15/std c23 from imx-jailhouse fork

The jailhouse runtime test doesn't build since the last ARM aarch64
toolchain version bump [1]. This new gcc 15 compiler use a new C
standard by default (c23) but since the jailhouse build system
doesn't specify any versions of the C standard, so it doesn't build
with gcc 15.

As reported by John Ernberg on the mailing list [2], jailhouse git
repository has not seen any activity since 2023.

As suggested by Julien Olivain and Peter Korsgaard [3] backport gcc-15/stdc
23 fix from imx-jailhouse fork as a short term solution.

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/14622843463

[1] 8d413d6179
[2] https://lore.kernel.org/buildroot/20260601204735.888967-8-j@j-ernberg.se/
[3] https://lore.kernel.org/buildroot/878q8uk9qf.fsf@dell.be.48ers.dk/

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Romain Naour
2026-06-05 20:14:20 +02:00
committed by Peter Korsgaard
parent 35b57a0787
commit aef531162c
2 changed files with 157 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
From da2aa3c97fe9a374709c4bddf9b55253d53e1350 Mon Sep 17 00:00:00 2001
From: Tom Hochstein <tom.hochstein@nxp.com>
Date: Thu, 12 Jun 2025 06:49:58 -0700
Subject: [PATCH] YOCIMX-9281-1: Fix gcc15 errors
Fix several instances of the following errors:
```
| inmates/lib/include/inmate_common.h:87:16: error: cannot use keyword 'true' as enumeration constant
| 87 | typedef enum { true = 1, false = 0 } bool;
| | ^~~~
```
```
| In file included from configs/arm64/hikey.c:16:
| include/jailhouse/cell-config.h:318:41: error: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (6 chars into 5 available) [-Werror=unterminated-string-initialization]
| 318 | #define JAILHOUSE_SYSTEM_SIGNATURE "JHSYS"
| | ^~~~~~~
| configs/arm64/hikey.c:26:30: note: in expansion of macro 'JAILHOUSE_SYSTEM_SIGNATURE'
| 26 | .signature = JAILHOUSE_SYSTEM_SIGNATURE,
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~
```
Upstream: https://github.com/nxp-imx/imx-jailhouse/commit/2be7793ca658015470fe0d60c0c973e12ce68d73
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
[Romain:
use "__STDC_VERSION__ < 202311L" as suggested by Peter Korsgaard
https://lore.kernel.org/buildroot/878q8uk9qf.fsf@dell.be.48ers.dk/
]
Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
hypervisor/include/jailhouse/header.h | 2 +-
hypervisor/include/jailhouse/types.h | 2 ++
include/jailhouse/cell-config.h | 4 ++--
include/jailhouse/hypercall.h | 2 +-
inmates/lib/include/inmate_common.h | 2 ++
5 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/hypervisor/include/jailhouse/header.h b/hypervisor/include/jailhouse/header.h
index 518bc5cb..324eb94b 100644
--- a/hypervisor/include/jailhouse/header.h
+++ b/hypervisor/include/jailhouse/header.h
@@ -55,7 +55,7 @@ struct jailhouse_header {
/** Signature "JAILHOUS" used for basic validity check of the
* hypervisor image.
* @note Filled at build time. */
- char signature[8];
+ char signature[8] __attribute__ ((nonstring));
/** Size of hypervisor core.
* It starts with the hypervisor's header and ends after its bss
* section. Rounded up to page boundary.
diff --git a/hypervisor/include/jailhouse/types.h b/hypervisor/include/jailhouse/types.h
index 6d78ad6d..80f2a9ca 100644
--- a/hypervisor/include/jailhouse/types.h
+++ b/hypervisor/include/jailhouse/types.h
@@ -19,7 +19,9 @@
#ifndef __ASSEMBLY__
+#if __STDC_VERSION__ < 202311L
typedef enum { true = 1, false = 0 } bool;
+#endif
/** Describes a CPU set. */
struct cpu_set {
diff --git a/include/jailhouse/cell-config.h b/include/jailhouse/cell-config.h
index 17d59306..affce1c2 100644
--- a/include/jailhouse/cell-config.h
+++ b/include/jailhouse/cell-config.h
@@ -91,7 +91,7 @@
* structure.
*/
struct jailhouse_cell_desc {
- char signature[5];
+ char signature[5] __attribute__ ((nonstring));
__u8 architecture;
__u16 revision;
@@ -330,7 +330,7 @@ struct jailhouse_pio {
* General descriptor of the system.
*/
struct jailhouse_system {
- char signature[5];
+ char signature[5] __attribute__ ((nonstring));
__u8 architecture;
__u16 revision;
diff --git a/include/jailhouse/hypercall.h b/include/jailhouse/hypercall.h
index 07574d3d..cf58a4c9 100644
--- a/include/jailhouse/hypercall.h
+++ b/include/jailhouse/hypercall.h
@@ -107,7 +107,7 @@
#define COMM_REGION_GENERIC_HEADER \
/** Communication region magic JHCOMM */ \
- char signature[6]; \
+ char signature[6] __attribute__ ((nonstring)); \
/** Communication region ABI revision */ \
__u16 revision; \
/** Cell state, initialized by hypervisor, updated by cell. */ \
diff --git a/inmates/lib/include/inmate_common.h b/inmates/lib/include/inmate_common.h
index 1c20a0af..cae2a673 100644
--- a/inmates/lib/include/inmate_common.h
+++ b/inmates/lib/include/inmate_common.h
@@ -84,7 +84,9 @@ typedef u32 __u32;
typedef s64 __s64;
typedef u64 __u64;
+#if __STDC_VERSION__ < 202311L
typedef enum { true = 1, false = 0 } bool;
+#endif
#include <jailhouse/hypercall.h>
--
2.54.0

View File

@@ -0,0 +1,38 @@
From bc09bd33a23f9599b0cb4596a0b7f5c601a74c75 Mon Sep 17 00:00:00 2001
From: Peng Fan <peng.fan@nxp.com>
Date: Mon, 25 Aug 2025 09:48:05 +0800
Subject: [PATCH] YOCIMX-9281-2: hypervisor: arm64: fix strh usage
hypervisor/arch/arm64/entry.S:555: Error: immediate offset out of range
Per ARM spec:
STRH (immediate)
<pimm> Is the optional positive immediate byte offset, a multiple of 2 in
the range 0 to 8190, defaulting to 0 and encoded in the "imm12" field
as <pimm>/2.
So align sdei_event to 2 bytes aligned.
Upstream: https://github.com/nxp-imx/imx-jailhouse/commit/98f6f8dc23d6b3d4fe5b15045ccb3d3ef36747be
Signed-off-by: Peng Fan <peng.fan@nxp.com>
[Romain: rebase on top of latest commit on upstream repo
https://github.com/siemens/jailhouse/commit/e57d1eff6d55aeed5f977fe4e2acfb6ccbdd7560]
Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
hypervisor/arch/arm64/include/asm/percpu_fields.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hypervisor/arch/arm64/include/asm/percpu_fields.h b/hypervisor/arch/arm64/include/asm/percpu_fields.h
index 67573fd6..118d69d0 100644
--- a/hypervisor/arch/arm64/include/asm/percpu_fields.h
+++ b/hypervisor/arch/arm64/include/asm/percpu_fields.h
@@ -13,4 +13,4 @@
#define ARCH_PERCPU_FIELDS \
ARM_PERCPU_FIELDS \
unsigned long id_aa64mmfr0; \
- bool sdei_event;
+ bool sdei_event __attribute__((aligned(2)));
--
2.54.0