From ec4922395b05b428cb2cd17ea8118087e0ed6df4 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 10 Aug 2009 08:10:11 -0700 Subject: [PATCH 1/6] Fix check for PI mutex in x86-64 pthread_cond_signal Register eax contains the syscall number, use a different one instead. --- nptl/ChangeLog | 6 ++++++ nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 5be464e2f2..092962fab6 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,9 @@ +2009-08-10 Andreas Schwab + + * sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S + (__pthread_cond_signal): Don't clobber register used for syscall + number. + 2009-08-08 Ulrich Drepper * sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S (sem_timedwait): diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S index 4d001eec7f..d1d83a84f9 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S @@ -64,9 +64,9 @@ __pthread_cond_signal: /* Get the address of the mutex used. */ movq dep_mutex(%r8), %rcx - movl MUTEX_KIND(%rcx), %eax - andl $(ROBUST_BIT|PI_BIT), %eax - cmpl $PI_BIT, %eax + movl MUTEX_KIND(%rcx), %r11d + andl $(ROBUST_BIT|PI_BIT), %r11d + cmpl $PI_BIT, %r11d je 9f #ifdef __ASSUME_PRIVATE_FUTEX From 78fd882a7bf6153f33b73363c542e1f37c098c56 Mon Sep 17 00:00:00 2001 From: SUGIOKA Toshinobu Date: Mon, 10 Aug 2009 08:12:49 -0700 Subject: [PATCH 2/6] SH: fix clobber list in stdlib/longlong.h --- ChangeLog | 5 +++++ stdlib/longlong.h | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 12fa4cda13..201d74007e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-08-10 SUGIOKA Toshinobu + + * stdlib/longlong.h [__sh__] (udiv_qrnnd, sub_ddmmss): Add "t" to + clobber list. + 2009-08-01 H.J. Lu * elf/Makefile (distribute): Add tst-audit6.c tst-auditmod6a.c diff --git a/stdlib/longlong.h b/stdlib/longlong.h index a2f38ae2a5..e7d6099c7e 100644 --- a/stdlib/longlong.h +++ b/stdlib/longlong.h @@ -1,6 +1,6 @@ /* longlong.h -- definitions for mixed size 32/64 bit arithmetic. Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005, 2006, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -918,7 +918,7 @@ UDItype __umulsidi3 (USItype, USItype); " or r1,%0" \ : "=r" (q), "=&z" (r) \ : "1" (n1), "r" (n0), "rm" (d), "r" (&__udiv_qrnnd_16) \ - : "r1", "r2", "r4", "r5", "r6", "pr"); \ + : "r1", "r2", "r4", "r5", "r6", "pr", "t"); \ } while (0) #define UDIV_TIME 80 @@ -926,7 +926,8 @@ UDItype __umulsidi3 (USItype, USItype); #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ __asm__ ("clrt;subc %5,%1; subc %4,%0" \ : "=r" (sh), "=r" (sl) \ - : "0" (ah), "1" (al), "r" (bh), "r" (bl)) + : "0" (ah), "1" (al), "r" (bh), "r" (bl) \ + : "t") #endif /* __sh__ */ From 1bc2b97ee42dd653890657a4c910bd144247ea11 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 10 Aug 2009 11:26:16 -0700 Subject: [PATCH 3/6] Add CFI directives to x86-64 pthread_rwlock_{rd,wr)lock. --- nptl/ChangeLog | 6 ++++++ nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S | 4 +++- nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 092962fab6..f8e85a9247 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,9 @@ +2009-08-10 Ulrich Drepper + + * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S: Add CFI + directives. + * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S: Likewise. + 2009-08-10 Andreas Schwab * sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S index 80fedd4ab1..35eb09cd0c 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -30,6 +30,7 @@ .type __pthread_rwlock_rdlock,@function .align 16 __pthread_rwlock_rdlock: + cfi_startproc xorq %r10, %r10 /* Get the lock. */ @@ -167,6 +168,7 @@ __pthread_rwlock_rdlock: subq $MUTEX, %rdi #endif jmp 13b + cfi_endproc .size __pthread_rwlock_rdlock,.-__pthread_rwlock_rdlock .globl pthread_rwlock_rdlock diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S index 209c0e9a94..be6b8d8e20 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -30,6 +30,7 @@ .type __pthread_rwlock_wrlock,@function .align 16 __pthread_rwlock_wrlock: + cfi_startproc xorq %r10, %r10 /* Get the lock. */ @@ -155,6 +156,7 @@ __pthread_rwlock_wrlock: subq $MUTEX, %rdi #endif jmp 13b + cfi_endproc .size __pthread_rwlock_wrlock,.-__pthread_rwlock_wrlock .globl pthread_rwlock_wrlock From ae0d54500381eb9d40710a259819d9b745a7297f Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 11 Aug 2009 20:47:36 -0700 Subject: [PATCH 4/6] Add CFI directives to x86-64 pthread_rwlock_unlock. --- nptl/ChangeLog | 5 +++++ nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nptl/ChangeLog b/nptl/ChangeLog index f8e85a9247..88975a76e0 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,8 @@ +2009-08-11 Ulrich Drepper + + * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S: Add CFI + directives. + 2009-08-10 Ulrich Drepper * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S: Add CFI diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S index cf7f607d9c..03391d0fc2 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -29,6 +29,7 @@ .type __pthread_rwlock_unlock,@function .align 16 __pthread_rwlock_unlock: + cfi_startproc /* Get the lock. */ movl $1, %esi xorl %eax, %eax @@ -119,7 +120,7 @@ __pthread_rwlock_unlock: #endif callq __lll_unlock_wake jmp 8b - + cfi_endproc .size __pthread_rwlock_unlock,.-__pthread_rwlock_unlock .globl pthread_rwlock_unlock From 85fda49b9674152ca54d49e0028f981566f2554d Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 14 Aug 2009 00:42:51 -0700 Subject: [PATCH 5/6] Improve test-skeleton.c to clean up after dead parent. --- ChangeLog | 7 +++++++ test-skeleton.c | 15 ++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 201d74007e..28a92f41f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-08-14 Ulrich Drepper + + * test-skeleton.c (signal_handler): Renamed from timeout_handler. + Also handle SIGINT. In that case only do the cleanup and then + re-raise the signal. + (main): Install handler for SIGINT. + 2009-08-10 SUGIOKA Toshinobu * stdlib/longlong.h [__sh__] (udiv_qrnnd, sub_ddmmss): Add "t" to diff --git a/test-skeleton.c b/test-skeleton.c index 23e40124bd..0238db6b4d 100644 --- a/test-skeleton.c +++ b/test-skeleton.c @@ -1,5 +1,5 @@ /* Skeleton for test programs. - Copyright (C) 1998,2000-2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1998,2000-2004, 2005, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. @@ -132,7 +132,7 @@ create_temp_file (const char *base, char **filename) /* Timeout handler. We kill the child and exit with an error. */ static void __attribute__ ((noreturn)) -timeout_handler (int sig __attribute__ ((unused))) +signal_handler (int sig __attribute__ ((unused))) { int killed; int status; @@ -167,6 +167,12 @@ timeout_handler (int sig __attribute__ ((unused))) CLEANUP_HANDLER; #endif + if (sig == SIGINT) + { + signal (sig, SIG_DFL); + raise (sig); + } + /* If we expected this signal: good! */ #ifdef EXPECTED_SIGNAL if (EXPECTED_SIGNAL == SIGALRM) @@ -325,9 +331,12 @@ main (int argc, char *argv[]) /* Default timeout is two seconds. */ # define TIMEOUT 2 #endif - signal (SIGALRM, timeout_handler); + signal (SIGALRM, signal_handler); alarm (TIMEOUT * timeoutfactor); + /* Make sure we clean up if the wrapper gets interrupted. */ + signal (SIGINT, signal_handler); + /* Wait for the regular termination. */ termpid = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)); if (termpid == -1) From 677760a3076884bd6496e3676b1102db400f79d6 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 16 Aug 2009 00:39:43 -0700 Subject: [PATCH 6/6] Fix 64-bit platform handling in test cases for generated headers with constants. --- ChangeLog | 8 ++++++-- scripts/gen-as-const.awk | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 28a92f41f9..39bbb2ab9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-08-16 Ulrich Drepper + + * scripts/gen-as-const.awk: Fix test for 64-bit platform. + 2009-08-14 Ulrich Drepper * test-skeleton.c (signal_handler): Renamed from timeout_handler. @@ -58,7 +62,7 @@ * sysdeps/x86_64/strcmp.S: Add support to compile with USE_SSSE3. In this case palignr is used. - * sysdeps/x86_64/multiarch/strcmp.S (strcmp): If SSE4.3 is not + * sysdeps/x86_64/multiarch/strcmp.S (strcmp): If SSE4.2 is not available but SSSE3 is, pick __str{,n}cmp_ssse3. * sysdeps/x86_64/multiarch/Makefile [subdir=string] (sysdep_routines): Add strcmp-ssse3 and strncmp-ssse3. @@ -1803,7 +1807,7 @@ * sysdeps/x86_64/mp_clz_tab.c: New file. 2009-03-17 Ryan S. Arnold - Ulrich Drepper + Ulrich Drepper * sysdeps/unix/sysv/linux/fallocate.c: Handle old kernel headers. * sysdeps/unix/sysv/linux/fallocate64.c: Likewise. diff --git a/scripts/gen-as-const.awk b/scripts/gen-as-const.awk index 20d18c12af..1ffd5f2c1c 100644 --- a/scripts/gen-as-const.awk +++ b/scripts/gen-as-const.awk @@ -16,7 +16,8 @@ NF >= 1 && !started { if (test) { print "\n#include "; print "\n#include "; - print "\n#if __WORDSIZE__ == 64"; + print "\n#include "; + print "\n#if __WORDSIZE == 64"; print "\ntypedef uint64_t c_t;"; print "\n#define U(n) UINT64_C (n)"; print "\n#define PRI PRId64";