From 6a0aa4add30eecf76b9d14ad3f204e4017f9f22c Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 9 Feb 2011 20:08:20 +0100 Subject: arm: mv nptl specific atomic impl to common place Thanks to Nitin Garg for notincing! Signed-off-by: Bernhard Reutner-Fischer --- .../nptl/sysdeps/unix/sysv/linux/arm/bits/atomic.h | 122 --------------------- 1 file changed, 122 deletions(-) delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/arm/bits/atomic.h (limited to 'libpthread/nptl/sysdeps') diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/bits/atomic.h b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/bits/atomic.h deleted file mode 100644 index 8f63e2510..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/bits/atomic.h +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright (C) 2002, 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 - 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 - - -typedef int8_t atomic8_t; -typedef uint8_t uatomic8_t; -typedef int_fast8_t atomic_fast8_t; -typedef uint_fast8_t uatomic_fast8_t; - -typedef int32_t atomic32_t; -typedef uint32_t uatomic32_t; -typedef int_fast32_t atomic_fast32_t; -typedef uint_fast32_t uatomic_fast32_t; - -typedef intptr_t atomicptr_t; -typedef uintptr_t uatomicptr_t; -typedef intmax_t atomic_max_t; -typedef uintmax_t uatomic_max_t; - -void __arm_link_error (void); - -#ifdef __thumb2__ -#define atomic_full_barrier() \ - __asm__ __volatile__ \ - ("movw\tip, #0x0fa0\n\t" \ - "movt\tip, #0xffff\n\t" \ - "blx\tip" \ - : : : "ip", "lr", "cc", "memory"); -#else -#define atomic_full_barrier() \ - __asm__ __volatile__ \ - ("mov\tip, #0xffff0fff\n\t" \ - "mov\tlr, pc\n\t" \ - "add\tpc, ip, #(0xffff0fa0 - 0xffff0fff)" \ - : : : "ip", "lr", "cc", "memory"); -#endif - -/* Atomic compare and exchange. This sequence relies on the kernel to - provide a compare and exchange operation which is atomic on the - current architecture, either via cleverness on pre-ARMv6 or via - ldrex / strex on ARMv6. */ - -#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ - ({ __arm_link_error (); oldval; }) - -#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ - ({ __arm_link_error (); oldval; }) - -/* It doesn't matter what register is used for a_oldval2, but we must - specify one to work around GCC PR rtl-optimization/21223. Otherwise - it may cause a_oldval or a_tmp to be moved to a different register. */ - -#ifdef __thumb2__ -/* Thumb-2 has ldrex/strex. However it does not have barrier instructions, - so we still need to use the kernel helper. */ -#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ - register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ - register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ - register __typeof (oldval) a_tmp __asm__ ("r3"); \ - register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ - __asm__ __volatile__ \ - ("0:\tldr\t%[tmp],[%[ptr]]\n\t" \ - "cmp\t%[tmp], %[old2]\n\t" \ - "bne\t1f\n\t" \ - "mov\t%[old], %[old2]\n\t" \ - "movw\t%[tmp], #0x0fc0\n\t" \ - "movt\t%[tmp], #0xffff\n\t" \ - "blx\t%[tmp]\n\t" \ - "bcc\t0b\n\t" \ - "mov\t%[tmp], %[old2]\n\t" \ - "1:" \ - : [old] "=&r" (a_oldval), [tmp] "=&r" (a_tmp) \ - : [new] "r" (a_newval), [ptr] "r" (a_ptr), \ - [old2] "r" (a_oldval2) \ - : "ip", "lr", "cc", "memory"); \ - a_tmp; }) -#else -#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ - register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ - register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ - register __typeof (oldval) a_tmp __asm__ ("r3"); \ - register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ - __asm__ __volatile__ \ - ("0:\tldr\t%[tmp],[%[ptr]]\n\t" \ - "cmp\t%[tmp], %[old2]\n\t" \ - "bne\t1f\n\t" \ - "mov\t%[old], %[old2]\n\t" \ - "mov\t%[tmp], #0xffff0fff\n\t" \ - "mov\tlr, pc\n\t" \ - "add\tpc, %[tmp], #(0xffff0fc0 - 0xffff0fff)\n\t" \ - "bcc\t0b\n\t" \ - "mov\t%[tmp], %[old2]\n\t" \ - "1:" \ - : [old] "=&r" (a_oldval), [tmp] "=&r" (a_tmp) \ - : [new] "r" (a_newval), [ptr] "r" (a_ptr), \ - [old2] "r" (a_oldval2) \ - : "ip", "lr", "cc", "memory"); \ - a_tmp; }) -#endif - -#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ - ({ __arm_link_error (); oldval; }) -- cgit v1.2.3 From be88a80858ea4febcc621f87166fbf4c1753e513 Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Mon, 7 Feb 2011 18:03:36 +0100 Subject: nptl:arm: add a wrapper for .cfi_sections pseudo-ops ARM disables by default the support for ASM CFI directives. Anyway using an old version of binutils that does not support some new pseudo-op, the build fails as below: AS libpthread/nptl/sysdeps/unix/sysv/linux/close.oS libpthread/nptl/sysdeps/unix/sysv/linux/close.S: Assembler messages: libpthread/nptl/sysdeps/unix/sysv/linux/close.S:9: Error: unknown pseudo-op: `.cfi_sections' The problem is that the .cfi_sections pseudo should be wrapped by a macro that expands to nothing when the CFI is off. Signed-off-by: Carmelo Amoroso CC: Khem Ray --- libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h | 2 +- libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'libpthread/nptl/sysdeps') diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h index 7ac9ca1e9..f0e5f6b37 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h @@ -36,7 +36,7 @@ .type __##syscall_name##_nocancel,%function; \ .globl __##syscall_name##_nocancel; \ __##syscall_name##_nocancel: \ - .cfi_sections .debug_frame; \ + cfi_sections(.debug_frame); \ cfi_startproc; \ DO_CALL (syscall_name, args); \ PSEUDO_RET; \ diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c index e35374d34..15250157c 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c @@ -65,7 +65,7 @@ __asm__ ( " .globl _Unwind_Resume\n" " .type _Unwind_Resume, %function\n" "_Unwind_Resume:\n" -" .cfi_sections .debug_frame\n" +" " CFI_SECTIONS (.debug_frame) "\n" " " CFI_STARTPROC "\n" " stmfd sp!, {r4, r5, r6, lr}\n" " " CFI_ADJUST_CFA_OFFSET (16)" \n" -- cgit v1.2.3 From 1fc68eae4846de4a1e276e68aee743ef731f3e91 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:31:39 +0100 Subject: add missing prototypes Add some missing prototypes Signed-off-by: Peter S. Mazinger --- libpthread/nptl/sysdeps/generic/dl-tls.c | 2 ++ libpthread/nptl/sysdeps/generic/libc-tls.c | 1 + libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c | 1 + 3 files changed, 4 insertions(+) (limited to 'libpthread/nptl/sysdeps') diff --git a/libpthread/nptl/sysdeps/generic/dl-tls.c b/libpthread/nptl/sysdeps/generic/dl-tls.c index 4acfa4ba7..904da8b8d 100644 --- a/libpthread/nptl/sysdeps/generic/dl-tls.c +++ b/libpthread/nptl/sysdeps/generic/dl-tls.c @@ -66,6 +66,7 @@ oom (void) # endif +void *_dl_memalign(size_t alignment, size_t bytes); void *_dl_memalign(size_t alignment, size_t bytes) { return _dl_malloc(bytes); @@ -836,6 +837,7 @@ __tls_get_addr (GET_ADDR_ARGS) +void _dl_add_to_slotinfo (struct link_map *l); void _dl_add_to_slotinfo (struct link_map *l) { diff --git a/libpthread/nptl/sysdeps/generic/libc-tls.c b/libpthread/nptl/sysdeps/generic/libc-tls.c index b78d96483..c45e76120 100644 --- a/libpthread/nptl/sysdeps/generic/libc-tls.c +++ b/libpthread/nptl/sysdeps/generic/libc-tls.c @@ -110,6 +110,7 @@ init_static_tls (size_t memsz, size_t align) GL(dl_tls_static_nelem) = GL(dl_tls_max_dtv_idx); } +void __libc_setup_tls (size_t tcbsize, size_t tcbalign); void __libc_setup_tls (size_t tcbsize, size_t tcbalign) { diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c b/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c index f2795510a..642198bad 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c @@ -25,6 +25,7 @@ extern void __pthread_cleanup_upto (__jmp_buf env, char *targetframe); #pragma weak __pthread_cleanup_upto +void _longjmp_unwind (jmp_buf env, int val); void _longjmp_unwind (jmp_buf env, int val) { -- cgit v1.2.3 From 380b5c5b31bdbf5e171ce035009e5e53b0ea230d Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:33:21 +0100 Subject: use common sigthread.h NPTL build did not use the correct bits/sigthread.h, use a common version avoiding this. Signed-off-by: Peter S. Mazinger --- libpthread/nptl/sysdeps/pthread/bits/sigthread.h | 44 ------------------------ 1 file changed, 44 deletions(-) (limited to 'libpthread/nptl/sysdeps') diff --git a/libpthread/nptl/sysdeps/pthread/bits/sigthread.h b/libpthread/nptl/sysdeps/pthread/bits/sigthread.h index 9a524e57d..e69de29bb 100644 --- a/libpthread/nptl/sysdeps/pthread/bits/sigthread.h +++ b/libpthread/nptl/sysdeps/pthread/bits/sigthread.h @@ -1,44 +0,0 @@ -/* Signal handling function for threaded programs. - Copyright (C) 1998, 1999, 2000, 2002, 2009 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 - 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; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _BITS_SIGTHREAD_H -#define _BITS_SIGTHREAD_H 1 - -#if !defined _SIGNAL_H && !defined _PTHREAD_H -# error "Never include this file directly. Use instead" -#endif - -/* Functions for handling signals. */ - -/* Modify the signal mask for the calling thread. The arguments have - the same meaning as for sigprocmask(2). */ -extern int pthread_sigmask (int __how, - __const __sigset_t *__restrict __newmask, - __sigset_t *__restrict __oldmask)__THROW; - -/* Send signal SIGNO to the given thread. */ -extern int pthread_kill (pthread_t __threadid, int __signo) __THROW; - -#ifdef __USE_GNU -/* Queue signal and data to a thread. */ -extern int pthread_sigqueue (pthread_t __threadid, int __signo, - const union sigval __value) __THROW; -#endif - -#endif /* bits/sigthread.h */ -- cgit v1.2.3 From f00e553e4b084007781df5e4b5accc2e152da231 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:41:29 +0100 Subject: add missing prototypes Add some missing prototypes Signed-off-by: Peter S. Mazinger --- libpthread/nptl/sysdeps/generic/libc-tls.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libpthread/nptl/sysdeps') diff --git a/libpthread/nptl/sysdeps/generic/libc-tls.c b/libpthread/nptl/sysdeps/generic/libc-tls.c index c45e76120..e14fc26c6 100644 --- a/libpthread/nptl/sysdeps/generic/libc-tls.c +++ b/libpthread/nptl/sysdeps/generic/libc-tls.c @@ -242,6 +242,7 @@ _dl_tls_setup (void) return 0; } +extern void __pthread_initialize_minimal(void) __attribute__((weak)); /* This is the minimal initialization function used when libpthread is not used. */ -- cgit v1.2.3 From 526af41956be03b56e1bf33ec144e797256c1255 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 8 Mar 2011 02:12:11 -0600 Subject: nptl: fix compilation on x86_64 This commit gives us a fully functioning NPTL on x86-64 by using the GOTOFF macro as needed. Signed-off-by: William Pitcock Signed-off-by: Khem Raj --- libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S | 2 +- .../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S | 2 +- .../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S | 10 +--------- .../unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S | 2 +- .../unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S | 2 +- libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S | 2 +- 6 files changed, 6 insertions(+), 14 deletions(-) (limited to 'libpthread/nptl/sysdeps') diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S index f87532359..e59bdda44 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S @@ -163,7 +163,7 @@ __lll_timedlock_wait: cfi_startproc # ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime@GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S index 2eb8e29fa..5cc4256a5 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S @@ -118,7 +118,7 @@ __lll_robust_timedlock_wait: cfi_startproc # ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime@GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S index 3a965ad0b..645436f99 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S @@ -98,7 +98,7 @@ __pthread_cond_timedwait: 22: #ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime@GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif @@ -437,14 +437,6 @@ __pthread_cond_timedwait: /* Only clocks 0 and 1 are allowed so far. Both are handled in the kernel. */ leaq 32(%rsp), %rsi -# ifdef SHARED - movq __vdso_clock_gettime@GOTPCREL(%rip), %rax - movq (%rax), %rax - PTR_DEMANGLE (%rax) - jz 26f - call *%rax - jmp 27f -# endif 26: movl $__NR_clock_gettime, %eax syscall 27: diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S index 3629ffbe5..15edd6149 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S @@ -96,7 +96,7 @@ pthread_rwlock_timedrdlock: 11: #ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime@GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S index 23e1ee155..3c4a27912 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S @@ -93,7 +93,7 @@ pthread_rwlock_timedwrlock: 11: #ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime@GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S index 704a2223a..3ff34120c 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S @@ -61,7 +61,7 @@ sem_timedwait: #ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime@GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif -- cgit v1.2.3 From 1dd9275091d6cbb14d6b149770fc90cef53577cf Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 13:32:30 +0100 Subject: remove trailing ';' from _syscallX() Signed-off-by: Peter S. Mazinger --- libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-gettimeofday.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libpthread/nptl/sysdeps') diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-gettimeofday.c b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-gettimeofday.c index 08710f1c8..79faf54bf 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-gettimeofday.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-gettimeofday.c @@ -2,4 +2,4 @@ #include int gettimeofday (struct timeval *, struct timezone *) attribute_hidden; -_syscall2(int, gettimeofday, struct timeval *, tv, struct timezone *, tz); +_syscall2(int, gettimeofday, struct timeval *, tv, struct timezone *, tz) -- cgit v1.2.3