From bf8fed2cf54114e3b84753ec0167841634527472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= Date: Fri, 1 Sep 2023 15:34:18 +0100 Subject: [PATCH 1/2] qemu: update to 8.1.0. --- .../qemu/patches/fix-linux-user-ppc32.patch | 117 ---------- .../patches/fix-softfloat-fesetround.patch | 39 ---- srcpkgs/qemu/patches/gcc12.patch | 72 ------ srcpkgs/qemu/patches/lfs64.patch | 212 ++++++++++++++++++ srcpkgs/qemu/patches/mmap-mremap-efault.patch | 42 ---- .../qemu/patches/musl-initialize-msghdr.patch | 7 +- srcpkgs/qemu/patches/musl-ppc.patch | 25 --- srcpkgs/qemu/patches/musl-rlimit-rttime.patch | 13 -- srcpkgs/qemu/patches/xxx-ppcle.patch | 113 ---------- srcpkgs/qemu/template | 41 +--- 10 files changed, 223 insertions(+), 458 deletions(-) delete mode 100644 srcpkgs/qemu/patches/fix-linux-user-ppc32.patch delete mode 100644 srcpkgs/qemu/patches/fix-softfloat-fesetround.patch delete mode 100644 srcpkgs/qemu/patches/gcc12.patch create mode 100644 srcpkgs/qemu/patches/lfs64.patch delete mode 100644 srcpkgs/qemu/patches/mmap-mremap-efault.patch delete mode 100644 srcpkgs/qemu/patches/musl-ppc.patch delete mode 100644 srcpkgs/qemu/patches/musl-rlimit-rttime.patch delete mode 100644 srcpkgs/qemu/patches/xxx-ppcle.patch diff --git a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch b/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch deleted file mode 100644 index cd47435d5aa9a..0000000000000 --- a/srcpkgs/qemu/patches/fix-linux-user-ppc32.patch +++ /dev/null @@ -1,117 +0,0 @@ -commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c -Author: q66 -Date: Fri Jul 1 16:53:55 2022 +0200 - - fix linux-user build on 32-bit ppc - - Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61 - and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356 - -diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S -new file mode 100644 -index 0000000..e69de29 -diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c -index cf74b50..a36132c 100644 ---- a/common-user/safe-syscall-error.c -+++ b/common-user/safe-syscall-error.c -@@ -12,6 +12,7 @@ - #include "qemu/osdep.h" - #include "user/safe-syscall.h" - -+#if !defined(__powerpc__) || defined(__powerpc64__) - /* - * This is intended to be invoked via tail-call on the error path - * from the assembly in host/arch/safe-syscall.inc.S. This takes -@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value) - errno = value; - return -1; - } -+#endif -diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h -index 61a04e2..793fe84 100644 ---- a/include/user/safe-syscall.h -+++ b/include/user/safe-syscall.h -@@ -125,6 +125,8 @@ - * kinds of restartability. - */ - -+#if !defined(__powerpc__) || defined(__powerpc64__) -+ - /* The core part of this function is implemented in assembly */ - extern long safe_syscall_base(int *pending, long number, ...); - extern long safe_syscall_set_errno_tail(int value); -@@ -137,4 +139,10 @@ extern char safe_syscall_end[]; - safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \ - __VA_ARGS__) - -+#else -+ -+#define safe_syscall syscall -+ -+#endif -+ - #endif -diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h -new file mode 100644 -index 0000000..b80384d ---- /dev/null -+++ b/linux-user/include/host/ppc/host-signal.h -@@ -0,0 +1,38 @@ -+/* -+ * host-signal.h: signal info dependent on the host architecture -+ * -+ * Copyright (c) 2003-2005 Fabrice Bellard -+ * Copyright (c) 2021 Linaro Limited -+ * -+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. -+ * See the COPYING file in the top-level directory. -+ */ -+ -+#ifndef PPC_HOST_SIGNAL_H -+#define PPC_HOST_SIGNAL_H -+ -+/* The third argument to a SA_SIGINFO handler is ucontext_t. */ -+typedef ucontext_t host_sigcontext; -+ -+static inline uintptr_t host_signal_pc(host_sigcontext *uc) -+{ -+ return uc->uc_mcontext.regs->nip; -+} -+ -+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc) -+{ -+ uc->uc_mcontext.regs->nip = pc; -+} -+ -+static inline void *host_signal_mask(host_sigcontext *uc) -+{ -+ return &uc->uc_sigmask; -+} -+ -+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc) -+{ -+ return uc->uc_mcontext.regs->trap != 0x400 -+ && (uc->uc_mcontext.regs->dsisr & 0x02000000); -+} -+ -+#endif -diff --git a/linux-user/signal.c b/linux-user/signal.c -index 092e70b..b8dfa8a 100644 ---- a/linux-user/signal.c -+++ b/linux-user/signal.c -@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type, - /* Adjust the signal context to rewind out of safe-syscall if we're in it */ - static inline void rewind_if_in_safe_syscall(void *puc) - { -+#if !defined(__powerpc__) || defined(__powerpc64__) - host_sigcontext *uc = (host_sigcontext *)puc; - uintptr_t pcreg = host_signal_pc(uc); - -@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc) - && pcreg < (uintptr_t)safe_syscall_end) { - host_signal_set_pc(uc, (uintptr_t)safe_syscall_start); - } -+#endif - } - - static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) diff --git a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch b/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch deleted file mode 100644 index ecdd049f79212..0000000000000 --- a/srcpkgs/qemu/patches/fix-softfloat-fesetround.patch +++ /dev/null @@ -1,39 +0,0 @@ -Source: @pullmoll -Upstream: no -Reason: Target architectures with soft float do not define these constants. - ---- a/tests/fp/fp-bench.c 2020-12-08 17:59:44.000000000 +0100 -+++ b/tests/fp/fp-bench.c 2020-12-12 20:38:40.702235420 +0100 -@@ -485,16 +485,32 @@ - - switch (rounding) { - case ROUND_EVEN: -+#if defined(FE_TONEAREST) - rhost = FE_TONEAREST; -+#else -+ return; -+#endif - break; - case ROUND_ZERO: -+#if defined(FE_TOWARDZERO) - rhost = FE_TOWARDZERO; -+#else -+ return; -+#endif - break; - case ROUND_DOWN: -+#if defined(FE_DOWNWARD) - rhost = FE_DOWNWARD; -+#else -+ return; -+#endif - break; - case ROUND_UP: -+#if defined(FE_UPWARD) - rhost = FE_UPWARD; -+#else -+ return; -+#endif - break; - case ROUND_TIEAWAY: - die_host_rounding(rounding); diff --git a/srcpkgs/qemu/patches/gcc12.patch b/srcpkgs/qemu/patches/gcc12.patch deleted file mode 100644 index 2a4b2bd036096..0000000000000 --- a/srcpkgs/qemu/patches/gcc12.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001 -From: Bernhard Beschow -Date: Sat, 18 Mar 2023 19:59:31 +0100 -Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN" - -Fixes the Windows build under msys2 using GCC 12 which fails with the following -error: - - [184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj - FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj - "c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp - In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9, - from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34, - from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34, - from C:/msys64/mingw64/include/glib-2.0/glib.h:32, - from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32, - from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144, - from ../src/qga/vss-win32/install.cpp:13: - C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers - 1075 | # define G_NORETURN [[noreturn]] - | ^ - C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN' - 240 | extern G_NORETURN - | ^~~~~~~~~~ - C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type - 1075 | # define G_NORETURN [[noreturn]] - | ^ - C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN' - 240 | extern G_NORETURN - | ^~~~~~~~~~ - C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes] - 1075 | # define G_NORETURN [[noreturn]] - | ^ - C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN' - 240 | extern G_NORETURN - | ^~~~~~~~~~ - C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored - 1075 | # define G_NORETURN [[noreturn]] - | ^ - C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN' - 240 | extern G_NORETURN - | ^~~~~~~~~~ - cc1plus.exe: all warnings being treated as errors - -Apparently it also fixes the compilation with Clang 15 (see -https://gitlab.com/qemu-project/qemu/-/issues/1541 ). - -Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541 -Signed-off-by: Bernhard Beschow -Message-Id: <20230318185931.181659-1-shentey@gmail.com> -Reviewed-by: Peter Maydell -Signed-off-by: Thomas Huth ---- - include/qemu/osdep.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h -index f68b5d8708c..9eff0be95bd 100644 ---- a/include/qemu/osdep.h -+++ b/include/qemu/osdep.h -@@ -237,7 +237,7 @@ extern "C" { - * supports QEMU_ERROR, this will be reported at compile time; otherwise - * this will be reported at link time due to the missing symbol. - */ --extern G_NORETURN -+G_NORETURN extern - void QEMU_ERROR("code path is reachable") - qemu_build_not_reached_always(void); - #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__) --- -GitLab - diff --git a/srcpkgs/qemu/patches/lfs64.patch b/srcpkgs/qemu/patches/lfs64.patch new file mode 100644 index 0000000000000..095ab3dceadca --- /dev/null +++ b/srcpkgs/qemu/patches/lfs64.patch @@ -0,0 +1,212 @@ +Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions +anf macros behave same as their 64 suffixed counterparts. This also +helps in compiling with latest musl C library, where these macros and +functions are no more available under _GNU_SOURCE feature macro + +source: https://git.alpinelinux.org/aports/plain/community/qemu/lfs64.patch +-- + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index bbba2a6..38fa09a 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -6812,13 +6812,13 @@ static int target_to_host_fcntl_cmd(int cmd) + ret = cmd; + break; + case TARGET_F_GETLK: +- ret = F_GETLK64; ++ ret = F_GETLK; + break; + case TARGET_F_SETLK: +- ret = F_SETLK64; ++ ret = F_SETLK; + break; + case TARGET_F_SETLKW: +- ret = F_SETLKW64; ++ ret = F_SETLKW; + break; + case TARGET_F_GETOWN: + ret = F_GETOWN; +@@ -6834,13 +6834,13 @@ static int target_to_host_fcntl_cmd(int cmd) + break; + #if TARGET_ABI_BITS == 32 + case TARGET_F_GETLK64: +- ret = F_GETLK64; ++ ret = F_GETLK; + break; + case TARGET_F_SETLK64: +- ret = F_SETLK64; ++ ret = F_SETLK; + break; + case TARGET_F_SETLKW64: +- ret = F_SETLKW64; ++ ret = F_SETLKW; + break; + #endif + case TARGET_F_SETLEASE: +@@ -6894,8 +6894,8 @@ static int target_to_host_fcntl_cmd(int cmd) + * them to 5, 6 and 7 before making the syscall(). Since we make the + * syscall directly, adjust to what is supported by the kernel. + */ +- if (ret >= F_GETLK64 && ret <= F_SETLKW64) { +- ret -= F_GETLK64 - 5; ++ if (ret >= F_GETLK && ret <= F_SETLKW) { ++ ret -= F_GETLK - 5; + } + #endif + +@@ -6928,7 +6928,7 @@ static int host_to_target_flock(int type) + return type; + } + +-static inline abi_long copy_from_user_flock(struct flock64 *fl, ++static inline abi_long copy_from_user_flock(struct flock *fl, + abi_ulong target_flock_addr) + { + struct target_flock *target_fl; +@@ -6953,7 +6953,7 @@ static inline abi_long copy_from_user_flock(struct flock64 *fl, + } + + static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr, +- const struct flock64 *fl) ++ const struct flock *fl) + { + struct target_flock *target_fl; + short l_type; +@@ -6972,8 +6972,8 @@ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr, + return 0; + } + +-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr); +-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl); ++typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr); ++typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl); + + #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32 + struct target_oabi_flock64 { +@@ -6984,7 +6984,7 @@ struct target_oabi_flock64 { + abi_int l_pid; + } QEMU_PACKED; + +-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl, ++static inline abi_long copy_from_user_oabi_flock64(struct flock *fl, + abi_ulong target_flock_addr) + { + struct target_oabi_flock64 *target_fl; +@@ -7009,7 +7009,7 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl, + } + + static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr, +- const struct flock64 *fl) ++ const struct flock *fl) + { + struct target_oabi_flock64 *target_fl; + short l_type; +@@ -7029,7 +7029,7 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr, + } + #endif + +-static inline abi_long copy_from_user_flock64(struct flock64 *fl, ++static inline abi_long copy_from_user_flock64(struct flock *fl, + abi_ulong target_flock_addr) + { + struct target_flock64 *target_fl; +@@ -7054,7 +7054,7 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl, + } + + static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr, +- const struct flock64 *fl) ++ const struct flock *fl) + { + struct target_flock64 *target_fl; + short l_type; +@@ -7075,7 +7075,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr, + + static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) + { +- struct flock64 fl64; ++ struct flock fl64; + #ifdef F_GETOWN_EX + struct f_owner_ex fox; + struct target_f_owner_ex *target_fox; +@@ -7347,7 +7347,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1 + arg2 = arg3; + arg3 = arg4; + } +- return get_errno(truncate64(arg1, target_offset64(arg2, arg3))); ++ return get_errno(truncate(arg1, target_offset64(arg2, arg3))); + } + #endif + +@@ -7361,7 +7361,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1, + arg2 = arg3; + arg3 = arg4; + } +- return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3))); ++ return get_errno(ftruncate(arg1, target_offset64(arg2, arg3))); + } + #endif + +@@ -8597,7 +8597,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count) + void *tdirp; + int hlen, hoff, toff; + int hreclen, treclen; +- off64_t prev_diroff = 0; ++ off_t prev_diroff = 0; + + hdirp = g_try_malloc(count); + if (!hdirp) { +@@ -8650,7 +8650,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count) + * Return what we have, resetting the file pointer to the + * location of the first record not returned. + */ +- lseek64(dirfd, prev_diroff, SEEK_SET); ++ lseek(dirfd, prev_diroff, SEEK_SET); + break; + } + +@@ -8684,7 +8684,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count) + void *tdirp; + int hlen, hoff, toff; + int hreclen, treclen; +- off64_t prev_diroff = 0; ++ off_t prev_diroff = 0; + + hdirp = g_try_malloc(count); + if (!hdirp) { +@@ -8726,7 +8726,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count) + * Return what we have, resetting the file pointer to the + * location of the first record not returned. + */ +- lseek64(dirfd, prev_diroff, SEEK_SET); ++ lseek(dirfd, prev_diroff, SEEK_SET); + break; + } + +@@ -11157,7 +11157,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + return -TARGET_EFAULT; + } + } +- ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5))); ++ ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5))); + unlock_user(p, arg2, ret); + return ret; + case TARGET_NR_pwrite64: +@@ -11174,7 +11174,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + return -TARGET_EFAULT; + } + } +- ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5))); ++ ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5))); + unlock_user(p, arg2, 0); + return ret; + #endif +@@ -12034,7 +12034,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + case TARGET_NR_fcntl64: + { + int cmd; +- struct flock64 fl; ++ struct flock fl; + from_flock64_fn *copyfrom = copy_from_user_flock64; + to_flock64_fn *copyto = copy_to_user_flock64; + diff --git a/srcpkgs/qemu/patches/mmap-mremap-efault.patch b/srcpkgs/qemu/patches/mmap-mremap-efault.patch deleted file mode 100644 index 5a70e9658b300..0000000000000 --- a/srcpkgs/qemu/patches/mmap-mremap-efault.patch +++ /dev/null @@ -1,42 +0,0 @@ -Source: @pullmoll -Upstream: no -Reason: errno=EFAULT when the address passed to mremap(2) is not valid - -See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for -why we need to return errno as described in man mremap(2) from qemu-user-static. -Also speed up the loop when checking for increasing the mappings size to go -in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range. -diff --git linux-user/mmap.c linux-user/mmap.c -index 7e3b245..1e8d0f1 100644 ---- a/linux-user/mmap.c -+++ b/linux-user/mmap.c -@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, - !guest_range_valid_untagged(new_addr, new_size)) || - ((flags & MREMAP_MAYMOVE) == 0 && - !guest_range_valid_untagged(old_addr, new_size))) { -- errno = ENOMEM; -+ errno = EFAULT; - return -1; - } - -@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, - abi_ulong addr; - for (addr = old_addr + old_size; - addr < old_addr + new_size; -- addr++) { -+ addr += TARGET_PAGE_SIZE) { - prot |= page_get_flags(addr); - } -+ prot |= page_get_flags(old_addr + new_size - 1); - } - if (prot == 0) { - host_addr = mremap(g2h_untagged(old_addr), -@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, - } - } - } else { -- errno = ENOMEM; -+ errno = EFAULT; - host_addr = MAP_FAILED; - } - } diff --git a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch index 6d96b3511dafe..2c5cf4552ecfb 100644 --- a/srcpkgs/qemu/patches/musl-initialize-msghdr.patch +++ b/srcpkgs/qemu/patches/musl-initialize-msghdr.patch @@ -1,10 +1,10 @@ Source: https://github.com/void-linux/void-packages/issues/23557 -diff --git linux-user/syscall.c linux-user/syscall.c -index 945fc25..8d8b68a 100644 +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 14fdebd..de280af 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c -@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp, +@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp, int flags, int send) { abi_long ret, len; @@ -13,3 +13,4 @@ index 945fc25..8d8b68a 100644 abi_ulong count; struct iovec *vec; abi_ulong target_vec; + diff --git a/srcpkgs/qemu/patches/musl-ppc.patch b/srcpkgs/qemu/patches/musl-ppc.patch deleted file mode 100644 index 0b77aa8fc63d4..0000000000000 --- a/srcpkgs/qemu/patches/musl-ppc.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/linux-user/signal.c -+++ b/linux-user/signal.c -@@ -21,5 +21,9 @@ - #include "exec/gdbstub.h" - #include "hw/core/tcg-cpu-ops.h" - -+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */ -+#include -+#endif -+ - #include - #include ---- a/util/mmap-alloc.c -+++ b/util/mmap-alloc.c -@@ -25,6 +25,10 @@ - - #ifdef CONFIG_LINUX - #include -+/* musl undefs this on ppc and mips */ -+#ifndef MAP_SYNC -+#define MAP_SYNC 0x80000 -+#endif - #endif - - size_t qemu_fd_getpagesize(int fd) diff --git a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch b/srcpkgs/qemu/patches/musl-rlimit-rttime.patch deleted file mode 100644 index 0cbf9be36a8f1..0000000000000 --- a/srcpkgs/qemu/patches/musl-rlimit-rttime.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/linux-user/syscall.c -+++ b/linux-user/syscall.c -@@ -141,6 +141,10 @@ - #include "fd-trans.h" - #include "tcg/tcg.h" - -+#ifndef RLIMIT_RTTIME -+#define RLIMIT_RTTIME 15 -+#endif -+ - #ifndef CLONE_IO - #define CLONE_IO 0x80000000 /* Clone io context */ - #endif diff --git a/srcpkgs/qemu/patches/xxx-ppcle.patch b/srcpkgs/qemu/patches/xxx-ppcle.patch deleted file mode 100644 index 90b32b5e07cd8..0000000000000 --- a/srcpkgs/qemu/patches/xxx-ppcle.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001 -From: Daniel Kolesa -Date: Sun, 7 Mar 2021 01:47:42 +0100 -Subject: [PATCH] support ppcle architecture - ---- - configure | 14 ++++++++++++-- - configs/targets/ppcle-linux-user.mak | 4 ++++ - linux-user/ppc/target_syscall.h | 4 ++++ - scripts/qemu-binfmt-conf.sh | 6 +++++- - tests/tcg/configure.sh | 2 ++ - 5 files changed, 27 insertions(+), 3 deletions(-) - create mode 100644 configs/targets/ppcle-linux-user.mak - -diff --git a/configure b/configure -index 18c26e0..03d3e18 100755 ---- a/configure -+++ b/configure -@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then - cpu="ppc64" - fi - else -- cpu="ppc" -+ if check_define _LITTLE_ENDIAN ; then -+ cpu="ppcle" -+ else -+ cpu="ppc" -+ fi - fi - elif check_define __mips__ ; then - cpu="mips" -@@ -638,6 +642,9 @@ - - ppc) - CPU_CFLAGS="-m32" ;; -+ ppcle) -+ cpu="ppc" -+ CPU_CFLAGS="-m32 -mlittle-endian" ;; - ppc64) - CPU_CFLAGS="-m64 -mbig-endian" ;; - ppc64le) -diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak -new file mode 100644 -index 0000000..2259243 ---- /dev/null -+++ b/configs/targets/ppcle-linux-user.mak -@@ -0,0 +1,4 @@ -+TARGET_ARCH=ppc -+TARGET_SYSTBL_ABI=common,nospu,32 -+TARGET_SYSTBL=syscall.tbl -+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml -diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h -index b9c4b81..cf26497 100644 ---- a/linux-user/ppc/target_syscall.h -+++ b/linux-user/ppc/target_syscall.h -@@ -65,7 +65,11 @@ struct target_revectored_struct { - #define UNAME_MACHINE "ppc64le" - #endif - #else -+#if TARGET_BIG_ENDIAN - #define UNAME_MACHINE "ppc" -+#else -+#define UNAME_MACHINE "ppcle" -+#endif - #endif - #define UNAME_MINIMUM_RELEASE "2.6.32" - -diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh -index 9f1580a..393943f 100755 ---- a/scripts/qemu-binfmt-conf.sh -+++ b/scripts/qemu-binfmt-conf.sh -@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x - ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - ppc_family=ppc - -+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00' -+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00' -+ppc_family=ppcle -+ - ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15' - ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' - ppc64_family=ppc -@@ -148,7 +152,7 @@ qemu_get_family() { - "Power Macintosh"|ppc64|powerpc|ppc) - echo "ppc" - ;; -- ppc64el|ppc64le) -+ ppc64el|ppc64le|ppcel|ppcle) - echo "ppcle" - ;; - arm|armel|armhf|arm64|armv[4-9]*l|aarch64) -diff --git a/configure b/configure -index 72ab03f11a..0691929d76 100755 ---- a/configure -+++ b/configure -@@ -1866,6 +1866,7 @@ fi - : ${cross_prefix_mips="mips-linux-gnu-"} - : ${cross_prefix_nios2="nios2-linux-gnu-"} - : ${cross_prefix_ppc="powerpc-linux-gnu-"} -+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"} - : ${cross_prefix_ppc64="powerpc64-linux-gnu-"} - : ${cross_prefix_ppc64le="$cross_prefix_ppc64"} - : ${cross_prefix_riscv64="riscv64-linux-gnu-"} -@@ -1883,6 +1884,7 @@ fi - : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"} - : ${cross_cc_cflags_i386="-m32"} - : ${cross_cc_cflags_ppc="-m32 -mbig-endian"} -+: ${cross_cc_cflags_ppcle="-m32"} - : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"} - : ${cross_cc_ppc64le="$cross_cc_ppc64"} - : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"} -2.30.1 - diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template index 48ab199e5686b..35d4c67ae2471 100644 --- a/srcpkgs/qemu/template +++ b/srcpkgs/qemu/template @@ -1,8 +1,8 @@ # Template file for 'qemu' # This package should be updated together with qemu-user-static pkgname=qemu -version=7.1.0 -revision=2 +version=8.1.0 +revision=1 build_style=configure configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie @@ -10,7 +10,7 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca --audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa) $(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard) $(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')" -hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja" +hostmakedepends="flex gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja" makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel @@ -25,17 +25,17 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de $(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')" short_desc="Open Source Processor Emulator" maintainer="Orphaned " -license="GPL-2.0-or-later, LGPL-2.1-or-later" +license="GPL-2.0-only, LGPL-2.1-only" homepage="https://www.qemu.org" distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2" -checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0 +checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624 ignore_elf_dirs="/usr/share/qemu" nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64 palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf opensbi-riscv64-generic-fw_dynamic.elf" -build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio" -build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio" +build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl" +build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl" desc_option_sdl2="Enable SDL (2.x) video output" desc_option_spice="Enable support for SPICE" desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)" @@ -43,37 +43,10 @@ desc_option_smartcard="Enable smartcard support" desc_option_numa="Enable support for host NUMA" desc_option_iscsi="Enable support for iSCSI" -case "$XBPS_TARGET_MACHINE" in - aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";; -esac - -if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then - build_options_default+=" spice" -fi - if [ "$CROSS_BUILD" ]; then configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-" -else - build_options_default+=" smartcard" -fi - -if [ "$XBPS_CHECK_PKGS" != full ]; then - make_check_target=check-unit fi -post_extract() { - if [ "$XBPS_TARGET_LIBC" = "musl" ]; then - grep -rl 'Input/output error' tests/qemu-iotests | - xargs -n1 sed -i -e 's;Input/output error;I/O error;g' - grep -rl 'Operation not supported' tests/qemu-iotests | - xargs -n1 sed -i -e 's;Operation not supported;Not supported;g' - fi -} - -pre_configure() { - unset CPP -} - post_install() { vdoc "${FILESDIR}/README.voidlinux" From 03fa5482ffd514f24c994e0965cc39f59365a3a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= Date: Fri, 1 Sep 2023 18:31:29 +0100 Subject: [PATCH 2/2] qemu-user-static: update to 8.1.0. --- srcpkgs/qemu-user-static/template | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/srcpkgs/qemu-user-static/template b/srcpkgs/qemu-user-static/template index 2a8da9b53f2d5..fa09affc73bf8 100644 --- a/srcpkgs/qemu-user-static/template +++ b/srcpkgs/qemu-user-static/template @@ -1,20 +1,20 @@ # Template file for 'qemu-user-static' # This package should be updated together with qemu pkgname=qemu-user-static -version=7.1.0 -revision=3 +version=8.1.0 +revision=1 build_style=configure configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --disable-kvm --disable-png --disable-virtfs --disable-fdt --disable-seccomp --enable-linux-user --disable-system --static --disable-pie" -hostmakedepends="pkg-config perl python3 ninja" +hostmakedepends="flex pkg-config perl python3 ninja" makedepends="dtc-devel libglib-devel pixman-devel libuuid-devel" short_desc="QEMU User-mode emulators (statically compiled)" maintainer="Orphaned " -license="GPL-2.0-or-later, LGPL-2.1-or-later" +license="GPL-2.0-only, LGPL-2.1-only" homepage="https://www.qemu.org" distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2" -checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0 +checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624 _fmts="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze microblazeel mips mipsel mips64 mips64el mipsn32 mipsn32el or1k @@ -111,10 +111,6 @@ done binfmts="${binfmts%?}" -pre_configure() { - unset CPP -} - post_install() { # Remove unneeded stuff. rm -rf ${DESTDIR}/etc ${DESTDIR}/usr/share ${DESTDIR}/usr/libexec