Skip to contentSkip to conversation

bsd-user/syscall_defs.h: define STAT_TIME_T_EXT only for 32 bits

PATCH In review Pierrick Bouvier 3 participants 3 messages Jan 19

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bsd-user/syscall_defs.h: define STAT_TIME_T_EXT only for 32 bits

Commit 369c1ba2b changed the wrong conditional "#if defined(__i386__)" to "#if defined(TARGET_I386)".
However, TARGET_I386 is defined for target x86_64 also.

This commit fixes it by identifying correctly 32 bits target.

Found with:

$ ./build/qemu-x86_64 \
  -plugin ./build/contrib/plugins/libstoptrigger,icount=1000000 \
  -plugin ./build/tests/tcg/plugins/libinsn \
  -d plugin \
  ./build/qemu-system-x86_64 --version
ld-elf.so.1: /lib/libz.so.6: invalid file format
cpu 0 insns: 59746
total insns: 59746
Fixes 369c1ba2b ("Fix __i386__ test for TARGET_HAS_STAT_TIME_T_EXT")
---
 bsd-user/syscall_defs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bsd-user/syscall_defs.h +1 -1
index c49be32bdc0..cc4b484f3ab 100644
@@ -247,7 +247,7 @@ struct target_freebsd11_stat {
     unsigned int:(8 / 2) * (16 - (int)sizeof(struct target_freebsd_timespec));
 } __packed;
 
-#if defined(TARGET_I386)
+#if defined(TARGET_I386) && !defined(TARGET_X86_64)
 #define TARGET_HAS_STAT_TIME_T_EXT       1
 #endif
 
Signature · 1 line
2.47.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Pierrick Bouvier

Commit 369c1ba2b changed the wrong conditional "#if defined(__i386__)" to "#if defined(TARGET_I386)".
However, TARGET_I386 is defined for target x86_64 also.

This commit fixes it by identifying correctly 32 bits target.

Found with:

$ ./build/qemu-x86_64 \
   -plugin ./build/contrib/plugins/libstoptrigger,icount=1000000 \
   -plugin ./build/tests/tcg/plugins/libinsn \
   -d plugin \
   ./build/qemu-system-x86_64 --version
ld-elf.so.1: /lib/libz.so.6: invalid file format
cpu 0 insns: 59746
total insns: 59746
Quoted 5 lines
Fixes 369c1ba2b ("Fix __i386__ test for TARGET_HAS_STAT_TIME_T_EXT")
---
  bsd-user/syscall_defs.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by on v1 1/1
#2 lore raw
In reply to Pierrick Bouvier
Quoted 4 lines · Pierrick Bouvier

Commit 369c1ba2b changed the wrong conditional "#if defined(__i386__)" to "#if defined(TARGET_I386)".
However, TARGET_I386 is defined for target x86_64 also.

Oh I always forget about that...

Quoted 12 lines

This commit fixes it by identifying correctly 32 bits target.

Found with:

$ ./build/qemu-x86_64 \
  -plugin ./build/contrib/plugins/libstoptrigger,icount=1000000 \
  -plugin ./build/tests/tcg/plugins/libinsn \
  -d plugin \
  ./build/qemu-system-x86_64 --version
ld-elf.so.1: /lib/libz.so.6: invalid file format
cpu 0 insns: 59746
total insns: 59746
Quoted 6 lines
Fixes 369c1ba2b ("Fix __i386__ test for TARGET_HAS_STAT_TIME_T_EXT")
---
 bsd-user/syscall_defs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 18 lines
bsd-user/syscall_defs.h +1 -2
index c49be32bdc0..cc4b484f3ab 100644
@@ -247,7 +247,7 @@ struct target_freebsd11_stat {
     unsigned int:(8 / 2) * (16 - (int)sizeof(struct
 target_freebsd_timespec));
 } __packed;
 
-#if defined(TARGET_I386)
+#if defined(TARGET_I386) && !defined(TARGET_X86_64)
 #define TARGET_HAS_STAT_TIME_T_EXT       1
 #endif
 
--

2.47.3