linux-user: Fix wrong use of stat instead of stat64 for sparc64
PATCH 1/1 linux-user: Fix wrong use of stat instead of stat64 for sparc64
This test case is fixed now:
sparc64-linux-user/qemu-sparc64 /usr/gnemul/qemu-sparc64/busybox ls -l block.c
--- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/syscall.c +1 -1
@@ -4764,7 +4764,7 @@ static inline abi_long host_to_target_stat64(void *cpu_env, } else#endif { -#if TARGET_ABI_BITS ==64 && !defined(TARGET_ALPHA ) +#if TARGET_ABI_BITS ==64 && !defined(TARGET_ALPHA ) && !defined(TARGET_SPARC64 )struct target_stat *target_st;#else struct target_stat64 *target_st;
Signature · 1 line
1.7.10.4
Quoted 13 lines · Stefan Weil
This test case is fixed now:
sparc64-linux-user/qemu-sparc64/usr/gnemul/qemu-sparc64/busyboxls -lblock.cSigned-off-by Stefan Weil <[email protected]>--- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)linux-user/syscall.c +0
-0
linux-user/syscall.c static inline abi_long host_to_target_stat64(void *cpu_env, · line 4770
Quoted 8 lines
linux-user/syscall.c +1
-1@@ -4764,7 +4764,7 @@ static inline abi_long host_to_target_stat64(void *cpu_env, } else#endif { -#if TARGET_ABI_BITS ==64 && !defined(TARGET_ALPHA ) +#if TARGET_ABI_BITS ==64 && !defined(TARGET_ALPHA ) && !defined(TARGET_SPARC64 )struct target_stat *target_st;#else struct target_stat64 *target_st;
So this condition is trying to identify the platforms which don't actually have a struct stat64 (which is some but not all of the 64 bit platforms). I think that rather than trying to enumerate those here it would be better if in the sections of syscall_defs.h which define target_stat/target_stat64 we had those sections which don't have a target_stat64 definition instead #define TARGET_NO_STRUCT_STAT64
and then used that here.
-- PMM
Am 06.09.2013 19:16, schrieb Peter Maydell:
Quoted 32 lines · Stefan Weil
Quoted 13 lines
This test case is fixed now:
sparc64-linux-user/qemu-sparc64/usr/gnemul/qemu-sparc64/busyboxls -lblock.cSigned-off-by Stefan Weil <[email protected]>--- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)linux-user/syscall.c +0
-0linux-user/syscall.c static inline abi_long host_to_target_stat64(void *cpu_env, · line 4770
Quoted 8 lines
linux-user/syscall.c +1
-1@@ -4764,7 +4764,7 @@ static inline abi_long host_to_target_stat64(void *cpu_env, } else#endif { -#if TARGET_ABI_BITS ==64 && !defined(TARGET_ALPHA ) +#if TARGET_ABI_BITS ==64 && !defined(TARGET_ALPHA ) && !defined(TARGET_SPARC64 )struct target_stat *target_st;#else struct target_stat64 *target_st;So this condition is trying to identify the platforms which don't actually have a struct stat64 (which is some but not all of the 64 bit platforms). I think that rather than trying to enumerate those here it would be better if in the sections of
syscall_defs.hwhich define target_stat/target_stat64 we had those sections which don't have atarget_stat64definition instead #defineTARGET_NO_STRUCT_STAT64
and then used that here.
Quoted 1 line
-- PMM
I even thought about a totally different solution:
Could we write some sample code with all those structs and system calls, compile it once for each target, and get all information we need from the resulting binaries (using tools like pahole, for example)?
For the moment, I think my patch is sufficient (it is also needed for QEMU 1.6!).
Stefan
Am 06.09.2013 19:24, schrieb Stefan Weil:
Quoted 41 lines
Am 06.09.2013 19:16, schrieb Peter Maydell:
Quoted 32 lines · Stefan Weil
Quoted 13 lines
This test case is fixed now:
sparc64-linux-user/qemu-sparc64/usr/gnemul/qemu-sparc64/busyboxls -lblock.cSigned-off-by Stefan Weil <[email protected]>--- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)linux-user/syscall.c +0
-0linux-user/syscall.c static inline abi_long host_to_target_stat64(void *cpu_env, · line 4770
Quoted 8 lines
linux-user/syscall.c +1
-1@@ -4764,7 +4764,7 @@ static inline abi_long host_to_target_stat64(void *cpu_env, } else#endif { -#if TARGET_ABI_BITS ==64 && !defined(TARGET_ALPHA ) +#if TARGET_ABI_BITS ==64 && !defined(TARGET_ALPHA ) && !defined(TARGET_SPARC64 )struct target_stat *target_st;#else struct target_stat64 *target_st;So this condition is trying to identify the platforms which don't actually have a struct stat64 (which is some but not all of the 64 bit platforms). I think that rather than trying to enumerate those here it would be better if in the sections of
syscall_defs.hwhich define target_stat/target_stat64 we had those sections which don't have atarget_stat64definition instead #defineTARGET_NO_STRUCT_STAT64
and then used that here.Quoted 1 line
-- PMM
I even thought about a totally different solution:
Could we write some sample code with all those structs and system calls, compile it once for each target, and get all information we need from the resulting binaries (using tools like pahole, for example)?
Quoted 4 lines
For the moment, I think my patch is sufficient (it is also needed for QEMU 1.6!).
Stefan
Ping? Are there any more opinions how qemu-sparc64 should be fixed? Should we choose Peter's approach (which is good, but with a higher risk than my patch)?
Stefan
Quoted 3 lines · Stefan Weil
Ping? Are there any more opinions how qemu-sparc64 should be fixed? Should we choose Peter's approach (which is good, but with a higher risk than my patch)?
I've included it now in my qeu, since it fixes qemu-sparc64 in my smoketest and causes seemingly no regressions on other platforms.
Riku
Quoted 7 lines · Riku Voipio
Quoted 3 lines · Stefan Weil
Ping? Are there any more opinions how qemu-sparc64 should be fixed? Should we choose Peter's approach (which is good, but with a higher risk than my patch)?
I've included it now in my qeu, since it fixes qemu-sparc64 in my smoketest and causes seemingly no regressions on other platforms.
Yeah, but I bet there are other platforms we're not getting this right on since the #ifdef here isn't the same as the #ifdef that decides whether we have a target_stat64 struct or not...
-- PMM
Quoted 6 lines · Peter Maydell
Quoted 5 lines · Riku Voipio
Quoted 3 lines · Stefan Weil
Ping? Are there any more opinions how qemu-sparc64 should be fixed? Should we choose Peter's approach (which is good, but with a higher risk than my patch)?
Quoted 6 lines
Quoted 2 lines
I've included it now in my qeu, since it fixes qemu-sparc64 in my smoketest and causes seemingly no regressions on other platforms.
Yeah, but I bet there are other platforms we're not getting this right on since the #ifdef here isn't the same as the #ifdef that decides whether we have a
target_stat64struct or not...
Ok, I'll leave the patch on table then, and send this pullrequest without it. Stefan, can you base the fix on setting TARGET_NO_STRUCT_STAT64 when it is not available?
Riku