From: Gyorgy Tamasi <[email protected]> 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 <[email protected]> Signed-off-by: Gyorgy Tamasi <[email protected]> Tested-by: Gyorgy Tamasi <[email protected]> Reviewed-by: Pierrick Bouvier <[email protected]> Reviewed-by: Peter Maydell <[email protected]> Signed-off-by: Helge Deller <[email protected]> (cherry picked from commit 93484c768f2b66947a91d6372f408ae01c83e8c6) Signed-off-by: Michael Tokarev <[email protected]> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index b5a2ad3b2d..86bdf88be7 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2003,7 +2003,7 @@ struct target_stat { abi_uint __unused5; }; -#if !defined(TARGET_RISCV64) +#if !defined(TARGET_RISCV64) && !defined(TARGET_LOONGARCH64) #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { abi_ullong st_dev; -- 2.47.3
