Skip to contentSkip to conversation

EABI fcntl on x86_64

PATCH In review Stuart Anderson 3 participants 5 messages Mar 19, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 EABI fcntl on x86_64

When running ARM EABI binaries on x86_64, the target_eabi_flock64 structure is already padded correct so the padding is not needed. This patch adds an #ifdef to only include the _pad member on 32-but hosts.

Stuart

Stuart R. Anderson                               [email protected]
Network & Software Engineering                   http://www.netsweng.com/
1024D/37A79149:                                  0791 D3B8 9A4C 2CDC A31F
                                                 BD03 0A62 E534 37A7 9149

Index: linux-user/syscall_defs.h
===================================================================
RCS file: /sources/qemu/qemu/linux-user/syscall_defs.h,v retrieving revision 1.30

syscall_defs.h +2 -0
diff -u -r1.30 syscall_defs.h
@@ -1409,7 +1409,9 @@
 struct target_eabi_flock64 {
 	short  l_type;
 	short  l_whence;
+#if HOST_LONG_BITS == 32
         int __pad;
+#endif
 	unsigned long long l_start;
 	unsigned long long l_len;
 	int  l_pid;
#1 lore raw
Quoted 4 lines · Stuart Anderson

When running ARM EABI binaries on x86_64, the target_eabi_flock64 structure is already padded correct so the padding is not needed. This patch adds an #ifdef to only include the _pad member on 32-but hosts.

This is wrong. The struct is packed, so its layout should be independent of the host. How did you test your change?

Paul

#2 lore raw
Quoted 8 lines · Paul Brook
Quoted 4 lines · Stuart Anderson

When running ARM EABI binaries on x86_64, the target_eabi_flock64 structure is already padded correct so the padding is not needed. This patch adds an #ifdef to only include the _pad member on 32-but hosts.

This is wrong. The struct is packed, so its layout should be independent of the host. How did you test your change?

I have a debian arm chroot setup. dpkg was unhappy, and I used gdb to observe that there seemed to an extra 4 bytes of data in the middle of the structure being passed into the host function.

I missed Kirill's patch as it came across before I got back on the list, (and I missedit when I browsed the archive as well). Since I should be able to reproduce this, I'll test w/ his fix as well.

Stuart

Stuart R. Anderson                               [email protected]
Network & Software Engineering                   http://www.netsweng.com/
1024D/37A79149:                                  0791 D3B8 9A4C 2CDC A31F
                                                 BD03 0A62 E534 37A7 9149
#3 lore raw
Quoted 1 line · Stuart Anderson

I have a debian arm chroot setup.

Just to clarify, this is from the applieddata.net repository, not the normal debian one (which is not eabi).

Stuart

Stuart R. Anderson                               [email protected]
Network & Software Engineering                   http://www.netsweng.com/
1024D/37A79149:                                  0791 D3B8 9A4C 2CDC A31F
                                                 BD03 0A62 E534 37A7 9149
#4 lore raw
In reply to Stuart Anderson
Quoted 6 lines · Stuart Anderson

When running ARM EABI binaries on x86_64, the target_eabi_flock64 structure is already padded correct so the padding is not needed.

This patch adds an #ifdef to only include the _pad member on 32-but hosts.

Are you sure that problem is in padding? Please, look at my patch in post "[PATCH] fcntl64 fix".

Quoted 8 lines

Stuart

Stuart R. Anderson                               [email protected]
Network & Software Engineering                   http://www.netsweng.com/
1024D/37A79149:                                  0791 D3B8 9A4C 2CDC A31F
                                                 BD03 0A62 E534 37A7 9149

Content-Description: fcntl fix

Quoted 17 lines

Index: linux-user/syscall_defs.h
===================================================================
RCS file: /sources/qemu/qemu/linux-user/syscall_defs.h,v retrieving revision 1.30
diff -u -r1.30 syscall_defs.h

syscall_defs.h +2 -0
@@ -1409,7 +1409,9 @@
 struct target_eabi_flock64 {
 	short  l_type;
 	short  l_whence;
+#if HOST_LONG_BITS == 32
         int __pad;
+#endif
 	unsigned long long l_start;
 	unsigned long long l_len;
 	int  l_pid;