Message ID | 20110728193226.GA7809@intel.com |
---|---|
State | New |
Headers | show |
On Thu, Jul 28, 2011 at 12:32:26PM -0700, H.J. Lu wrote: > This patch fixes 2 issues in libgomp for x32: > > 1. x32 should use the same futex functions as x86-64. What kind of syscalls is -mx32 using on Linux? I thought it was using the -m32 compat layer, isn't that the case? If it works properly this way using a 64-bit syscall, including any needed sign/zero extensions of the arguments, fine. > 2. IA32 tests should check ia32 instead of ilp32. This is certainly fine. Jakub
On Thu, Jul 28, 2011 at 12:45 PM, Jakub Jelinek <jakub@redhat.com> wrote: > On Thu, Jul 28, 2011 at 12:32:26PM -0700, H.J. Lu wrote: >> This patch fixes 2 issues in libgomp for x32: >> >> 1. x32 should use the same futex functions as x86-64. > > What kind of syscalls is -mx32 using on Linux? I thought it was using the > -m32 compat layer, isn't that the case? If it works properly this way using > a 64-bit syscall, including any needed sign/zero extensions of the arguments, > fine. x32 uses syscall instruction for system call with long == 32bit. For futex. it calls the compat_sys_futex kernel function. As far as kernel is concerned, x32 is the same as ia32 with x86-64 kernel calling convention. >> 2. IA32 tests should check ia32 instead of ilp32. > > This is certainly fine. > > Jakub > Thanks.
diff --git a/libgomp/config/linux/x86/futex.h b/libgomp/config/linux/x86/futex.h index cb7461d..419f4d9 100644 --- a/libgomp/config/linux/x86/futex.h +++ b/libgomp/config/linux/x86/futex.h @@ -24,7 +24,7 @@ /* Provide target-specific access to the futex system call. */ -#ifdef __LP64__ +#ifdef __x86_64__ # ifndef SYS_futex # define SYS_futex 202 # endif @@ -138,7 +138,7 @@ futex_wake (int *addr, int count) } } -#endif /* __LP64__ */ +#endif /* __x86_64__ */ static inline void cpu_relax (void) diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index 976543d..a75e22f 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -140,7 +140,7 @@ proc libgomp_init { args } { # We use atomic operations in the testcases to validate results. if { ([istarget i?86-*-*] || [istarget x86_64-*-*]) - && [check_effective_target_ilp32] } { + && [check_effective_target_ia32] } { lappend ALWAYS_CFLAGS "additional_flags=-march=i486" } diff --git a/libgomp/testsuite/libgomp.c/atomic-1.c b/libgomp/testsuite/libgomp.c/atomic-1.c index b2be8f0..4725b7d 100644 --- a/libgomp/testsuite/libgomp.c/atomic-1.c +++ b/libgomp/testsuite/libgomp.c/atomic-1.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O2 -march=pentium" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ +/* { dg-options "-O2 -march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ #ifdef __i386__ #include "cpuid.h" diff --git a/libgomp/testsuite/libgomp.c/atomic-6.c b/libgomp/testsuite/libgomp.c/atomic-6.c index 59baf7d..f8ab75e 100644 --- a/libgomp/testsuite/libgomp.c/atomic-6.c +++ b/libgomp/testsuite/libgomp.c/atomic-6.c @@ -1,7 +1,7 @@ /* PR middle-end/36106 */ /* { dg-options "-O2" } */ /* { dg-options "-O2 -mieee" { target alpha*-*-* } } */ -/* { dg-options "-O2 -march=i586" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ +/* { dg-options "-O2 -march=i586" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ #ifdef __i386__ # include "cpuid.h"