Linux user next patches
From: Helge Deller <[email protected]>
The following changes since commit d7a65d1793d691d356a56833620f7d1e6f5d653b:
Merge tag 'hppa-a400-updates-pull-request' of https://github.com/hdeller/qemu-hppa into staging (2026-10-03 14:17:49 +0200)
are available in the Git repository at:
https://github.com/hdeller/qemu-hppa.git tags/linux-user-next-pull-request
for you to fetch changes up to 8e021b85cc06caec24a24302aa68f040a0970c12:
linux-user/mips: pick Loongson-3A4000 if a pre-r6 mips64 binary needs nan2008 (2026-10-04 13:32:14 +0200)
----------------------------------------------------------------
linux user patches
Some patches for linux-user, which
- make it possible to run pre-r6 mips64 binaries that need nan2008 without requiring the user to explicitly set a compatible -cpu, and
- copy the executable's e_flags into core dumps on mips and riscv
----------------------------------------------------------------
Alex Rønne Petersen (2):
target/mips: fix Loongson-3A4000 definition to have abs2008 and
nan2008
linux-user/mips: pick Loongson-3A4000 if a pre-r6 mips64 binary needs
nan2008Matt Turner (3):
linux-user: add elf_core_eflags() hook for core dump e_flags linux-user/mips64: set EF_MIPS_ABI2 in mipsn32 core dumps linux-user/riscv: copy the executable's e_flags into core dumps
linux-user/elfload.c | 7 ++++++- linux-user/mips/elfload.c | 14 ++++++++------ linux-user/mips64/target_elf.h | 2 ++ linux-user/riscv/target_elf.h | 3 +++ target/mips/cpu-defs.c.inc | 4 ++-- 5 files changed, 21 insertions(+), 9 deletions(-)
Signature · 1 line
2.54.0
[PULL 4/5] target/mips: fix Loongson-3A4000 definition to have abs2008 and nan2008
From: Alex Rønne Petersen <[email protected]>
Checked on a Loongson 3B4000; this uarch operates in 2008 mode.
--- target/mips/cpu-defs.c.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/mips/cpu-defs.c.inc +2 -2
@@ -941,8 +941,8 @@ const mips_def_t mips_defs[] = (1 << CP0PG_ELPA) | (1 << CP0PG_IEC), .CP1_fcr0 = (0x5 << FCR0_PRID) | (0x1 << FCR0_REV) | (0x1 << FCR0_F64) | (0x1 << FCR0_PS) | (0x1 << FCR0_L) | (0x1 << FCR0_W) | - (0x1 << FCR0_D) | (0x1 << FCR0_S), - .CP1_fcr31 = 0, + (0x1 << FCR0_D) | (0x1 << FCR0_S) | (0x1 << FCR0_HAS2008), + .CP1_fcr31 = (1 << FCR31_ABS2008) | (1 << FCR31_NAN2008), .CP1_fcr31_rw_bitmask = 0xFF83FFFF, .MSAIR = (0x01 << MSAIR_ProcID) | (0x40 << MSAIR_Rev), .lcsr_cpucfg1 = (1 << CPUCFG1_FP) | (2 << CPUCFG1_FPREV) |
Signature · 1 line
2.54.0
[PULL 1/5] linux-user: add elf_core_eflags() hook for core dump e_flags
In reply to Helge DellerFrom: Matt Turner <[email protected]>
Let targets set e_flags in the core file header. Default to 0, as before.
--- linux-user/elfload.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
linux-user/elfload.c +6 -1
@@ -144,6 +144,10 @@ typedef abi_int target_pid_t;#define EXSTACK_DEFAULT false#endif +#ifndef elf_core_eflags +#define elf_core_eflags (info) 0 +#endif +/* * Provide fallback definitions that the target may omit. * One way or another, we'll get a link error if the setting of
@@ -2212,7 +2216,8 @@ static int elf_core_dump(int signr, const CPUArchState *env)/* Create elf file header. */ hptr = header; -fill_elf_header (hptr, css.count +1 ,ELF_MACHINE ,0 ); +fill_elf_header (hptr, css.count +1 ,ELF_MACHINE , +elf_core_eflags (ts->info)); hptr +=sizeof (struct elfhdr );/* Create elf program headers. */
Signature · 1 line
2.54.0
[PULL 3/5] linux-user/riscv: copy the executable's e_flags into core dumps
In reply to Helge DellerFrom: Matt Turner <[email protected]>
Since commit 8c94db0ae97c ("binfmt_elf: preserve original ELF e_flags for core dumps"), Linux writes the main executable's e_flags into RISC-V core files, so debuggers can see the float ABI and RVC. QEMU wrote 0.
--- linux-user/riscv/target_elf.h | 3 +++ 1 file changed, 3 insertions(+)
linux-user/riscv/target_elf.h +3 -0
@@ -21,6 +21,9 @@#define HAVE_ELF_HWCAP 1#define HAVE_ELF_CORE_DUMP 1 +/* See linux kernel: ARCH_HAS_ELF_CORE_EFLAGS. */ +#define elf_core_eflags (info) ((info)->elf_flags) +/* Mirrors struct user_regs_struct: pc followed by x1 (ra) .. x31 (t6). */ typedef struct target_elf_gregset_t { abi_ulong pc;
Signature · 1 line
2.54.0
[PULL 5/5] linux-user/mips: pick Loongson-3A4000 if a pre-r6 mips64 binary needs nan2008
In reply to Helge DellerFrom: Alex Rønne Petersen <[email protected]>
Before this patch, we'd pick MIPS64R2-generic which does not have 2008 mode, so the binary would just fail to run without an explicit -cpu flag. Now it'll just work as in the pre-r6 mips32 case.
--- linux-user/mips/elfload.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
linux-user/mips/elfload.c +8 -6
@@ -20,17 +20,19 @@ const char *get_elf_cpu_model(uint32_t eflags)case EF_MIPS_MACH_LS2F :return "Loongson-2F" ;case EF_MIPS_MACH_LS3A : -return "Loongson-3A1000" ; +return (eflags &EF_MIPS_NAN2008 ) ?"Loongson-3A4000" + :"Loongson-3A1000" ;default : break; } -switch (eflags &EF_MIPS_ARCH ) { -case EF_MIPS_ARCH_64R6 : +if ((eflags &EF_MIPS_ARCH ) ==EF_MIPS_ARCH_64R6 ) {return "I6400" ; -case EF_MIPS_ARCH_64R2 : + } +if (eflags &EF_MIPS_NAN2008 ) { +return "Loongson-3A4000" ; + } +if ((eflags &EF_MIPS_ARCH ) ==EF_MIPS_ARCH_64R2 ) {return "MIPS64R2-generic" ; -default : -break ; }return "5KEf" ;#else
Signature · 1 line
2.54.0
[PULL 2/5] linux-user/mips64: set EF_MIPS_ABI2 in mipsn32 core dumps
In reply to Helge DellerFrom: Matt Turner <[email protected]>
mipsn32 core files had e_flags 0, so gdb took them for o32, found no general-purpose registers and failed with an internal error in frame_unwind_find_by_frame.
Linux sets e_flags to EF_MIPS_ABI2 for n32 cores (user_mipsn32_view in arch/mips/kernel/ptrace.c).
--- linux-user/mips64/target_elf.h | 2 ++ 1 file changed, 2 insertions(+)
linux-user/mips64/target_elf.h +2 -0
@@ -16,6 +16,8 @@#ifdef TARGET_ABI_MIPSN32 #define elf_check_abi (x) ((x) & EF_MIPS_ABI2) +/* See linux kernel: arch/mips/kernel/ptrace.c, user_mipsn32_view. */ +#define elf_core_eflags (info) EF_MIPS_ABI2#else #define elf_check_abi (x) (!((x) & EF_MIPS_ABI2))#endif
Signature · 1 line
2.54.0
Richard Henderson
AppliedQuoted 14 lines · Helge Deller
From: Helge Deller<[email protected]>
The following changes since commit
d7a65d1793d691d356a56833620f7d1e6f5d653b:Merge tag 'hppa-a400-updates-pull-request' ofhttps://github.com/hdeller/qemu-hppa into staging (2026-10-03 14:17:49 +0200)are available in the Git repository at:
https://github.com/hdeller/qemu-hppa.git tags/linux-user-next-pull-request
for you to fetch changes up to
8e021b85cc06caec24a24302aa68f040a0970c12:linux-user/mips: pick Loongson-3A4000 if a pre-r6 mips64 binary needs nan2008 (2026-10-04 13:32:14 +0200)
Quoted 7 lines
----------------------------------------------------------------
linux user patchesSome patches for linux-user, which
- make it possible to run pre-r6 mips64 binaries that need nan2008 without requiring the user to explicitly set a compatible -cpu, and
- copy the executable'se_flagsinto core dumps on mips and riscv
Applied, thanks.
r~