From 0db2497936950725ae71e997091ef276a3ec43ee Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 2 Jan 2006 10:52:59 +0000 Subject: Updated to fedora-glibc-20060102T1045 --- nptl/ChangeLog | 40 +++++ nptl/Makefile | 2 +- nptl/sigaction.c | 47 ++++++ nptl/sysdeps/alpha/jmpbuf-unwind.h | 15 +- nptl/sysdeps/i386/jmpbuf-unwind.h | 15 +- nptl/sysdeps/mips/jmpbuf-unwind.h | 13 +- nptl/sysdeps/powerpc/jmpbuf-unwind.h | 15 +- nptl/sysdeps/pthread/sigaction.c | 58 ------- nptl/sysdeps/s390/jmpbuf-unwind.h | 18 ++- nptl/sysdeps/sh/jmpbuf-unwind.h | 17 ++- nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h | 15 +- nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h | 13 +- nptl/sysdeps/unix/sysv/linux/Makefile | 5 +- nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S | 24 +++ nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h | 122 +++------------ nptl/sysdeps/x86_64/jmpbuf-unwind.h | 15 +- nptl/tst-robust7.c | 195 ++++++++++++++++++++++++ nptl/tst-signal7.c | 59 +++++++ nptl/version.c | 4 +- 19 files changed, 508 insertions(+), 184 deletions(-) create mode 100644 nptl/sigaction.c delete mode 100644 nptl/sysdeps/pthread/sigaction.c create mode 100644 nptl/tst-robust7.c create mode 100644 nptl/tst-signal7.c (limited to 'nptl') diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 0b29a61e0d..b56a261696 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,43 @@ +2006-01-01 Ulrich Drepper + + * version.c: Update copyright year. + +2005-12-29 Kaz Kojima + + * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h: Remove explicit + .eh_frame section, use cfi_* directives. + * sysdeps/unix/sysv/linux/sh/lowlevellock.S: Add cfi instrumentation. + +2005-12-30 Ulrich Drepper + + * sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h: Undo last change for + now. + +2005-12-29 Ulrich Drepper + + * sysdeps/pthread/sigaction.c: Removed. + * sigaction.c: New file. + * sysdeps/unix/sysv/linux/Makefile: Define CFLAGS-sigaction.c. + +2005-12-28 Ulrich Drepper + + * Makefile (tests): Add tst-signal7. + * tst-signal7.c: New file. + +2005-12-27 Roland McGrath + + * sysdeps/x86_64/jmpbuf-unwind.h (_jmpbuf_sp): New inline function. + (_JMPBUF_UNWINDS_ADJ): Use it, to PTR_DEMANGLE before comparison. + * sysdeps/alpha/jmpbuf-unwind.h: Likewise. + * sysdeps/i386/jmpbuf-unwind.h: Likewise. + * sysdeps/mips/jmpbuf-unwind.h: Likewise. + * sysdeps/powerpc/jmpbuf-unwind.h: Likewise. + * sysdeps/s390/jmpbuf-unwind.h: Likewise. + * sysdeps/sh/jmpbuf-unwind.h: Likewise. + * sysdeps/sparc/sparc32/jmpbuf-unwind.h: Likewise. + * sysdeps/sparc/sparc64/jmpbuf-unwind.h: Likewise. + * sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h: Likewise. + 2005-12-27 Jakub Jelinek * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h: Add __next diff --git a/nptl/Makefile b/nptl/Makefile index a3b11730a1..b15b8ad23a 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -229,7 +229,7 @@ tests = tst-typesizes \ tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \ tst-flock1 tst-flock2 \ tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \ - tst-signal6 \ + tst-signal6 tst-signal7 \ tst-exec1 tst-exec2 tst-exec3 tst-exec4 \ tst-exit1 tst-exit2 tst-exit3 \ tst-stdio1 tst-stdio2 \ diff --git a/nptl/sigaction.c b/nptl/sigaction.c new file mode 100644 index 0000000000..60e1f1d355 --- /dev/null +++ b/nptl/sigaction.c @@ -0,0 +1,47 @@ +/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2002. + + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + + +/* This is no complete implementation. The file is meant to be + included in the real implementation to provide the wrapper around + __libc_sigaction. */ + +#include + +/* We use the libc implementation but we tell it to not allow + SIGCANCEL or SIGTIMER to be handled. */ +#define LIBC_SIGACTION 1 + + +int +__sigaction (sig, act, oact) + int sig; + const struct sigaction *act; + struct sigaction *oact; +{ + if (__builtin_expect (sig == SIGCANCEL || sig == SIGSETXID, 0)) + { + __set_errno (EINVAL); + return -1; + } + + return __libc_sigaction (sig, act, oact); +} +libc_hidden_weak (__sigaction) +weak_alias (__sigaction, sigaction) diff --git a/nptl/sysdeps/alpha/jmpbuf-unwind.h b/nptl/sysdeps/alpha/jmpbuf-unwind.h index 5cef8b1cf5..83b7a01a0e 100644 --- a/nptl/sysdeps/alpha/jmpbuf-unwind.h +++ b/nptl/sysdeps/alpha/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -20,12 +20,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[JB_SP]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj)) + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal lobngjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/i386/jmpbuf-unwind.h b/nptl/sysdeps/i386/jmpbuf-unwind.h index 5cef8b1cf5..83b7a01a0e 100644 --- a/nptl/sysdeps/i386/jmpbuf-unwind.h +++ b/nptl/sysdeps/i386/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -20,12 +20,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[JB_SP]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj)) + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal lobngjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/mips/jmpbuf-unwind.h b/nptl/sysdeps/mips/jmpbuf-unwind.h index 67cc969663..9ee03100e6 100644 --- a/nptl/sysdeps/mips/jmpbuf-unwind.h +++ b/nptl/sysdeps/mips/jmpbuf-unwind.h @@ -19,12 +19,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[0].__sp; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[0].__sp - (_adj)) + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal longjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/powerpc/jmpbuf-unwind.h b/nptl/sysdeps/powerpc/jmpbuf-unwind.h index 0b817160d3..d9090a591d 100644 --- a/nptl/sysdeps/powerpc/jmpbuf-unwind.h +++ b/nptl/sysdeps/powerpc/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -20,12 +20,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[JB_GPR1]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_GPR1] - (_adj)) + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal lobngjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/pthread/sigaction.c b/nptl/sysdeps/pthread/sigaction.c deleted file mode 100644 index 445a2cb36f..0000000000 --- a/nptl/sysdeps/pthread/sigaction.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* This is tricky. GCC doesn't like #include_next in the primary - source file and even if it did, the first #include_next is this - exact file anyway. */ -#ifndef LIBC_SIGACTION - -#include - -/* We use the libc implementation but we tell it to not allow - SIGCANCEL or SIGTIMER to be handled. */ -# define LIBC_SIGACTION 1 - -/* Note this include must be one that isn't found using a -I directory such - as -I. or -I.. for using an explicit path, because that - would reset the search path starting position for the #include_next - below, to after that -I directory, and skip the search we want to do. */ -# include "sigaction.c" - -int -__sigaction (sig, act, oact) - int sig; - const struct sigaction *act; - struct sigaction *oact; -{ - if (__builtin_expect (sig == SIGCANCEL || sig == SIGSETXID, 0)) - { - __set_errno (EINVAL); - return -1; - } - - return __libc_sigaction (sig, act, oact); -} -libc_hidden_weak (__sigaction) -weak_alias (__sigaction, sigaction) - -#else - -# include_next - -#endif /* LIBC_SIGACTION */ diff --git a/nptl/sysdeps/s390/jmpbuf-unwind.h b/nptl/sysdeps/s390/jmpbuf-unwind.h index 9f7e1ad583..81fa582540 100644 --- a/nptl/sysdeps/s390/jmpbuf-unwind.h +++ b/nptl/sysdeps/s390/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -21,6 +21,7 @@ #include #include #include +#include /* On s390{,x}, CFA is always 96 (resp. 160) bytes above actual %r15. */ @@ -29,9 +30,18 @@ (void *) (_Unwind_GetCFA (_context) \ - 32 - 2 * __WORDSIZE), _adj) -#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) \ - < (uintptr_t) (_jmpbuf)->__gregs[__JB_GPR15] - (_adj)) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[0].__gregs[__JB_GPR15]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + +#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal longjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/sh/jmpbuf-unwind.h b/nptl/sysdeps/sh/jmpbuf-unwind.h index cf6d25f041..3ef178b4d6 100644 --- a/nptl/sysdeps/sh/jmpbuf-unwind.h +++ b/nptl/sysdeps/sh/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -20,12 +20,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) -#define _JMPBUF_UNWINDS_ADJ(jmpbuf, address, adj) \ - ((uintptr_t) (address) - (adj) < (uintptr_t) (jmpbuf)[0].__regs[7] - (adj)) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[0].__regs[7]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + +#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal lobngjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h b/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h index 5cef8b1cf5..83b7a01a0e 100644 --- a/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h +++ b/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -20,12 +20,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[JB_SP]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj)) + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal lobngjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h b/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h index 77321aad3f..7752fe971e 100644 --- a/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h +++ b/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h @@ -20,12 +20,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[0].uc_mcontext.mc_fp; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[0].uc_mcontext.mc_fp - (_adj)) + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal lobngjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/unix/sysv/linux/Makefile b/nptl/sysdeps/unix/sysv/linux/Makefile index 991398242a..14f513c127 100644 --- a/nptl/sysdeps/unix/sysv/linux/Makefile +++ b/nptl/sysdeps/unix/sysv/linux/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. # This file is part of the GNU C Library. # Contributed by Ulrich Drepper , 2002. @@ -32,3 +32,6 @@ CFLAGS-fork.c = -D_IO_MTSAFE_IO CFLAGS-getpid.o = -fomit-frame-pointer CFLAGS-getpid.os = -fomit-frame-pointer endif + +# Needed in both the signal and nptl subdir. +CFLAGS-sigaction.c = -DWRAPPER_INCLUDE='' diff --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S index b4826ef7aa..ac3169889f 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S @@ -32,8 +32,11 @@ .type __lll_mutex_lock_wait,@function .hidden __lll_mutex_lock_wait .align 5 + cfi_startproc __lll_mutex_lock_wait: mov.l r8, @-r15 + cfi_adjust_cfa_offset(4) + cfi_rel_offset (r8, 0) mov r4, r6 mov r5, r8 mov #0, r7 /* No timeout. */ @@ -59,6 +62,7 @@ __lll_mutex_lock_wait: mov.l @r15+, r8 ret mov r2, r0 + cfi_endproc .size __lll_mutex_lock_wait,.-__lll_mutex_lock_wait @@ -67,6 +71,7 @@ __lll_mutex_lock_wait: .type __lll_mutex_timedlock_wait,@function .hidden __lll_mutex_timedlock_wait .align 5 + cfi_startproc __lll_mutex_timedlock_wait: /* Check for a valid timeout value. */ mov.l @(4,r6), r1 @@ -75,14 +80,21 @@ __lll_mutex_timedlock_wait: bt 3f mov.l r10, @-r15 + cfi_adjust_cfa_offset(4) + cfi_rel_offset (r10, 0) mov.l r9, @-r15 + cfi_adjust_cfa_offset(4) + cfi_rel_offset (r9, 0) mov.l r8, @-r15 + cfi_adjust_cfa_offset(4) + cfi_rel_offset (r8, 0) mov r4, r10 mov r6, r9 mov r5, r8 /* Stack frame for the timespec and timeval structs. */ add #-8, r15 + cfi_adjust_cfa_offset(8) 1: /* Get current time. */ @@ -162,6 +174,7 @@ __lll_mutex_timedlock_wait: 5: bra 6b mov #ETIMEDOUT, r0 + cfi_endproc .L1k: .word 1000 @@ -178,6 +191,7 @@ __lll_mutex_timedlock_wait: .type lll_unlock_wake_cb,@function .hidden lll_unlock_wake_cb .align 5 + cfi_startproc lll_unlock_wake_cb: DEC (@r4, r2) tst r2, r2 @@ -195,6 +209,7 @@ lll_unlock_wake_cb: 1: rts nop + cfi_endproc .size lll_unlock_wake_cb,.-lll_unlock_wake_cb #endif @@ -203,6 +218,7 @@ lll_unlock_wake_cb: .type __lll_mutex_unlock_wake,@function .hidden __lll_mutex_unlock_wake .align 5 + cfi_startproc __lll_mutex_unlock_wake: mov #FUTEX_WAKE, r5 mov #1, r6 /* Wake one thread. */ @@ -214,6 +230,7 @@ __lll_mutex_unlock_wake: SYSCALL_INST_PAD rts nop + cfi_endproc .size __lll_mutex_unlock_wake,.-__lll_mutex_unlock_wake @@ -222,14 +239,20 @@ __lll_mutex_unlock_wake: .type __lll_timedwait_tid,@function .hidden __lll_timedwait_tid .align 5 + cfi_startproc __lll_timedwait_tid: mov.l r9, @-r15 + cfi_adjust_cfa_offset(4) + cfi_rel_offset (r9, 0) mov.l r8, @-r15 + cfi_adjust_cfa_offset(4) + cfi_rel_offset (r8, 0) mov r4, r8 mov r5, r9 /* Stack frame for the timespec and timeval structs. */ add #-8, r15 + cfi_adjust_cfa_offset(8) 2: /* Get current time. */ @@ -292,6 +315,7 @@ __lll_timedwait_tid: 6: bra 3b mov #ETIMEDOUT, r0 + cfi_endproc .L1k2: .word 1000 diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h index fc3c2340b6..9a967eaf53 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h +++ b/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -49,27 +49,32 @@ .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \ .Lpseudo_cancel: \ sts.l pr,@-r15; \ - .LCFI0: \ + cfi_adjust_cfa_offset (4); \ + cfi_rel_offset (pr, 0); \ add _IMM16,r15; \ + cfi_adjust_cfa_offset (16); \ SAVE_ARGS_##args; \ - .LCFI1: \ CENABLE; \ LOAD_ARGS_##args; \ add _IMP16,r15; \ - .LCFI2: \ + cfi_adjust_cfa_offset (-16); \ lds.l @r15+,pr; \ - .LCFI3: \ + cfi_adjust_cfa_offset (-4); \ + cfi_restore (pr); \ DO_CALL(syscall_name, args); \ SYSCALL_INST_PAD; \ sts.l pr,@-r15; \ - .LCFI4: \ + cfi_adjust_cfa_offset (4); \ + cfi_rel_offset (pr, 0); \ mov.l r0,@-r15; \ - .LCFI5: \ + cfi_adjust_cfa_offset (4); \ + cfi_rel_offset (r0, 0); \ CDISABLE; \ mov.l @r15+,r0; \ - .LCFI6: \ + cfi_adjust_cfa_offset (-4); \ lds.l @r15+,pr; \ - .LCFI7: \ + cfi_adjust_cfa_offset (-4); \ + cfi_restore (pr); \ mov r0,r1; \ mov _IMM12,r2; \ shad r2,r1; \ @@ -78,106 +83,17 @@ bf .Lpseudo_end; \ .Lsyscall_error: \ SYSCALL_ERROR_HANDLER; \ - .Lpseudo_end: \ - /* Create unwinding information for the syscall wrapper. */ \ - .section .eh_frame,"a",@progbits; \ - .Lframe1: \ - .ualong .LECIE1-.LSCIE1; \ - .LSCIE1: \ - .ualong 0x0; \ - .byte 0x1; \ - AUGMENTATION_STRING; \ - .uleb128 0x1; \ - .sleb128 -4; \ - .byte 0x11; \ - AUGMENTATION_PARAM; \ - .byte 0xc; \ - .uleb128 0xf; \ - .uleb128 0x0; \ - .align 2; \ - .LECIE1: \ - .LSFDE1: \ - .ualong .LEFDE1-.LASFDE1; \ - .LASFDE1: \ - .ualong .LASFDE1-.Lframe1; \ - START_SYMBOL_REF; \ - .ualong .Lpseudo_end - .Lpseudo_start; \ - AUGMENTATION_PARAM_FDE; \ - .byte 0x4; \ - .ualong .LCFI0-.Lpseudo_start; \ - .byte 0xe; \ - .uleb128 0x4; \ - .byte 0x91; \ - .uleb128 0x1; \ - .byte 0x4; \ - .ualong .LCFI1-.LCFI0; \ - .byte 0xe; \ - .uleb128 0x14; \ - FRAME_REG_##args; \ - .byte 0x4; \ - .ualong .LCFI2-.LCFI1; \ - .byte 0xe; \ - .uleb128 0x4; \ - .byte 0x4; \ - .ualong .LCFI3-.LCFI2; \ - .byte 0xe; \ - .uleb128 0x0; \ - .byte 0xd1; \ - .byte 0x4; \ - .ualong .LCFI4-.LCFI3; \ - .byte 0xe; \ - .uleb128 0x4; \ - .byte 0x91; \ - .uleb128 0x1; \ - .byte 0x4; \ - .ualong .LCFI5-.LCFI4; \ - .byte 0xe; \ - .uleb128 0x8; \ - .byte 0x80; \ - .uleb128 0x2; \ - .byte 0x4; \ - .ualong .LCFI6-.LCFI5; \ - .byte 0xe; \ - .uleb128 0x4; \ - .byte 0xc0; \ - .byte 0x4; \ - .ualong .LCFI7-.LCFI6; \ - .byte 0xe; \ - .uleb128 0x0; \ - .byte 0xd1; \ - .align 2; \ - .LEFDE1: \ - .previous - -# ifdef SHARED -# define AUGMENTATION_STRING .string "zR" -# define AUGMENTATION_PARAM .uleb128 1; .byte 0x1b -# define AUGMENTATION_PARAM_FDE .uleb128 0 -# define START_SYMBOL_REF .long .Lpseudo_start-. -# else -# define AUGMENTATION_STRING .ascii "\0" -# define AUGMENTATION_PARAM -# define AUGMENTATION_PARAM_FDE -# define START_SYMBOL_REF .long .Lpseudo_start -# endif - -# define FRAME_REG_0 /* Nothing. */ -# define FRAME_REG_1 FRAME_REG_0; .byte 0x84; .uleb128 5 -# define FRAME_REG_2 FRAME_REG_1; .byte 0x85; .uleb128 4 -# define FRAME_REG_3 FRAME_REG_2; .byte 0x86; .uleb128 3 -# define FRAME_REG_4 FRAME_REG_3; .byte 0x87; .uleb128 2 -# define FRAME_REG_5 FRAME_REG_4 -# define FRAME_REG_6 FRAME_REG_5 + .Lpseudo_end: # undef PSEUDO_END # define PSEUDO_END(sym) \ END (sym) # define SAVE_ARGS_0 /* Nothing. */ -# define SAVE_ARGS_1 SAVE_ARGS_0; mov.l r4,@(0,r15) -# define SAVE_ARGS_2 SAVE_ARGS_1; mov.l r5,@(4,r15) -# define SAVE_ARGS_3 SAVE_ARGS_2; mov.l r6,@(8,r15) -# define SAVE_ARGS_4 SAVE_ARGS_3; mov.l r7,@(12,r15) +# define SAVE_ARGS_1 SAVE_ARGS_0; mov.l r4,@(0,r15); cfi_offset (r4,-4) +# define SAVE_ARGS_2 SAVE_ARGS_1; mov.l r5,@(4,r15); cfi_offset (r5,-8) +# define SAVE_ARGS_3 SAVE_ARGS_2; mov.l r6,@(8,r15); cfi_offset (r6,-12) +# define SAVE_ARGS_4 SAVE_ARGS_3; mov.l r7,@(12,r15); cfi_offset (r7,-16) # define SAVE_ARGS_5 SAVE_ARGS_4 # define SAVE_ARGS_6 SAVE_ARGS_5 diff --git a/nptl/sysdeps/x86_64/jmpbuf-unwind.h b/nptl/sysdeps/x86_64/jmpbuf-unwind.h index 345ed557c5..1a36c53d11 100644 --- a/nptl/sysdeps/x86_64/jmpbuf-unwind.h +++ b/nptl/sysdeps/x86_64/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -20,12 +20,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[JB_RSP]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_RSP] - (_adj)) + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal lobngjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/tst-robust7.c b/nptl/tst-robust7.c new file mode 100644 index 0000000000..2c5acb44ce --- /dev/null +++ b/nptl/tst-robust7.c @@ -0,0 +1,195 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2005. + + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + + +static pthread_barrier_t b; +static pthread_cond_t c = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t m; +static bool first = true; + + +static void * +tf (void *arg) +{ + long int n = (long int) arg; + + if (pthread_mutex_lock (&m) != 0) + { + printf ("thread %ld: mutex_lock failed\n", n + 1); + exit (1); + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("thread %ld: barrier_wait failed\n", n + 1); + exit (1); + } + + e = pthread_cond_wait (&c, &m); + if (first) + { + if (e != 0) + { + printf ("thread %ld: cond_wait failed\n", n + 1); + exit (1); + } + first = false; + } + else + { + if (e != EOWNERDEAD) + { + printf ("thread %ld: cond_wait did not return EOWNERDEAD\n", n + 1); + exit (1); + } + } + + if (pthread_cancel (pthread_self ()) != 0) + { + printf ("thread %ld: cancel failed\n", n + 1); + exit (1); + } + + pthread_testcancel (); + + printf ("thread %ld: testcancel returned\n", n + 1); + exit (1); +} + + +static int +do_test (void) +{ + pthread_mutexattr_t a; + if (pthread_mutexattr_init (&a) != 0) + { + puts ("mutexattr_init failed"); + return 1; + } + + if (pthread_mutexattr_setrobust_np (&a, PTHREAD_MUTEX_ROBUST_NP) != 0) + { + puts ("mutexattr_setrobust failed"); + return 1; + } + + if (pthread_mutex_init (&m, &a) != 0) + { + puts ("mutex_init failed"); + return 1; + } + + if (pthread_mutexattr_destroy (&a) != 0) + { + puts ("mutexattr_destroy failed"); + return 1; + } + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + +#define N 5 + pthread_t th[N]; + for (long int n = 0; n < N; ++n) + { + if (pthread_create (&th[n], NULL, tf, (void *) n) != 0) + { + printf ("pthread_create loop %ld failed\n", n + 1); + return 1; + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("parent: barrier_wait failed in round %ld\n", n + 1); + return 1; + } + } + + if (pthread_mutex_lock (&m) != 0) + { + puts ("parent: mutex_lock failed"); + return 1; + } + + if (pthread_mutex_unlock (&m) != 0) + { + puts ("parent: mutex_unlock failed"); + return 1; + } + + if (pthread_cond_broadcast (&c) != 0) + { + puts ("cond_broadcast failed"); + return 1; + } + + for (int n = 0; n < N; ++n) + { + void *res; + if (pthread_join (th[n], &res) != 0) + { + printf ("join round %d failed\n", n + 1); + return 1; + } + if (res != PTHREAD_CANCELED) + { + printf ("thread %d not canceled\n", n + 1); + return 1; + } + } + + int e = pthread_mutex_lock (&m); + if (e == 0) + { + puts ("parent: 2nd mutex_lock succeeded"); + return 1; + } + if (e != EOWNERDEAD) + { + puts ("parent: mutex_lock did not return EOWNERDEAD"); + return 1; + } + + if (pthread_mutex_unlock (&m) != 0) + { + puts ("parent: 2nd mutex_unlock failed"); + return 1; + } + + if (pthread_mutex_destroy (&m) != 0) + { + puts ("mutex_destroy failed"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/nptl/tst-signal7.c b/nptl/tst-signal7.c new file mode 100644 index 0000000000..82ef11c2d1 --- /dev/null +++ b/nptl/tst-signal7.c @@ -0,0 +1,59 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2005. + + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + + +static int +do_test (void) +{ + int result = 0; + + errno = 0; + if (sigaction (SIGCANCEL, NULL, NULL) == 0) + { + puts ("sigaction(SIGCANCEL) did not fail"); + result = 1; + } + else if (errno != EINVAL) + { + puts ("sigaction(SIGCANCEL) did not set errno to EINVAL"); + result = 1; + } + + errno = 0; + if (sigaction (SIGSETXID, NULL, NULL) == 0) + { + puts ("sigaction(SIGSETXID) did not fail"); + result = 1; + } + else if (errno != EINVAL) + { + puts ("sigaction(SIGSETXID) did not set errno to EINVAL"); + result = 1; + } + + return result; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/nptl/version.c b/nptl/version.c index 1be6b7f4a5..b69556e948 100644 --- a/nptl/version.c +++ b/nptl/version.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -23,7 +23,7 @@ static const char banner[] = #include "banner.h" -"Copyright (C) 2005 Free Software Foundation, Inc.\n\ +"Copyright (C) 2006 Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions.\n\ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\ PARTICULAR PURPOSE.\n" -- cgit 1.4.1