Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [RFC] package/qemu: fix build on mips* and powerpc*
@ 2023-06-14 15:26 Romain Naour
  2026-11-20 22:06 ` Angelo Compagnucci
  0 siblings, 1 reply; 2+ messages in thread
From: Romain Naour @ 2023-06-14 15:26 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

linux/mman.h define MAP_SYNC (0x0) as legacy / undefined architecture
specific flags to be ignored by mmap handling code [1].

But MAP_SYNC may be undef by musl toolchain arch/<arch>/bits/mman.h
header [2] when targets (mips*, powerpc*) are not using
asm-generic/mman.h to have MAP_SYNC defined.

Fixes:
http://autobuild.buildroot.org/results/dbd/dbdba73b0adeaeebb97da146e7df6c2cd0b48422
http://autobuild.buildroot.org/results/287/287b4e8e77914a6181cab2b632b7e3412c3b781b

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b6fb293f2497a9841d94f6b57bd2bb2cd222da43
[2] https://git.musl-libc.org/cgit/musl/commit/?id=9b57db3f958d9adc3b1c7371b5c6723aaee448b7

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
I believe it may be a musl toolchain issue when MAP_SYNC is undef from musl's
bits/mman.h header. I'm not sure that qemu (upstream) should handle this issue
from util/mmap-alloc.c.
---
 ...-alloc-fix-build-on-mips-and-powerpc.patch | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 package/qemu/0003-util-mmap-alloc-fix-build-on-mips-and-powerpc.patch

diff --git a/package/qemu/0003-util-mmap-alloc-fix-build-on-mips-and-powerpc.patch b/package/qemu/0003-util-mmap-alloc-fix-build-on-mips-and-powerpc.patch
new file mode 100644
index 0000000000..528ba3dc78
--- /dev/null
+++ b/package/qemu/0003-util-mmap-alloc-fix-build-on-mips-and-powerpc.patch
@@ -0,0 +1,52 @@
+From e244dbccc229c9973b900f1ca4b8c3b61f5305b4 Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@smile.fr>
+Date: Tue, 13 Jun 2023 23:27:07 +0200
+Subject: [PATCH] util/mmap-alloc: fix build on mips* and powerpc*
+
+linux/mman.h define MAP_SYNC (0x0) as legacy / undefined architecture
+specific flags to be ignored by mmap handling code [1].
+
+But MAP_SYNC may be undef by musl toolchain arch/<arch>/bits/mman.h
+header [2] when targets (mips*, powerpc*) are not using
+asm-generic/mman.h to have MAP_SYNC defined.
+
+Fixes:
+http://autobuild.buildroot.org/results/dbd/dbdba73b0adeaeebb97da146e7df6c2cd0b48422
+http://autobuild.buildroot.org/results/287/287b4e8e77914a6181cab2b632b7e3412c3b781b
+
+[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b6fb293f2497a9841d94f6b57bd2bb2cd222da43
+[2] https://git.musl-libc.org/cgit/musl/commit/?id=9b57db3f958d9adc3b1c7371b5c6723aaee448b7
+
+Upstream: not submitted
+
+Signed-off-by: Romain Naour <romain.naour@smile.fr>
+---
+I believe it may be a musl toolchain issue when MAP_SYNC is undef from musl's
+bits/mman.h header. I'm not sure that qemu (upstream) should handle this issue
+from util/mmap-alloc.c.
+---
+ util/mmap-alloc.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c
+index 5ed7d29183..a3994b8610 100644
+--- a/util/mmap-alloc.c
++++ b/util/mmap-alloc.c
+@@ -25,6 +25,14 @@
+ 
+ #define HUGETLBFS_MAGIC       0x958458f6
+ 
++/* MAP_SYNC may be undef by musl toolchain arch/<arch>/bits/mman.h
++ * header when targets (mips*, powerpc*) are not using
++ * asm-generic/mman.h to have MAP_SYNC defined.
++ */
++#ifndef MAP_SYNC
++#define MAP_SYNC 0x0
++#endif
++
+ #ifdef CONFIG_LINUX
+ #include <sys/vfs.h>
+ #endif
+-- 
+2.40.1
+
-- 
2.40.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-20 22:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-14 15:26 [Buildroot] [RFC] package/qemu: fix build on mips* and powerpc* Romain Naour
2026-11-20 22:06 ` Angelo Compagnucci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox