summaryrefslogtreecommitdiff
path: root/libc/nptl
diff options
context:
space:
mode:
Diffstat (limited to 'libc/nptl')
-rw-r--r--libc/nptl/ChangeLog67
-rw-r--r--libc/nptl/Makefile2
-rw-r--r--libc/nptl/pthread_cond_timedwait.c22
-rw-r--r--libc/nptl/pthread_rwlock_timedrdlock.c21
-rw-r--r--libc/nptl/pthread_rwlock_timedwrlock.c21
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c16
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h13
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h20
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h5
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/Makefile1
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/cpu_relax.S1
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile2
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/cpu_relax.S67
-rw-r--r--libc/nptl/sysdeps/x86_64/tls.h11
-rw-r--r--libc/nptl/tst-basic2.c4
-rw-r--r--libc/nptl/tst-cond-except.c6
-rw-r--r--libc/nptl/tst-cond25.c25
-rwxr-xr-xlibc/nptl/tst-tls6.sh25
18 files changed, 291 insertions, 38 deletions
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog
index 040b64c4e..0e0167529 100644
--- a/libc/nptl/ChangeLog
+++ b/libc/nptl/ChangeLog
@@ -1,3 +1,70 @@
+2012-11-05 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * pthread_cond_timedwait.c (__pthread_cond_timedwait): Time out
+ if absolute timeout is negative.
+ [__ASSUME_FUTEX_CLOCK_REALTIME &&
+ lll_futex_timed_wait_bitset]: Use lll_futex_timed_wait_bitset.
+ * pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock):
+ Likewise.
+ * pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock):
+ Likewise.
+ * sysdeps/unix/sysv/linux/lowlevelrobustlock.c
+ (__lll_robust_timedlock_wait): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
+ (lll_futex_timed_wait_bitset): New macro.
+ * sysdeps/unix/sysv/linux/s390/lowlevellock.h
+ (lll_futex_timed_wait_bitset): Likewise.
+
+2012-11-03 David S. Miller <davem@davemloft.net>
+
+ * sysdeps/unix/sysv/linux/sparc/lowlevellock.h (BUSY_WAIT_NOP):
+ Add missing spaces.
+ (__cpu_relax): Likewise.
+
+2012-11-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/x86_64/tls.h: Don't include <xmmintrin.h>.
+ (__128bits): New struct typedef.
+ (tcbhead_t): Replace __m128 with __128bits.
+
+2012-10-30 Aurelien Jarno <aurelien@aurel32.net>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile (tst-cancel7-ARGS): Use exec in --command argument.
+
+2012-10-28 David S. Miller <davem@davemloft.net>
+
+ * sysdeps/unix/sysv/linux/sparc/lowlevellock.h (BUSY_WAIT_NOP):
+ Define when we have v9 instructions available.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/cpu_relax.S: New file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/cpu_relax.S: New
+ file.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/Makefile: New
+ file.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/Makefile: Add cpu_relax
+ to libpthread-routines.
+
+2012-10-25 Roland McGrath <roland@hack.frob.com>
+
+ * tst-cond-except.c (TEST_FUNCTION): New macro.
+
+2012-10-25 Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile ($(objpfx)tst-tls6.out): Use $(BASH) not $(SHELL) to
+ run tst-tls6.sh.
+ * tst-tls6.sh: Use /bin/bash not /bin/sh.
+
+2012-10-25 Roland McGrath <roland@hack.frob.com>
+
+ * tst-basic2.c (do_test): Return RESULT, not always zero.
+
+ * tst-cond25.c: Include <stdint.h>
+ (waiter): Add casts to uintptr_t between casting integer<->pointer.
+ (timed_waiter): Likewise.
+ (do_test_wait): Likewise.
+ * tst-cond-except.c (thr): Likewise.
+ (do_test): Use prototype definition.
+
2012-10-24 Joseph Myers <joseph@codesourcery.com>
Jim Blandy <jimb@codesourcery.com>
diff --git a/libc/nptl/Makefile b/libc/nptl/Makefile
index 0126cfb4b..94928bc83 100644
--- a/libc/nptl/Makefile
+++ b/libc/nptl/Makefile
@@ -494,7 +494,7 @@ $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
$(objpfx)tst-tls5moda.so $(objpfx)tst-tls5modb.so \
$(objpfx)tst-tls5modc.so $(objpfx)tst-tls5modd.so \
$(objpfx)tst-tls5mode.so $(objpfx)tst-tls5modf.so
- $(SHELL) $< $(common-objpfx) $(elf-objpfx) \
+ $(BASH) $< $(common-objpfx) $(elf-objpfx) \
$(rtld-installed-name) '$(test-wrapper-env)'
endif
diff --git a/libc/nptl/pthread_cond_timedwait.c b/libc/nptl/pthread_cond_timedwait.c
index 51a34ba4f..2fcbc57c2 100644
--- a/libc/nptl/pthread_cond_timedwait.c
+++ b/libc/nptl/pthread_cond_timedwait.c
@@ -80,6 +80,11 @@ __pthread_cond_timedwait (cond, mutex, abstime)
++cond->__data.__futex;
cond->__data.__nwaiters += 1 << COND_NWAITERS_SHIFT;
+ /* Work around the fact that the kernel rejects negative timeout values
+ despite them being valid. */
+ if (__builtin_expect (abstime->tv_sec < 0, 0))
+ goto timeout;
+
/* Remember the mutex we are using here. If there is already a
different address store this is a bad user bug. Do not store
anything for pshared condvars. */
@@ -104,9 +109,11 @@ __pthread_cond_timedwait (cond, mutex, abstime)
while (1)
{
+#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
+ || !defined lll_futex_timed_wait_bitset)
struct timespec rt;
{
-#ifdef __NR_clock_gettime
+# ifdef __NR_clock_gettime
INTERNAL_SYSCALL_DECL (err);
int ret;
ret = INTERNAL_VSYSCALL (clock_gettime, err, 2,
@@ -116,7 +123,7 @@ __pthread_cond_timedwait (cond, mutex, abstime)
/* Convert the absolute timeout value to a relative timeout. */
rt.tv_sec = abstime->tv_sec - rt.tv_sec;
rt.tv_nsec = abstime->tv_nsec - rt.tv_nsec;
-#else
+# else
/* Get the current time. So far we support only one clock. */
struct timeval tv;
(void) gettimeofday (&tv, NULL);
@@ -124,7 +131,7 @@ __pthread_cond_timedwait (cond, mutex, abstime)
/* Convert the absolute timeout value to a relative timeout. */
rt.tv_sec = abstime->tv_sec - tv.tv_sec;
rt.tv_nsec = abstime->tv_nsec - tv.tv_usec * 1000;
-#endif
+# endif
}
if (rt.tv_nsec < 0)
{
@@ -139,6 +146,7 @@ __pthread_cond_timedwait (cond, mutex, abstime)
goto timeout;
}
+#endif
unsigned int futex_val = cond->__data.__futex;
@@ -148,9 +156,17 @@ __pthread_cond_timedwait (cond, mutex, abstime)
/* Enable asynchronous cancellation. Required by the standard. */
cbuffer.oldtype = __pthread_enable_asynccancel ();
+#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
+ || !defined lll_futex_timed_wait_bitset)
/* Wait until woken by signal or broadcast. */
err = lll_futex_timed_wait (&cond->__data.__futex,
futex_val, &rt, pshared);
+#else
+ unsigned int clockbit = (cond->__data.__nwaiters & 1
+ ? 0 : FUTEX_CLOCK_REALTIME);
+ err = lll_futex_timed_wait_bitset (&cond->__data.__futex, futex_val,
+ abstime, clockbit, pshared);
+#endif
/* Disable asynchronous cancellation. */
__pthread_disable_asynccancel (cbuffer.oldtype);
diff --git a/libc/nptl/pthread_rwlock_timedrdlock.c b/libc/nptl/pthread_rwlock_timedrdlock.c
index be8216d57..b7622abfa 100644
--- a/libc/nptl/pthread_rwlock_timedrdlock.c
+++ b/libc/nptl/pthread_rwlock_timedrdlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003,2004,2007,2011 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
@@ -76,6 +76,16 @@ pthread_rwlock_timedrdlock (rwlock, abstime)
break;
}
+ /* Work around the fact that the kernel rejects negative timeout values
+ despite them being valid. */
+ if (__builtin_expect (abstime->tv_sec < 0, 0))
+ {
+ result = ETIMEDOUT;
+ break;
+ }
+
+#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
+ || !defined lll_futex_timed_wait_bitset)
/* Get the current time. So far we support only one clock. */
struct timeval tv;
(void) gettimeofday (&tv, NULL);
@@ -96,6 +106,7 @@ pthread_rwlock_timedrdlock (rwlock, abstime)
result = ETIMEDOUT;
break;
}
+#endif
/* Remember that we are a reader. */
if (++rwlock->__data.__nr_readers_queued == 0)
@@ -112,8 +123,16 @@ pthread_rwlock_timedrdlock (rwlock, abstime)
lll_unlock (rwlock->__data.__lock, rwlock->__data.__shared);
/* Wait for the writer to finish. */
+#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
+ || !defined lll_futex_timed_wait_bitset)
err = lll_futex_timed_wait (&rwlock->__data.__readers_wakeup,
waitval, &rt, rwlock->__data.__shared);
+#else
+ err = lll_futex_timed_wait_bitset (&rwlock->__data.__readers_wakeup,
+ waitval, abstime,
+ FUTEX_CLOCK_REALTIME,
+ rwlock->__data.__shared);
+#endif
/* Get the lock. */
lll_lock (rwlock->__data.__lock, rwlock->__data.__shared);
diff --git a/libc/nptl/pthread_rwlock_timedwrlock.c b/libc/nptl/pthread_rwlock_timedwrlock.c
index 8eb31cfdc..5f2399f91 100644
--- a/libc/nptl/pthread_rwlock_timedwrlock.c
+++ b/libc/nptl/pthread_rwlock_timedwrlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003,2004,2007,2011 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
@@ -67,6 +67,16 @@ pthread_rwlock_timedwrlock (rwlock, abstime)
break;
}
+ /* Work around the fact that the kernel rejects negative timeout values
+ despite them being valid. */
+ if (__builtin_expect (abstime->tv_sec < 0, 0))
+ {
+ result = ETIMEDOUT;
+ break;
+ }
+
+#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
+ || !defined lll_futex_timed_wait_bitset)
/* Get the current time. So far we support only one clock. */
struct timeval tv;
(void) gettimeofday (&tv, NULL);
@@ -86,6 +96,7 @@ pthread_rwlock_timedwrlock (rwlock, abstime)
result = ETIMEDOUT;
break;
}
+#endif
/* Remember that we are a writer. */
if (++rwlock->__data.__nr_writers_queued == 0)
@@ -102,8 +113,16 @@ pthread_rwlock_timedwrlock (rwlock, abstime)
lll_unlock (rwlock->__data.__lock, rwlock->__data.__shared);
/* Wait for the writer or reader(s) to finish. */
+#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
+ || !defined lll_futex_timed_wait_bitset)
err = lll_futex_timed_wait (&rwlock->__data.__writer_wakeup,
waitval, &rt, rwlock->__data.__shared);
+#else
+ err = lll_futex_timed_wait_bitset (&rwlock->__data.__writer_wakeup,
+ waitval, abstime,
+ FUTEX_CLOCK_REALTIME,
+ rwlock->__data.__shared);
+#endif
/* Get the lock. */
lll_lock (rwlock->__data.__lock, rwlock->__data.__shared);
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c b/libc/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c
index 7b4e84343..9a9e67303 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c
+++ b/libc/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2006-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
@@ -70,8 +70,15 @@ __lll_robust_timedlock_wait (int *futex, const struct timespec *abstime,
if (oldval == 0)
goto try;
+ /* Work around the fact that the kernel rejects negative timeout values
+ despite them being valid. */
+ if (__builtin_expect (abstime->tv_sec < 0, 0))
+ return ETIMEDOUT;
+
do
{
+#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
+ || !defined lll_futex_timed_wait_bitset)
struct timeval tv;
struct timespec rt;
@@ -90,6 +97,7 @@ __lll_robust_timedlock_wait (int *futex, const struct timespec *abstime,
/* Already timed out? */
if (rt.tv_sec < 0)
return ETIMEDOUT;
+#endif
/* Wait. */
if (__builtin_expect (oldval & FUTEX_OWNER_DIED, 0))
@@ -100,7 +108,13 @@ __lll_robust_timedlock_wait (int *futex, const struct timespec *abstime,
&& atomic_compare_and_exchange_bool_acq (futex, newval, oldval))
continue;
+#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
+ || !defined lll_futex_timed_wait_bitset)
lll_futex_timed_wait (futex, newval, &rt, private);
+#else
+ lll_futex_timed_wait_bitset (futex, newval, abstime,
+ FUTEX_CLOCK_REALTIME, private);
+#endif
try:
;
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h b/libc/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
index 406c290d7..17e63c690 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
@@ -88,6 +88,19 @@
INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
})
+#define lll_futex_timed_wait_bitset(futexp, val, timespec, clockbit, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ int __op = FUTEX_WAIT_BITSET | clockbit; \
+ \
+ __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
+ __lll_private_flag (__op, private), \
+ (val), (timespec), NULL /* Unused. */, \
+ FUTEX_BITSET_MATCH_ANY); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
+ })
+
#define lll_futex_wake(futexp, nr, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h b/libc/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
index 97092823d..0b7110f11 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
@@ -93,6 +93,26 @@
__result; \
})
+#define lll_futex_timed_wait_bitset(futexp, val, timespec, clockbit, private) \
+ ({ \
+ register unsigned long int __r2 asm ("2") = (unsigned long int) (futexp); \
+ register unsigned long int __r3 asm ("3") \
+ = __lll_private_flag ((FUTEX_WAIT_BITSET | clockbit), private); \
+ register unsigned long int __r4 asm ("4") = (long int) (val); \
+ register unsigned long int __r5 asm ("5") = (long int) (timespec); \
+ register unsigned long int __r6 asm ("6") = (unsigned long int) (NULL); \
+ register unsigned long int __r7 asm ("7") \
+ = (unsigned int) (FUTEX_BITSET_MATCH_ANY); \
+ register unsigned long __result asm ("2"); \
+ \
+ __asm __volatile ("svc %b1" \
+ : "=d" (__result) \
+ : "i" (SYS_futex), "0" (__r2), "d" (__r3), \
+ "d" (__r4), "d" (__r5), "d" (__r6), "d" (__r7) \
+ : "cc", "memory" ); \
+ __result; \
+ })
+
#define lll_futex_wake(futex, nr, private) \
({ \
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h b/libc/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
index fafb0873f..939f41dfd 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
@@ -50,6 +50,11 @@
#define LLL_PRIVATE 0
#define LLL_SHARED FUTEX_PRIVATE_FLAG
+#ifndef __sparc32_atomic_do_lock
+/* Delay in spinlock loop. */
+extern void __cpu_relax (void);
+#define BUSY_WAIT_NOP __cpu_relax ()
+#endif
#if !defined NOT_IN_libc || defined IS_IN_rtld
/* In libc.so or ld.so all futexes are private. */
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/Makefile b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/Makefile
new file mode 100644
index 000000000..f7acc019a
--- /dev/null
+++ b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/Makefile
@@ -0,0 +1 @@
+libpthread-routines += cpu_relax
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/cpu_relax.S b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/cpu_relax.S
new file mode 100644
index 000000000..4ac4d1448
--- /dev/null
+++ b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/cpu_relax.S
@@ -0,0 +1 @@
+#include <sparc64/cpu_relax.S>
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile
index 774b267ef..656d2e09c 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile
+++ b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile
@@ -1,3 +1,5 @@
+libpthread-routines += cpu_relax
+
ifeq ($(subdir),nptl)
CFLAGS-pause.c += -fexceptions
CFLAGS-sigsuspend.c += -fexceptions
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/cpu_relax.S b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/cpu_relax.S
new file mode 100644
index 000000000..9e64c5080
--- /dev/null
+++ b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/cpu_relax.S
@@ -0,0 +1,67 @@
+/* CPU strand yielding for busy loops.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ Contributed by David S. Miller (davem@davemloft.net)
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+ .text
+__cpu_relax_generic:
+ rd %ccr, %g0
+ rd %ccr, %g0
+ rd %ccr, %g0
+ retl
+ nop
+ .size __cpu_relax_generic,.-__cpu_relax_generic
+
+__cpu_relax_pause:
+ wr %g0, 128, %asr27
+ retl
+ nop
+ .size __cpu_relax_pause,.-__cpu_relax_pause
+
+ENTRY(__cpu_relax)
+ .type __cpu_relax, @gnu_indirect_function
+# ifdef SHARED
+ SETUP_PIC_REG_LEAF(o3, o5)
+# endif
+ set HWCAP_SPARC_PAUSE, %o1
+ andcc %o0, %o1, %g0
+ be 1f
+ nop
+# ifdef SHARED
+ sethi %gdop_hix22(__cpu_relax_pause), %o1
+ xor %o1, %gdop_lox10(__cpu_relax_pause), %o1
+# else
+ set __cpu_relax_pause, %o1
+# endif
+ ba 10f
+ nop
+1:
+# ifdef SHARED
+ sethi %gdop_hix22(__cpu_relax_generic), %o1
+ xor %o1, %gdop_lox10(__cpu_relax_generic), %o1
+# else
+ set __cpu_relax_generic, %o1
+# endif
+10:
+# ifdef SHARED
+ add %o3, %o1, %o1
+# endif
+ retl
+ mov %o1, %o0
+END(__cpu_relax)
diff --git a/libc/nptl/sysdeps/x86_64/tls.h b/libc/nptl/sysdeps/x86_64/tls.h
index b651d1cfa..bc60a511f 100644
--- a/libc/nptl/sysdeps/x86_64/tls.h
+++ b/libc/nptl/sysdeps/x86_64/tls.h
@@ -27,7 +27,14 @@
# include <stdlib.h>
# include <sysdep.h>
# include <kernel-features.h>
-# include <xmmintrin.h>
+
+/* Replacement type for __m128 since this file is included by ld.so,
+ which is compiled with -mno-sse. It must not change the alignment
+ of rtld_savespace_sse. */
+typedef struct
+{
+ int i[4];
+} __128bits;
/* Type for the dtv. */
@@ -64,7 +71,7 @@ typedef struct
void *__private_tm[5];
long int __unused2;
/* Have space for the post-AVX register size. */
- __m128 rtld_savespace_sse[8][4] __attribute__ ((aligned (32)));
+ __128bits rtld_savespace_sse[8][4] __attribute__ ((aligned (32)));
void *__padding[8];
} tcbhead_t;
diff --git a/libc/nptl/tst-basic2.c b/libc/nptl/tst-basic2.c
index 58ed6ac53..0d3cc06da 100644
--- a/libc/nptl/tst-basic2.c
+++ b/libc/nptl/tst-basic2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -112,7 +112,7 @@ do_test (void)
result = 1;
}
- return 0;
+ return result;
}
diff --git a/libc/nptl/tst-cond-except.c b/libc/nptl/tst-cond-except.c
index b9871ba86..c294a41b2 100644
--- a/libc/nptl/tst-cond-except.c
+++ b/libc/nptl/tst-cond-except.c
@@ -18,6 +18,7 @@
#include <pthread.h>
#include <stdio.h>
+#include <stdint.h>
#include <string.h>
#include <unistd.h>
@@ -72,11 +73,11 @@ thr (void *arg)
pthread_cleanup_pop (1);
out:
- return (void *)ret;
+ return (void *) (uintptr_t) ret;
}
int
-do_test ()
+do_test (void)
{
pthread_t thread;
int ret = 0;
@@ -104,5 +105,6 @@ out:
return ret;
}
+#define TEST_FUNCTION do_test ()
#define TIMEOUT 5
#include "../test-skeleton.c"
diff --git a/libc/nptl/tst-cond25.c b/libc/nptl/tst-cond25.c
index 370cd67d1..cdc129d5f 100644
--- a/libc/nptl/tst-cond25.c
+++ b/libc/nptl/tst-cond25.c
@@ -20,6 +20,7 @@
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
@@ -87,13 +88,13 @@ waiter (void *u)
{
int i, ret = 0;
void *tret = NULL;
- int seq = (int)u;
+ int seq = (uintptr_t) u;
for (i = 0; i < ITERS / NUM; i++)
{
if ((ret = pthread_mutex_lock (&mutex)) != 0)
{
- tret = (void *)1;
+ tret = (void *) (uintptr_t) 1;
printf ("waiter[%u]:mutex_lock failed: %s\n", seq, strerror (ret));
goto out;
}
@@ -101,14 +102,14 @@ waiter (void *u)
if ((ret = pthread_cond_wait (&cond, &mutex)) != 0)
{
- tret = (void *)1;
+ tret = (void *) (uintptr_t) 1;
printf ("waiter[%u]:wait failed: %s\n", seq, strerror (ret));
goto unlock_out;
}
if ((ret = pthread_mutex_unlock (&mutex)) != 0)
{
- tret = (void *)1;
+ tret = (void *) (uintptr_t) 1;
printf ("waiter[%u]:mutex_unlock failed: %s\n", seq, strerror (ret));
goto out;
}
@@ -130,7 +131,7 @@ timed_waiter (void *u)
{
int i, ret;
void *tret = NULL;
- int seq = (int)u;
+ int seq = (uintptr_t) u;
for (i = 0; i < ITERS / NUM; i++)
{
@@ -138,7 +139,7 @@ timed_waiter (void *u)
if ((ret = clock_gettime(CLOCK_REALTIME, &ts)) != 0)
{
- tret = (void *)1;
+ tret = (void *) (uintptr_t) 1;
printf ("%u:clock_gettime failed: %s\n", seq, strerror (errno));
goto out;
}
@@ -146,7 +147,7 @@ timed_waiter (void *u)
if ((ret = pthread_mutex_lock (&mutex)) != 0)
{
- tret = (void *)1;
+ tret = (void *) (uintptr_t) 1;
printf ("waiter[%u]:mutex_lock failed: %s\n", seq, strerror (ret));
goto out;
}
@@ -155,13 +156,13 @@ timed_waiter (void *u)
/* We should not time out either. */
if ((ret = pthread_cond_timedwait (&cond, &mutex, &ts)) != 0)
{
- tret = (void *)1;
+ tret = (void *) (uintptr_t) 1;
printf ("waiter[%u]:timedwait failed: %s\n", seq, strerror (ret));
goto unlock_out;
}
if ((ret = pthread_mutex_unlock (&mutex)) != 0)
{
- tret = (void *)1;
+ tret = (void *) (uintptr_t) 1;
printf ("waiter[%u]:mutex_unlock failed: %s\n", seq, strerror (ret));
goto out;
}
@@ -195,7 +196,8 @@ do_test_wait (thr_func f)
goto out;
}
- if ((ret = pthread_mutexattr_setprotocol (&attr, PTHREAD_PRIO_INHERIT)) != 0)
+ if ((ret = pthread_mutexattr_setprotocol (&attr,
+ PTHREAD_PRIO_INHERIT)) != 0)
{
printf ("mutexattr_setprotocol failed: %s\n", strerror (ret));
goto out;
@@ -214,7 +216,8 @@ do_test_wait (thr_func f)
}
for (j = 0; j < NUM; j++)
- if ((ret = pthread_create (&w[j], NULL, f, (void *)j)) != 0)
+ if ((ret = pthread_create (&w[j], NULL,
+ f, (void *) (uintptr_t) j)) != 0)
{
printf ("waiter[%d]: create failed: %s\n", j, strerror (ret));
goto out;
diff --git a/libc/nptl/tst-tls6.sh b/libc/nptl/tst-tls6.sh
index 78d70a827..27450c385 100755
--- a/libc/nptl/tst-tls6.sh
+++ b/libc/nptl/tst-tls6.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
# A tls test.
# Copyright (C) 2003-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
@@ -38,44 +38,41 @@ export LANG
> $logfile
fail=0
-preloads () {
- l=''
- for s in "$@"; do
- l="$l ${common_objpfx}nptl/tst-tls5mod$s.so"
- done
- echo $l | sed 's/:$//;s/: /:/g'
-}
-
for aligned in a e f; do
echo "preload tst-tls5mod{$aligned,b,c,d}.so" >> $logfile
echo "===============" >> $logfile
${test_wrapper_env} \
- LD_PRELOAD="`preloads $aligned b c d`" ${tst_tls5} >> $logfile || fail=1
+ LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{$aligned,b,c,d}.so \
+ | sed 's/:$//;s/: /:/g'`" ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
echo "preload tst-tls5mod{b,$aligned,c,d}.so" >> $logfile
echo "===============" >> $logfile
${test_wrapper_env} \
- LD_PRELOAD="`preloads b $aligned c d`" ${tst_tls5} >> $logfile || fail=1
+ LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{b,$aligned,c,d}.so \
+ | sed 's/:$//;s/: /:/g'`" ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
echo "preload tst-tls5mod{b,c,d,$aligned}.so" >> $logfile
echo "===============" >> $logfile
${test_wrapper_env} \
- LD_PRELOAD="`preloads b c d $aligned`" ${tst_tls5} >> $logfile || fail=1
+ LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{b,c,d,$aligned}.so \
+ | sed 's/:$//;s/: /:/g'`" ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
done
echo "preload tst-tls5mod{d,a,b,c,e}" >> $logfile
echo "===============" >> $logfile
${test_wrapper_env} \
-LD_PRELOAD="`preloads d a b c e`" ${tst_tls5} >> $logfile || fail=1
+LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{d,a,b,c,e}.so \
+ | sed 's/:$//;s/: /:/g'`" ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
echo "preload tst-tls5mod{d,a,b,e,f}" >> $logfile
echo "===============" >> $logfile
${test_wrapper_env} \
-LD_PRELOAD="`preloads d a b e f`" ${tst_tls5} >> $logfile || fail=1
+LD_PRELOAD="`echo ${common_objpfx}nptl/tst-tls5mod{d,a,b,e,f}.so \
+ | sed 's/:$//;s/: /:/g'`" ${tst_tls5} >> $logfile || fail=1
echo >> $logfile
exit $fail