From 162cfaea20d807f0ae329efe39292a9b22593b41 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 22 Oct 2010 17:01:05 +0200 Subject: *: inline constant __sig{add,del}set and __sigismember text data bss dec hex filename - 318 4 0 322 142 libc/pwd_grp/lckpwdf.o + 312 4 0 316 13c libc/pwd_grp/lckpwdf.o - 166 0 1 167 a7 libc/stdlib/abort.o + 157 0 1 158 9e libc/stdlib/abort.o - 42 0 0 42 2a libc/sysdeps/linux/common/pause.o + 27 0 0 27 1b libc/sysdeps/linux/common/pause.o Signed-off-by: Denys Vlasenko --- libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libpthread') diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c index 2681961bf..4319d8dbe 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c @@ -175,7 +175,7 @@ __start_helper_thread (void) sigset_t ss; sigset_t oss; sigfillset (&ss); - __sigaddset (&ss, SIGCANCEL); + /*__sigaddset (&ss, SIGCANCEL); - already done by sigfillset */ INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, &oss, _NSIG / 8); -- cgit v1.2.3 From 9a4c8a3f2c753f4cee4bcbe23d28e23bbdb99e40 Mon Sep 17 00:00:00 2001 From: Alexander Gordeev Date: Thu, 7 Oct 2010 18:54:24 +0400 Subject: mips: fix errno setting after syscall If there was an error during syscall then after it's completion a3 register holds a non-zero value and v0 holds an actual error code which should be saved in errno. This can be achieved by calling __syscall_error with the value from v0 as a parameter. So this value should be stored in a0, but the appropriate assembly instructions are missing. Fixed this now by adding "move a0, v0". I think it was once fixed by 58c5f8ba4cdf62342d05a546d15404cbbb3c4e07 but then something went wrong. Again... Signed-off-by: Alexander Gordeev Signed-off-by: Bernhard Reutner-Fischer --- libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h | 3 ++- libpthread/nptl/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'libpthread') diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h index 1fff78239..b2c0dfe89 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h @@ -28,7 +28,8 @@ # undef PSEUDO # define PSEUDO(name, syscall_name, args) \ .align 2; \ - 99: la t9,__syscall_error; \ + 99: move a0, v0; \ + la t9,__syscall_error; \ jr t9; \ ENTRY (name) \ .set noreorder; \ diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h index 1cf625f4e..c2cd14fe9 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h @@ -26,12 +26,12 @@ # ifdef __PIC__ # define PSEUDO_CPLOAD .cpload t9; -# define PSEUDO_ERRJMP la t9, __syscall_error; jr t9; +# define PSEUDO_ERRJMP move a0, v0; la t9, __syscall_error; jr t9; # define PSEUDO_SAVEGP sw gp, 32(sp); cfi_rel_offset (gp, 32); # define PSEUDO_LOADGP lw gp, 32(sp); # else # define PSEUDO_CPLOAD -# define PSEUDO_ERRJMP j __syscall_error; +# define PSEUDO_ERRJMP move a0, v0; j __syscall_error; # define PSEUDO_SAVEGP # define PSEUDO_LOADGP # endif -- cgit v1.2.3 From 87fd5816c9a14c4457cb69afaece1d28e66256fa Mon Sep 17 00:00:00 2001 From: "Steven J. Magnani" Date: Wed, 10 Nov 2010 19:37:26 +0100 Subject: microblaze: thread support Header files needed to build linuxthreads.old for microblaze. Signed-off-by: Steven J. Magnani Signed-off-by: Bernhard Reutner-Fischer --- .../sysdeps/microblaze/pt-machine.h | 106 +++++++++++++++++++++ .../sysdeps/microblaze/sigcontextinfo.h | 17 ++++ 2 files changed, 123 insertions(+) create mode 100644 libpthread/linuxthreads.old/sysdeps/microblaze/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/microblaze/sigcontextinfo.h (limited to 'libpthread') diff --git a/libpthread/linuxthreads.old/sysdeps/microblaze/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/microblaze/pt-machine.h new file mode 100644 index 000000000..e8c03f9e5 --- /dev/null +++ b/libpthread/linuxthreads.old/sysdeps/microblaze/pt-machine.h @@ -0,0 +1,106 @@ +/* + * sysdeps/microblaze/pt-machine.h -- microblaze-specific pthread definitions + * + * Copyright (C) 2003 John Williams + * Copyright (C) 2002 NEC Electronics Corporation + * Copyright (C) 2002 Miles Bader + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License. See the file COPYING.LIB in the main + * directory of this archive for more details. + * + * Written by Miles Bader + */ + +#ifndef _PT_MACHINE_H +#define _PT_MACHINE_H 1 + +#include + +#ifndef PT_EI +# define PT_EI extern inline +#endif + +extern long int testandset (int *spinlock); +extern int __compare_and_swap (long *ptr, long old, long new); + +/* Get some notion of the current stack. Need not be exactly the top + of the stack, just something somewhere in the current frame. */ +#define CURRENT_STACK_FRAME __stack_pointer +register char *__stack_pointer __asm__ ("r1"); + +#define HAS_COMPARE_AND_SWAP +#define HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS +#define IMPLEMENT_TAS_WITH_CAS + +/* Atomically: If *PTR == OLD, set *PTR to NEW and return true, + otherwise do nothing and return false. */ +PT_EI int __compare_and_swap (long *ptr, long old, long new) +{ + unsigned long psw; + + /* disable interrupts */ + /* This is ugly ugly ugly! */ + __asm__ __volatile__ ("mfs %0, rmsr;" + "andi r3, %0, ~2;" + "mts rmsr, r3;" + : "=&r" (psw) + : + : "r3"); + + if (likely (*ptr == old)) + { + *ptr = new; + __asm__ __volatile__ ("mts rmsr, %0;" :: "r" (psw)); /* re-enable */ + return 1; + } + else + { + __asm__ __volatile__ ("mts rmsr, %0;" :: "r" (psw)); /* re-enable */ + return 0; + } +} + +/* like above's __compare_and_swap() but it first syncs the memory + (This is also the difference between both functions in e.g. + ../powerpc/pt-machine.h) + Doing this additional sync fixes a hang of __pthread_alt_unlock() + (Falk Brettschneider ) */ +PT_EI int +__compare_and_swap_with_release_semantics (long *p, + long oldval, long newval) +{ + __asm__ __volatile__ ("" : : : "memory"); /*MEMORY_BARRIER ();*/ + return __compare_and_swap (p, oldval, newval); +} + + +#ifndef IMPLEMENT_TAS_WITH_CAS +/* Spinlock implementation; required. */ +PT_EI long int testandset (int *spinlock) +{ + unsigned psw; + + /* disable interrupts */ + __asm__ __volatile__ ("mfs %0, rmsr;" + "andi r3, %0, ~2;" + "mts rmsr, r3;" + : "=&r" (psw) + : + : "r3"); + + if (*spinlock) + { + /* Enable ints */ + __asm__ __volatile__ ("mts rmsr, %0;" :: "r" (psw)); + return 1; + } else { + *spinlock=1; + /* Enable ints */ + __asm__ __volatile__ ("mts rmsr, %0;" :: "r" (psw)); + return 0; + } +} + +#endif +#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/microblaze/sigcontextinfo.h b/libpthread/linuxthreads.old/sysdeps/microblaze/sigcontextinfo.h new file mode 100644 index 000000000..de450ff8a --- /dev/null +++ b/libpthread/linuxthreads.old/sysdeps/microblaze/sigcontextinfo.h @@ -0,0 +1,17 @@ +/* + * sysdeps/v850/sigcontextinfo.h -- v850-specific pthread signal definitions + * + * Copyright (C) 2002 NEC Electronics Corporation + * Copyright (C) 2002 Miles Bader + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License. See the file COPYING.LIB in the main + * directory of this archive for more details. + * + * Written by Miles Bader + */ + +#include + +#define SIGCONTEXT struct sigcontext * +#define SIGCONTEXT_EXTRA_ARGS -- cgit v1.2.3 From c452a58e65a2600ab1e9a7be2e5a6e4cae0e8b2a Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 11 Nov 2010 15:54:19 +0000 Subject: ntpl: fix static linking by not leaking SSP_ALL_CFLAGS The SSP_ALL_CFLAGS in nptl arch CFLAGS leaks out and forces things like dl-support.c, brk.c, sbrk.c memcpy, etc to be built with -fstack-protector-all. This is bad when linking statically since initializing TLS will call those functions before SSP is initialized. The libpthread itself will still be built with -fstack-protector-all due to CFLAGS-nptl has SSP_ALL_CFLAGS in libpthread/nptl/Makefile.in Thanks to Timo Teras for helping with this. Signed-off-by: Natanael Copa Signed-off-by: Bernhard Reutner-Fischer --- libpthread/nptl/sysdeps/arm/Makefile.arch | 1 - libpthread/nptl/sysdeps/generic/Makefile.in | 2 -- libpthread/nptl/sysdeps/i386/Makefile.arch | 1 - libpthread/nptl/sysdeps/mips/Makefile.arch | 1 - libpthread/nptl/sysdeps/powerpc/Makefile.arch | 1 - libpthread/nptl/sysdeps/sh/Makefile.arch | 1 - libpthread/nptl/sysdeps/sparc/Makefile.arch | 1 - libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch | 1 - libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch | 1 - libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch | 1 - libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch | 1 - libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch | 1 - libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch | 1 - libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch | 1 - libpthread/nptl/sysdeps/x86_64/Makefile.arch | 1 - 15 files changed, 16 deletions(-) (limited to 'libpthread') diff --git a/libpthread/nptl/sysdeps/arm/Makefile.arch b/libpthread/nptl/sysdeps/arm/Makefile.arch index b7a9295fd..a8bc1aadf 100644 --- a/libpthread/nptl/sysdeps/arm/Makefile.arch +++ b/libpthread/nptl/sysdeps/arm/Makefile.arch @@ -15,4 +15,3 @@ ASFLAGS-pthread_spin_lock.S = -DNOT_IN_libc -DIS_IN_libpthread ASFLAGS-pthread_spin_trylock.S = -DNOT_IN_libc -DIS_IN_libpthread ASFLAGS-aeabi_read_tp.S = -DNOT_IN_libc=1 -CFLAGS-arm = $(SSP_ALL_CFLAGS) diff --git a/libpthread/nptl/sysdeps/generic/Makefile.in b/libpthread/nptl/sysdeps/generic/Makefile.in index 890fe050d..eb656ee17 100644 --- a/libpthread/nptl/sysdeps/generic/Makefile.in +++ b/libpthread/nptl/sysdeps/generic/Makefile.in @@ -19,8 +19,6 @@ libpthread_generic_libc_a_OBJS = $(libpthread_generic_libc_a_COBJ) libpthread_ld_tls_CSRC = dl-tls.c libpthread_ld_tls_COBJ = $(patsubst %.c,$(libpthread_generic_OUT)/%.o,$(libpthread_ld_tls_CSRC)) -CFLAGS-generic = $(SSP_ALL_CFLAGS) - objclean-y += CLEAN_libpthread/nptl/sysdeps/generic CLEAN_libpthread/nptl/sysdeps/generic: diff --git a/libpthread/nptl/sysdeps/i386/Makefile.arch b/libpthread/nptl/sysdeps/i386/Makefile.arch index 89962f743..957230384 100644 --- a/libpthread/nptl/sysdeps/i386/Makefile.arch +++ b/libpthread/nptl/sysdeps/i386/Makefile.arch @@ -8,4 +8,3 @@ CFLAGS-pthread_spin_lock.c += -D_GNU_SOURCE CFLAGS-pthread_create.c += -mpreferred-stack-boundary=4 -CFLAGS-i386 = $(SSP_ALL_CFLAGS) diff --git a/libpthread/nptl/sysdeps/mips/Makefile.arch b/libpthread/nptl/sysdeps/mips/Makefile.arch index 6085ec888..2762a2fe0 100644 --- a/libpthread/nptl/sysdeps/mips/Makefile.arch +++ b/libpthread/nptl/sysdeps/mips/Makefile.arch @@ -15,4 +15,3 @@ ASFLAGS-nptl-sysdep.S = -DNOT_IN_libc -DIS_IN_libpthread \ libc_arch_a_CSRC = libc-tls.c -CFLAGS-mips = $(SSP_ALL_CFLAGS) diff --git a/libpthread/nptl/sysdeps/powerpc/Makefile.arch b/libpthread/nptl/sysdeps/powerpc/Makefile.arch index edf3f4b44..18ddc28e7 100644 --- a/libpthread/nptl/sysdeps/powerpc/Makefile.arch +++ b/libpthread/nptl/sysdeps/powerpc/Makefile.arch @@ -5,4 +5,3 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CFLAGS-powerpc = $(SSP_ALL_CFLAGS) diff --git a/libpthread/nptl/sysdeps/sh/Makefile.arch b/libpthread/nptl/sysdeps/sh/Makefile.arch index eb4db6892..3cb58ec36 100644 --- a/libpthread/nptl/sysdeps/sh/Makefile.arch +++ b/libpthread/nptl/sysdeps/sh/Makefile.arch @@ -10,5 +10,4 @@ ASFLAGS-pthread_spin_trylock.S = -DNOT_IN_libc -DIS_IN_libpthread CFLAGS-pthread_spin_lock.c += -D_GNU_SOURCE -CFLAGS-sh = $(SSP_ALL_CFLAGS) diff --git a/libpthread/nptl/sysdeps/sparc/Makefile.arch b/libpthread/nptl/sysdeps/sparc/Makefile.arch index 449493535..52ac6dbe0 100644 --- a/libpthread/nptl/sysdeps/sparc/Makefile.arch +++ b/libpthread/nptl/sysdeps/sparc/Makefile.arch @@ -8,5 +8,4 @@ subdirs += libpthread/nptl/sysdeps/$(TARGET_ARCH)/$(TARGET_SUBARCH)/sparv9 CFLAGS-pthread_spin_lock.c += -D_GNU_SOURCE -CFLAGS-sparc = $(SSP_ALL_CFLAGS) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch index 2385d8d83..329d8a94e 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch @@ -14,7 +14,6 @@ libc_linux_arch_CSRC = fork.c libc-lowlevellock.c libc_linux_arch_SSRC = clone.S vfork.S libc_linux_arch_SSRC-OMIT = waitpid.S -CFLAGS += $(SSP_ALL_CFLAGS) CFLAGS-pthread_once.c = -DNOT_IN_libc -DIS_IN_libpthread CFLAGS-pt-__syscall_rt_sigaction.c = -DNOT_IN_libc -DIS_IN_libpthread diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch index 1348f4da1..9a34595f1 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch @@ -12,7 +12,6 @@ libc_linux_arch_CSRC = fork.c libc_linux_arch_SSRC = clone.S vfork.S ASFLAGS += -DUSE___THREAD -CFLAGS += $(SSP_ALL_CFLAGS) CFLAGS-pt-__syscall_error.c = -DNOT_IN_libc -DIS_IN_libpthread ASFLAGS-pt-vfork.S = -DNOT_IN_libc -DIS_IN_libpthread -D_LIBC_REENTRANT diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch index 2ff309576..84fe17e8e 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch @@ -12,7 +12,6 @@ libc_linux_arch_CSRC = fork.c libc_linux_arch_SSRC = clone.S vfork.S ASFLAGS += -DUSE___THREAD -CFLAGS += $(SSP_ALL_CFLAGS) CFLAGS-OMIT-fork.c = -DNOT_IN_libc -DIS_IN_libpthread ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch index ee75cdbdc..8581aea6f 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch @@ -15,7 +15,6 @@ libc_linux_arch_SSRC = clone.S vfork.S librt_linux_arch_CSRC = pt-__syscall_error.c ASFLAGS += -DUSE___THREAD -CFLAGS += $(SSP_ALL_CFLAGS) CFLAGS-pthread_once.c = -DNOT_IN_libc -DIS_IN_libpthread CFLAGS-lowlevellock.c = -DNOT_IN_libc -DIS_IN_libpthread diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch index 5ac6724ef..a8249e0f4 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch @@ -16,7 +16,6 @@ libc_linux_arch_CSRC = fork.c libc_linux_arch_SSRC = libc-lowlevellock.S clone.S vfork.S ASFLAGS += -DUSE___THREAD -CFLAGS += $(SSP_ALL_CFLAGS) ASFLAGS-pt-vfork.S = -DNOT_IN_libc -DIS_IN_libpthread -D_LIBC_REENTRANT ASFLAGS-pthread_once.S = -D_LIBC_REENTRANT diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch index d634894a5..88ca01a51 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch @@ -13,7 +13,6 @@ libc_linux_arch_CSRC = fork.c libc-lowlevellock.c libc_linux_arch_SSRC = clone.S vfork.S ASFLAGS += -DUSE___THREAD -CFLAGS += $(SSP_ALL_CFLAGS) ASFLAGS-pt-vfork.S = -DNOT_IN_libc -DIS_IN_libpthread -D_LIBC_REENTRANT CFLAGS-pthread_once.c = -DNOT_IN_libc -DIS_IN_libpthread diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch index 2ec338367..71df9861d 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch @@ -19,7 +19,6 @@ libc_linux_arch_SSRC-OMIT = waitpid.S librt_linux_arch_SSRC = librt-cancellation.S ASFLAGS += -DUSE___THREAD -CFLAGS += $(SSP_ALL_CFLAGS) CFLAGS-pt-__syscall_error.c = -DNOT_IN_libc -DIS_IN_libpthread ASFLAGS-pt-vfork.S = -DNOT_IN_libc -DIS_IN_libpthread -D_LIBC_REENTRANT diff --git a/libpthread/nptl/sysdeps/x86_64/Makefile.arch b/libpthread/nptl/sysdeps/x86_64/Makefile.arch index 7a955ff61..cf6f1c224 100644 --- a/libpthread/nptl/sysdeps/x86_64/Makefile.arch +++ b/libpthread/nptl/sysdeps/x86_64/Makefile.arch @@ -7,5 +7,4 @@ CFLAGS-pthread_spin_lock.c += -D_GNU_SOURCE -CFLAGS-x86_64 = $(SSP_ALL_CFLAGS) -- cgit v1.2.3