diff options
author | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-09-24 02:55:31 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-09-26 20:23:24 +0200 |
commit | 29ff9055c80efe77a7130767a9fcb3ab8c67e8ce (patch) | |
tree | b061656c1336d7d73ed5eef59352e3d50d8147a7 /libpthread/nptl/sysdeps/unix/sysv/linux | |
parent | b06f85d62c41a4ed108628b1c564203f36c0ab4e (diff) |
use a single libc and deduplicate threading code
Similar to musl libc a single libc has many benefits and solves
some open issues with uClibc-ng.
- no pthread_mutex_* weak symbols exported anymore
- applications no longer failing to link when either
-lrt or -lpthread are missing for dynamic and static linking mode
- smaller C library
- slightly better runtime performance
Diffstat (limited to 'libpthread/nptl/sysdeps/unix/sysv/linux')
26 files changed, 9 insertions, 353 deletions
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch index 57481fdb5..649d188e6 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch @@ -62,7 +62,6 @@ libpthread_linux_CSRC += pthread_attr_getaffinity.c pthread_attr_setaffinity.c \ pthread_getcpuclockid.c pthread_kill.c \ pthread_mutex_cond_lock.c pthread_yield.c \ sem_post.c sem_timedwait.c sem_trywait.c sem_wait.c \ - pt-tempname.c \ pthread_sigqueue.c \ lowlevellock.c lowlevelrobustlock.c diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch index 468e64692..fa5d530d4 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch @@ -6,8 +6,7 @@ # libpthread_linux_arch_SSRC = -libpthread_linux_arch_CSRC = pthread_once.c \ - pt-__syscall_rt_sigaction.c pt-__syscall_error.c +libpthread_linux_arch_CSRC = pthread_once.c libc_linux_arch_CSRC = fork.c libc_linux_arch_SSRC = clone.S vfork.S diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/pt-__syscall_error.c b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/pt-__syscall_error.c deleted file mode 100644 index 8002e65c3..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/pt-__syscall_error.c +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com) - * - * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball. - */ - -#include <../../../../../../../libc/sysdeps/linux/arc/__syscall_error.c> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/pt-__syscall_rt_sigaction.c b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/pt-__syscall_rt_sigaction.c deleted file mode 100644 index 967dad1b0..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/pt-__syscall_rt_sigaction.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com) - * - * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball. - */ - -/* - * ARC syscall ABI only has __NR_rt_sigaction, thus vanilla sigaction does - * some SA_RESTORER tricks before calling __syscall_rt_sigaction. - * However including that file here causes a redefinition of __libc_sigaction - * in static links involving pthreads - */ -//#include <../../../../../../../libc/sysdeps/linux/arc/sigaction.c> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch index 80a03069f..49d0684ee 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch @@ -6,8 +6,7 @@ # libpthread_linux_arch_SSRC = -libpthread_linux_arch_CSRC = pthread_once.c \ - pt-__syscall_rt_sigaction.c pt-__syscall_error.c +libpthread_linux_arch_CSRC = pthread_once.c libc_linux_arch_CSRC = fork.c libc_linux_arch_SSRC = clone.S vfork.S @@ -16,7 +15,5 @@ libc_linux_arch_SSRC-OMIT = waitpid.S # We always compile it in arm mode because of SAVE_PID macro # This macro should be alternatively implemented in THUMB # assembly. -ASFLAGS-pt-vfork.S = -marm -CFLAGS-OMIT-pt-vfork.S = -mthumb ASFLAGS-vfork.S = -marm CFLAGS-OMIT-vfork.S = -mthumb diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-__syscall_error.c b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-__syscall_error.c deleted file mode 100644 index 5a48a9b2e..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-__syscall_error.c +++ /dev/null @@ -1 +0,0 @@ -#include <../../../../../../../libc/sysdeps/linux/arm/__syscall_error.c> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-__syscall_rt_sigaction.c b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-__syscall_rt_sigaction.c deleted file mode 100644 index 50137c84a..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-__syscall_rt_sigaction.c +++ /dev/null @@ -1 +0,0 @@ -#include <../../../../../../../libc/sysdeps/linux/common/__syscall_rt_sigaction.c> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch index 9dc878c4c..be07d9c85 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch @@ -6,7 +6,7 @@ # libpthread_linux_arch_SSRC = clone.S pthread_spin_unlock.S pthread_once.S -libpthread_linux_arch_CSRC = pthread_spin_init.c pt-__syscall_error.c +libpthread_linux_arch_CSRC = pthread_spin_init.c libc_linux_arch_CSRC = fork.c libc_linux_arch_SSRC = clone.S vfork.S diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/pt-__syscall_error.c b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/pt-__syscall_error.c deleted file mode 100644 index 620640ad6..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/pt-__syscall_error.c +++ /dev/null @@ -1 +0,0 @@ -#include <../../../../../../../libc/sysdeps/linux/i386/__syscall_error.c> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c b/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c index 67587f489..6013ab040 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c @@ -27,13 +27,6 @@ extern void __pthread_cleanup_upto (__jmp_buf env, char *targetframe); void _longjmp_unwind (jmp_buf env, int val) { -#ifdef SHARED - if (__libc_pthread_functions_init) - PTHFCT_CALL (ptr___pthread_cleanup_upto, (env->__jmpbuf, - CURRENT_STACK_FRAME)); -#else - if (__pthread_cleanup_upto != NULL) __pthread_cleanup_upto (env->__jmpbuf, CURRENT_STACK_FRAME); -#endif } libc_hidden_def(_longjmp_unwind) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c b/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c index cc8d39090..0df9951a8 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c @@ -37,8 +37,7 @@ int * #endif __libc_pthread_init ( unsigned long int *ptr, - void (*reclaim) (void), - const struct pthread_functions *functions) + void (*reclaim) (void)) { /* Remember the pointer to the generation counter in libpthread. */ __fork_generation_pointer = ptr; @@ -46,28 +45,7 @@ __libc_pthread_init ( /* Called by a child after fork. */ __register_atfork (NULL, NULL, reclaim, NULL); -#ifdef SHARED - /* We copy the content of the variable pointed to by the FUNCTIONS - parameter to one in libc.so since this means access to the array - can be done with one memory access instead of two. - */ - memcpy (&__libc_pthread_functions, functions, - sizeof (__libc_pthread_functions)); - __libc_pthread_functions_init = 1; -#endif - #ifndef TLS_MULTIPLE_THREADS_IN_TCB return &__libc_multiple_threads; #endif } - -#ifdef SHARED -#if 0 -void -libc_freeres_fn (freeres_libptread) -{ - if (__libc_pthread_functions_init) - PTHFCT_CALL (ptr_freeres, ()); -} -#endif -#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/Makefile.arch index b38c3750a..0f4d8d327 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/Makefile.arch @@ -6,8 +6,7 @@ # libpthread_linux_arch_SSRC = -libpthread_linux_arch_CSRC = pthread_once.c \ - pt-__syscall_rt_sigaction.c pt-__syscall_error.c +libpthread_linux_arch_CSRC = pthread_once.c libc_linux_arch_CSRC = fork.c libc_linux_arch_SSRC = clone.S vfork.S diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/pt-__syscall_error.c b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/pt-__syscall_error.c deleted file mode 100644 index 8f97734e5..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/pt-__syscall_error.c +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (C) 2013 Imagination Technologies Ltd. - * - * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball. - */ - -#include <../../../../../../../libc/sysdeps/linux/metag/__syscall_error.c> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/pt-__syscall_rt_sigaction.c b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/pt-__syscall_rt_sigaction.c deleted file mode 100644 index 18769cac7..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/pt-__syscall_rt_sigaction.c +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (C) 2013 Imagination Technologies Ltd. - * - * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball. - */ - -#include <../../../../../../../libc/sysdeps/linux/common/__syscall_rt_sigaction.c> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch index f87dedca4..565efd4a3 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch @@ -6,7 +6,7 @@ # libpthread_linux_arch_SSRC = clone.S -libpthread_linux_arch_CSRC = pthread_once.c pt-__syscall_rt_sigaction.c +libpthread_linux_arch_CSRC = pthread_once.c libc_linux_arch_CSRC = fork.c libc_linux_arch_SSRC = clone.S vfork.S diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-__syscall_rt_sigaction.c b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-__syscall_rt_sigaction.c deleted file mode 100644 index 50137c84a..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-__syscall_rt_sigaction.c +++ /dev/null @@ -1 +0,0 @@ -#include <../../../../../../../libc/sysdeps/linux/common/__syscall_rt_sigaction.c> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch index df4bb6963..2abb1d22a 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch @@ -6,13 +6,10 @@ # libpthread_linux_arch_SSRC = -libpthread_linux_arch_CSRC = pthread_once.c pt-__syscall_error.c +libpthread_linux_arch_CSRC = pthread_once.c libc_linux_arch_CSRC = fork.c libc_linux_arch_SSRC = clone.S vfork.S -# powerpc32's PSEUDO_RET needs __syscall_error@local -librt_linux_arch_CSRC = pt-__syscall_error.c - ASFLAGS += -DUSE___THREAD diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/pt-__syscall_error.c b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/pt-__syscall_error.c deleted file mode 100644 index 2a402e5af..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/pt-__syscall_error.c +++ /dev/null @@ -1 +0,0 @@ -#include <../../../../../../../libc/sysdeps/linux/powerpc/__syscall_error.c> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-sigwait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-sigwait.c deleted file mode 100644 index bde0a9292..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-sigwait.c +++ /dev/null @@ -1,2 +0,0 @@ -#include <pthreadP.h> -#include "../../../../../../libc/signal/sigwait.c" diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pt-initfini.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pt-initfini.c deleted file mode 100644 index 71fef93d3..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pt-initfini.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Special .init and .fini section support for SH. NPTL version. - Copyright (C) 2003, 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 Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - In addition to the permissions in the GNU Library General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The Library General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - 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 Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - see <http://www.gnu.org/licenses/>. */ - -/* This file is compiled into assembly code which is then munged by a sed - script into two files: crti.s and crtn.s. - - * crti.s puts a function prologue at the beginning of the - .init and .fini sections and defines global symbols for - those addresses, so they can be called as functions. - - * crtn.s puts the corresponding function epilogues - in the .init and .fini sections. */ - -__asm__ ("\n\ -\n\ -#include \"defs.h\"\n\ -\n\ -/*@HEADER_ENDS*/\n\ -\n\ -/*@TESTS_BEGIN*/\n\ -\n\ -/*@TESTS_END*/\n\ -\n\ -/*@_init_PROLOG_BEGINS*/\n\ - .section .init\n\ - .align 5\n\ - .global _init\n\ - .type _init,@function\n\ -_init:\n\ - mov.l r12,@-r15\n\ - mov.l r14,@-r15\n\ - sts.l pr,@-r15\n\ - mova .L22,r0\n\ - mov.l .L22,r12\n\ - add r0,r12\n\ - mova .L24,r0\n\ - mov.l .L24,r1\n\ - add r0,r1\n\ - jsr @r1\n\ - mov r15,r14\n\ - bra 1f\n\ - nop\n\ - .align 2\n\ -.L22:\n\ - .long _GLOBAL_OFFSET_TABLE_\n\ -.L24:\n\ - .long __pthread_initialize_minimal_internal@PLT\n\ -1:\n\ - ALIGN\n\ - END_INIT\n\ -\n\ -/*@_init_PROLOG_ENDS*/\n\ -\n\ -/*@_init_EPILOG_BEGINS*/\n\ - .section .init\n\ - mov r14,r15\n\ - lds.l @r15+,pr\n\ - mov.l @r15+,r14\n\ - rts \n\ - mov.l @r15+,r12\n\ - END_INIT\n\ - \n\ -/*@_init_EPILOG_ENDS*/\n\ -\n\ -/*@_fini_PROLOG_BEGINS*/\n\ - .section .fini\n\ - .align 5\n\ - .global _fini\n\ - .type _fini,@function\n\ -_fini:\n\ - mov.l r12,@-r15\n\ - mov.l r14,@-r15\n\ - sts.l pr,@-r15\n\ - mova .L27,r0\n\ - mov.l .L27,r12\n\ - add r0,r12\n\ - mov r15,r14\n\ - ALIGN\n\ - END_FINI\n\ - bra 1f\n\ - nop\n\ - .align 2\n\ -.L27:\n\ - .long _GLOBAL_OFFSET_TABLE_\n\ -1:\n\ -/*@_fini_PROLOG_ENDS*/\n\ -\n\ -/*@_fini_EPILOG_BEGINS*/\n\ - .section .fini\n\ - mov r14,r15\n\ - lds.l @r15+,pr\n\ - mov.l @r15+,r14\n\ - rts \n\ - mov.l @r15+,r12\n\ -\n\ - END_FINI\n\ - \n\ -/*@_fini_EPILOG_ENDS*/\n\ -\n\ -/*@TRAILER_BEGINS*/\n\ -"); diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch index 01a9e879a..f93ad4d8d 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch @@ -7,13 +7,10 @@ libpthread_linux_arch_SSRC = clone.S libpthread_linux_arch_CSRC = pthread_once.c lowlevellock.c \ - pthread_barrier_init.c pthread_barrier_wait.c pthread_barrier_destroy.c \ - pt-__syscall_error.c + pthread_barrier_init.c pthread_barrier_wait.c pthread_barrier_destroy.c libc_linux_arch_CSRC = fork.c libc-lowlevellock.c libc_linux_arch_SSRC = clone.S vfork.S -librt_linux_arch_CSRC = pt-__syscall_error.c - ASFLAGS += -DUSE___THREAD diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pt-__syscall_error.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pt-__syscall_error.c deleted file mode 100644 index 872e4eff6..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pt-__syscall_error.c +++ /dev/null @@ -1 +0,0 @@ -#include <../../../../../../../libc/sysdeps/linux/sparc/__syscall_error.c> 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 b49db548f..b48f4cb0b 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch @@ -11,7 +11,7 @@ libpthread_linux_arch_SSRC = clone.S pthread_once.S \ sem_trywait.S sem_wait.S pthread_rwlock_rdlock.S pthread_rwlock_wrlock.S \ pthread_rwlock_timedrdlock.S pthread_rwlock_timedwrlock.S pthread_rwlock_unlock.S \ pthread_spin_unlock.S cancellation.S -libpthread_linux_arch_CSRC = pthread_spin_init.c pt-__syscall_error.c +libpthread_linux_arch_CSRC = pthread_spin_init.c libc_linux_arch_CSRC = fork.c libc_linux_arch_SSRC = clone.S vfork.S libc-cancellation.S libc-lowlevellock.S diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pt-__syscall_error.c b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pt-__syscall_error.c deleted file mode 100644 index 2ab81490c..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pt-__syscall_error.c +++ /dev/null @@ -1 +0,0 @@ -#include <../../../../../../../libc/sysdeps/linux/x86_64/__syscall_error.c> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/Makefile.arch index 8ebe28773..7014c3f04 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/Makefile.arch +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/Makefile.arch @@ -7,7 +7,6 @@ libpthread_linux_arch_CSRC = pthread_once.c libpthread_linux_arch_SSRC = CFLAGS-OMIT-fork.c = -DNOT_IN_libc -DIS_IN_libpthread -ASFLAGS-pt-vfork.S = -DNOT_IN_libc -DIS_IN_libpthread -D_LIBC_REENTRANT ASFLAGS-clone.S = -D_LIBC_REENTRANT ASFLAGS-vfork.S = -D_LIBC_REENTRANT diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/pt-initfini.c b/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/pt-initfini.c deleted file mode 100644 index 4e6d26e81..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/pt-initfini.c +++ /dev/null @@ -1,134 +0,0 @@ -/* Special .init and .fini section support. Linuxthread version. - Copyright (C) 1995,1996,1997,2000,2001,2002 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 of the License, or (at your option) any later version. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The Library General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - 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, - see <http://www.gnu.org/licenses/>. */ - -/* This file is compiled into assembly code which is then munged by a sed - script into two files: crti.s and crtn.s. - - * crti.s puts a function prologue at the beginning of the - .init and .fini sections and defines global symbols for - those addresses, so they can be called as functions. - - * crtn.s puts the corresponding function epilogues - in the .init and .fini sections. */ - -#include <stdlib.h> - -/* We use embedded asm for .section unconditionally, as this makes it - easier to insert the necessary directives into crtn.S. */ -#define SECTION(x) __asm__ (".section " x ) - -/* Embed an #include to pull in the alignment and .end directives. */ -__asm__ ("\n#include \"defs.h\""); -__asm__ ("\n#if defined __i686 && defined __ASSEMBLER__"); -__asm__ ("\n#undef __i686"); -__asm__ ("\n#define __i686 __i686"); -__asm__ ("\n#endif"); - -/* The initial common code ends here. */ -__asm__ ("\n/*@HEADER_ENDS*/"); - -/* To determine whether we need .end and .align: */ -__asm__ ("\n/*@TESTS_BEGIN*/"); -extern void dummy (void (*foo) (void)); -void -dummy (void (*foo) (void)) -{ - if (foo) - (*foo) (); -} -__asm__ ("\n/*@TESTS_END*/"); - -/* The beginning of _init: */ -__asm__ ("\n/*@_init_PROLOG_BEGINS*/"); - -static void -call_initialize_minimal (void) -{ - extern void __pthread_initialize_minimal_internal (void) - __attribute ((visibility ("hidden"))); - - __pthread_initialize_minimal_internal (); -} - -SECTION (".init"); -extern void __attribute__ ((section (".init"))) _init (void); -void -_init (void) -{ - /* The very first thing we must do is to set up the registers. */ - call_initialize_minimal (); - - __asm__ ("ALIGN"); - __asm__("END_INIT"); - /* Now the epilog. */ - __asm__ ("\n/*@_init_PROLOG_ENDS*/"); - __asm__ ("\n/*@_init_EPILOG_BEGINS*/"); - SECTION(".init"); -} -__asm__ ("END_INIT"); - -/* End of the _init epilog, beginning of the _fini prolog. */ -__asm__ ("\n/*@_init_EPILOG_ENDS*/"); -__asm__ ("\n/*@_fini_PROLOG_BEGINS*/"); - -SECTION (".fini"); -extern void __attribute__ ((section (".fini"))) _fini (void); -void -_fini (void) -{ - - /* End of the _fini prolog. */ - __asm__ ("ALIGN"); - __asm__ ("END_FINI"); - __asm__ ("\n/*@_fini_PROLOG_ENDS*/"); - - /* Xtensa: It doesn't really matter whether GCC thinks this is a leaf - function or not, and the scripts that are supposed to remove the - call don't catch the literal, resulting in an undefined symbol - reference. */ -#if 0 - { - /* Let GCC know that _fini is not a leaf function by having a dummy - function call here. We arrange for this call to be omitted from - either crt file. */ - extern void i_am_not_a_leaf (void); - i_am_not_a_leaf (); - } -#endif - - /* Beginning of the _fini epilog. */ - __asm__ ("\n/*@_fini_EPILOG_BEGINS*/"); - SECTION (".fini"); -} -__asm__ ("END_FINI"); - -/* End of the _fini epilog. Any further generated assembly (e.g. .ident) - is shared between both crt files. */ -__asm__ ("\n/*@_fini_EPILOG_ENDS*/"); -__asm__ ("\n/*@TRAILER_BEGINS*/"); - -/* End of file. */ |