@samitouri / QOSamiQemu / commits / 93484c768f

linux-user: Don't define target_stat64 struct for loongarch64

The kernel defines 'struct stat64' only if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64). loongarch64 doesn't set __ARCH_WANT_STAT64, and it isn't 32-bit, so it won't get this struct. QEMU incorrectly does define a target_stat64 struct. However this isn't causing any guest-visible problems, because defining the target_stat64 struct and TARGET_HAS_STRUCT_STAT64 affects these syscalls: TARGET_NR_stat64 TARGET_NR_lstat64 TARGET_NR_fstat64 TARGET_NR_fstatat64 TARGET_NR_newfstatat For loongarch64 the only one of those we provide is newfstatat, and that is actually a separate QEMU bug, because the kernel does not provide that syscall for this architecture. No real guest code will be using a syscall that doesn't exist in the ABI. (Some of these syscalls are present in the loongarch64 "ABI1.0", but that ABI was never accepted in the upstream kernel, and QEMU does not model that ABI, only the "ABI2.0".) Stop defining TARGET_HAS_STRUCT_STAT64 anyway, for consistency with the kernel and to avoid confusion. Note: Commit message suggested by Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Gyorgy Tamasi <gyorgy.tamasi@gmail.com> Tested-by: Gyorgy Tamasi <gyorgy.tamasi@gmail.com> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Helge Deller <deller@gmx.de>

Gyorgy Tamasi committed Apr 8, 2026 at 20:17 UTC 93484c768f2b66947a91d6372f408ae01c83e8c6
1 file changed +1 -1
linux-user/syscall_defs.h
+1 -1
@@ -2005,7 +2005,7 @@ struct target_stat {
2005 abi_uint __unused5;
2006 };
2007
2008 -#if !defined(TARGET_RISCV64)
2008 +#if !defined(TARGET_RISCV64) && !defined(TARGET_LOONGARCH64)
2009 #define TARGET_HAS_STRUCT_STAT64
2010 struct target_stat64 {
2011 abi_ullong st_dev;