From 29ff9055c80efe77a7130767a9fcb3ab8c67e8ce Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sat, 24 Sep 2016 02:55:31 +0200 Subject: 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 --- Makefile.in | 30 +--- Rules.mak | 8 +- ldso/ldso/arm/dl-syscalls.h | 37 +---- ldso/ldso/fdpic/dl-inlines.h | 2 +- ldso/libdl/Makefile.in | 18 --- libc/Makefile.in | 31 +++- libc/misc/internals/__uClibc_main.c | 45 ------ libc/signal/Makefile.in | 7 +- libc/sysdeps/linux/arm/Makefile.arch | 1 - libc/sysdeps/linux/arm/libc-thumb_atomics.S | 1 - libc/sysdeps/linux/common/Makefile.in | 10 +- libc/sysdeps/linux/i386/Makefile.arch | 3 +- libcrypt/Makefile.in | 27 ---- libintl/Makefile.in | 26 ---- libm/Makefile.in | 27 ---- libnsl/Makefile.in | 27 ---- libpthread/linuxthreads/Makefile.in | 43 +---- libpthread/linuxthreads/forward.c | 173 --------------------- libpthread/linuxthreads/internals.h | 3 +- libpthread/linuxthreads/libc_pthread_init.c | 11 +- libpthread/linuxthreads/manager.c | 3 - libpthread/linuxthreads/pthread.c | 98 +----------- .../linuxthreads/sysdeps/pthread/bits/libc-lock.h | 66 +------- .../sysdeps/pthread/pthread-functions.h | 113 -------------- libpthread/nptl/Makefile.in | 54 +------ libpthread/nptl/forward.c | 169 -------------------- libpthread/nptl/init.c | 74 +-------- libpthread/nptl/pt-system.c | 35 ----- libpthread/nptl/pthreadP.h | 7 +- libpthread/nptl/pthread_setgid.c | 3 - libpthread/nptl/pthread_setuid.c | 3 - libpthread/nptl/res.c | 26 ---- libpthread/nptl/sysdeps/arm/Makefile.arch | 1 - libpthread/nptl/sysdeps/arm/aeabi_read_tp.S | 1 - libpthread/nptl/sysdeps/arm/thumb_atomics.S | 1 - libpthread/nptl/sysdeps/metag/metag_load_tp.S | 7 - libpthread/nptl/sysdeps/mips/nptl-sysdep.S | 2 - libpthread/nptl/sysdeps/pthread/Makefile.in | 51 ------ libpthread/nptl/sysdeps/pthread/bits/libc-lock.h | 10 -- libpthread/nptl/sysdeps/pthread/pt-initfini.c | 128 --------------- libpthread/nptl/sysdeps/pthread/pt-sigaction.c | 7 +- .../nptl/sysdeps/pthread/pthread-functions.h | 108 ------------- libpthread/nptl/sysdeps/pthread/setxid.h | 6 +- libpthread/nptl/sysdeps/pthread/uClibc-glue.h | 1 - .../sysdeps/unix/sysv/linux/Makefile.commonarch | 1 - .../nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch | 3 +- .../unix/sysv/linux/arc/pt-__syscall_error.c | 7 - .../sysv/linux/arc/pt-__syscall_rt_sigaction.c | 13 -- .../nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch | 5 +- .../unix/sysv/linux/arm/pt-__syscall_error.c | 1 - .../sysv/linux/arm/pt-__syscall_rt_sigaction.c | 1 - .../sysdeps/unix/sysv/linux/i386/Makefile.arch | 2 +- .../unix/sysv/linux/i386/pt-__syscall_error.c | 1 - .../nptl/sysdeps/unix/sysv/linux/jmp-unwind.c | 7 - .../sysdeps/unix/sysv/linux/libc_pthread_init.c | 24 +-- .../sysdeps/unix/sysv/linux/metag/Makefile.arch | 3 +- .../unix/sysv/linux/metag/pt-__syscall_error.c | 7 - .../sysv/linux/metag/pt-__syscall_rt_sigaction.c | 7 - .../sysdeps/unix/sysv/linux/mips/Makefile.arch | 2 +- .../sysv/linux/mips/pt-__syscall_rt_sigaction.c | 1 - .../sysdeps/unix/sysv/linux/powerpc/Makefile.arch | 5 +- .../unix/sysv/linux/powerpc/pt-__syscall_error.c | 1 - .../nptl/sysdeps/unix/sysv/linux/pt-sigwait.c | 2 - .../nptl/sysdeps/unix/sysv/linux/sh/pt-initfini.c | 125 --------------- .../sysdeps/unix/sysv/linux/sparc/Makefile.arch | 5 +- .../unix/sysv/linux/sparc/pt-__syscall_error.c | 1 - .../sysdeps/unix/sysv/linux/x86_64/Makefile.arch | 2 +- .../unix/sysv/linux/x86_64/pt-__syscall_error.c | 1 - .../sysdeps/unix/sysv/linux/xtensa/Makefile.arch | 1 - .../sysdeps/unix/sysv/linux/xtensa/pt-initfini.c | 134 ---------------- libpthread/nptl/sysdeps/xtensa/Makefile.arch | 3 - libresolv/Makefile.in | 27 ---- librt/Makefile.in | 34 ---- libuargp/Makefile.in | 25 --- libubacktrace/Makefile.in | 23 --- libutil/Makefile.in | 27 ---- test/argp/Makefile.in | 2 - 77 files changed, 79 insertions(+), 1928 deletions(-) delete mode 100644 libc/sysdeps/linux/arm/libc-thumb_atomics.S delete mode 100644 libpthread/linuxthreads/forward.c delete mode 100644 libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h delete mode 100644 libpthread/nptl/forward.c delete mode 100644 libpthread/nptl/pt-system.c delete mode 100644 libpthread/nptl/pthread_setgid.c delete mode 100644 libpthread/nptl/pthread_setuid.c delete mode 100644 libpthread/nptl/res.c delete mode 100644 libpthread/nptl/sysdeps/arm/aeabi_read_tp.S delete mode 100644 libpthread/nptl/sysdeps/arm/thumb_atomics.S delete mode 100644 libpthread/nptl/sysdeps/metag/metag_load_tp.S delete mode 100644 libpthread/nptl/sysdeps/mips/nptl-sysdep.S delete mode 100644 libpthread/nptl/sysdeps/pthread/pt-initfini.c delete mode 100644 libpthread/nptl/sysdeps/pthread/pthread-functions.h delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/arc/pt-__syscall_error.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/arc/pt-__syscall_rt_sigaction.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-__syscall_error.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-__syscall_rt_sigaction.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/i386/pt-__syscall_error.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/metag/pt-__syscall_error.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/metag/pt-__syscall_rt_sigaction.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-__syscall_rt_sigaction.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/pt-__syscall_error.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/pt-sigwait.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sh/pt-initfini.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pt-__syscall_error.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pt-__syscall_error.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/pt-initfini.c diff --git a/Makefile.in b/Makefile.in index 59656853e..c289ed34b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -363,12 +363,19 @@ else $(Q)cd $(PREFIX)$(DEVEL_PREFIX)include && $(RM) -f wchar-stub.h endif +EMPTY_LIB_NAMES = m crypt nsl resolv util dl rt pthread intl +EMPTY_LIBS = $(EMPTY_LIB_NAMES:%=lib/lib%.a) + +$(EMPTY_LIBS): + rm -f $(top_builddir)$@ + $(AR) rc $(top_builddir)$@ + # Installs startfiles install_startfiles: startfiles | $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR) -$(INSTALL) -m 644 $(startfiles) $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/ # Installs development library links. -install_dev: install_headers install_runtime install_startfiles | $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR) +install_dev: install_headers install_runtime install_startfiles $(EMPTY_LIBS) | $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR) -$(INSTALL) -m 644 $(top_builddir)lib/*.a $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/ ifeq ($(HAVE_SHARED),y) for i in `cd $(top_builddir) && find lib/ -type l -name 'lib[a-zA-Z]*.so' | \ @@ -389,28 +396,7 @@ else -$(INSTALL) -m 755 $(top_builddir)lib/libc.so $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/ endif echo "$(UBACKTRACE_ASNEEDED)" >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so -ifeq ($(UCLIBC_HAS_ARGP),y) -# Add the AS_NEEDED entry for libuargp.so - if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(SHARED_MAJORNAME) ] ; then \ - echo "GROUP ( $(UARGP_ASNEEDED) )" >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \ - fi -endif -ifeq ($(UCLIBC_HAS_THREADS),y) -ifneq ($(UCLIBC_HAS_LINUXTHREADS),y) -ifeq ($(HARDWIRED_ABSPATH),y) - if [ -f $(top_builddir)lib/libpthread.so -a -f $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)/libpthread.so.$(ABI_VERSION) ] ; then \ - $(RM) $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libpthread.so; \ - cp $(top_srcdir)extra/scripts/format.lds $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libpthread.so; \ - echo "GROUP ( $(RUNTIME_PREFIX)$(MULTILIB_DIR)/libpthread.so.$(ABI_VERSION) $(DEVEL_PREFIX)$(MULTILIB_DIR)/libpthread_nonshared.a )" \ - >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libpthread.so; \ - $(SED) -i -e 's://:/:g' $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libpthread.so; \ - fi -else - -$(INSTALL) -m 755 $(top_builddir)lib/libpthread.so $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/ -endif -endif -endif ifeq ($(PTHREADS_DEBUG_SUPPORT),y) $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \ $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libthread_db.so diff --git a/Rules.mak b/Rules.mak index f226dca71..9b76e4fd4 100644 --- a/Rules.mak +++ b/Rules.mak @@ -156,14 +156,10 @@ endif UCLIBC_LDSO := $(UCLIBC_LDSO_NAME).so.$(ABI_VERSION) NONSHARED_LIBNAME := uclibc_nonshared.a +NONSHARED_LIBPTHREAD := libpthread_nonshared.a + libc := $(top_builddir)lib/$(SHARED_LIBNAME) libc.depend := $(top_builddir)lib/$(SHARED_LIBNAME:.$(ABI_VERSION)=) -ifneq ($(ARCH_HAS_NO_SHARED),y) -libdl.depend := $(top_builddir)lib/libdl.so -endif -ifneq ($(HAS_NO_THREADS),y) -libpthread.depend := $(top_builddir)lib/libpthread.so -endif interp := $(top_builddir)lib/interp.os ldso := $(top_builddir)lib/$(UCLIBC_LDSO) headers_dep := $(top_builddir)include/bits/sysnum.h \ diff --git a/ldso/ldso/arm/dl-syscalls.h b/ldso/ldso/arm/dl-syscalls.h index 195461f83..f40c4fd31 100644 --- a/ldso/ldso/arm/dl-syscalls.h +++ b/ldso/ldso/arm/dl-syscalls.h @@ -1,36 +1 @@ -/* _call_via_rX calls are used in thumb ldso because of calls via - * function pointers, but ldso is not linked with anything which - * provides them, so define them here (only required for thumb). - */ -#if defined(__thumb__) -__asm__( - ".macro call_via register\n" - " .global _call_via_\\register\n" - " .hidden _call_via_\\register\n" - " .type _call_via_\\register, %function\n" - " .thumb_func\n" - "_call_via_\\register:\n" - " bx \\register\n" - " .size _call_via_\\register, . - _call_via_\\register\n" - ".endm\n" - - ".text\n" - ".thumb\n" - ".align 1\n" - " call_via r0\n" - " call_via r1\n" - " call_via r2\n" - " call_via r3\n" - " call_via r4\n" - " call_via r5\n" - " call_via r6\n" - " call_via r7\n" - " call_via r8\n" - " call_via r9\n" - " call_via r10\n" - " call_via r11\n" - " call_via r12\n" - " call_via r13\n" - " call_via r14\n" -); -#endif +/* stub for arch-specific syscall issues */ diff --git a/ldso/ldso/fdpic/dl-inlines.h b/ldso/ldso/fdpic/dl-inlines.h index a9bfc9311..f59087568 100644 --- a/ldso/ldso/fdpic/dl-inlines.h +++ b/ldso/ldso/fdpic/dl-inlines.h @@ -159,7 +159,7 @@ eq_pointer(void *p, void *q) return entry->entry_point == q; } -void * +static __always_inline void * _dl_funcdesc_for (void *entry_point, void *got_value) { struct elf_resolve *tpnt = ((void**)got_value)[2]; diff --git a/ldso/libdl/Makefile.in b/ldso/libdl/Makefile.in index 1ba877071..24e00faf0 100644 --- a/ldso/libdl/Makefile.in +++ b/ldso/libdl/Makefile.in @@ -26,8 +26,6 @@ endif LIBS-libdl.so := $(LIBS) $(ldso) -libdl_FULL_NAME := libdl-$(VERSION).so - libdl_DIR := $(top_srcdir)ldso/libdl libdl_OUT := $(top_builddir)ldso/libdl @@ -42,23 +40,7 @@ libdl-a-y := $(libdl-a-y:.o=.os) endif libdl-so-y := $(libdl_OUT)/libdl.oS -lib-a-$(HAVE_SHARED) += $(top_builddir)lib/libdl.a -lib-so-y += $(top_builddir)lib/libdl.so objclean-y += CLEAN_ldso/libdl -$(top_builddir)lib/libdl.so: $(libdl_OUT)/libdl_so.a $(libc.depend) - $(call link.so,$(libdl_FULL_NAME),$(ABI_VERSION)) - # link for backward compatibility - $(call link.so,$(libdl_FULL_NAME),0) - -$(libdl_OUT)/libdl_so.a: $(libdl-so-y) - $(Q)$(RM) $@ - $(do_ar) - -$(top_builddir)lib/libdl.a: $(libdl-a-y) - $(Q)$(INSTALL) -d $(dir $@) - $(Q)$(RM) $@ - $(do_ar) - CLEAN_ldso/libdl: $(do_rm) $(addprefix $(libdl_OUT)/*., o os oS a) diff --git a/libc/Makefile.in b/libc/Makefile.in index 05cec1875..55fd3d3ed 100644 --- a/libc/Makefile.in +++ b/libc/Makefile.in @@ -18,7 +18,7 @@ endif CFLAGS-libc :=# intentionally left blank LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libc.so := -Wl,--dsbt-index=2 LDFLAGS-libc.so := $(LDFLAGS) $(VERSION_SCRIPT) -Wl,-init,$(SYMBOL_PREFIX)__uClibc_init -LIBS-libc.so := $(interp) $(ldso) $(top_builddir)lib/$(NONSHARED_LIBNAME) +LIBS-libc.so := $(interp) $(ldso) $(top_builddir)lib/$(NONSHARED_LIBNAME) $(top_builddir)lib/$(NONSHARED_LIBPTHREAD) # we have SHARED_LIBNAME=libc.so.$(ABI_VERSION) defined in Rules.mak libc_FULL_NAME := libuClibc-$(VERSION).so @@ -42,7 +42,32 @@ else libc-a-y = $(libc-y) $(libc-static-y) endif +libc-a-y += $(libnsl-a-y) +libc-a-y += $(libresolv-a-y) +libc-a-$(HAVE_SHARED) += $(libdl-a-y) +libc-a-y += $(libm-a-y) +libc-a-$(UCLIBC_HAS_LIBUTIL) += $(libutil-a-y) +libc-a-$(UCLIBC_HAS_CRYPT) += $(libcrypt-a-y) +libc-a-$(UCLIBC_HAS_ARGP) += $(libuargp-a-y) +libc-a-$(UCLIBC_HAS_THREADS) += $(libpthread-a-y) +libc-a-$(UCLIBC_HAS_REALTIME) += $(librt-a-y) +libc-a-$(UCLIBC_HAS_GETTEXT_AWARENESS) += $(libintl-a-y) +libc-a-$(UCLIBC_HAS_BACKTRACE) += $(libubacktrace-a-y) + libc-so-y = $(libc-y:.o=.os) $(libc-shared-y) + +libc-so-y += $(libnsl-so-y) +libc-so-y += $(libresolv-so-y) +libc-so-y += $(libdl-so-y) +libc-so-y += $(libm-so-y) +libc-so-$(UCLIBC_HAS_LIBUTIL) += $(libutil-so-y) +libc-so-$(UCLIBC_HAS_CRYPT) += $(libcrypt-so-y) +libc-so-$(UCLIBC_HAS_ARGP) += $(libuargp-so-y) +libc-so-$(UCLIBC_HAS_THREADS) += $(libpthread-so-y) +libc-so-$(UCLIBC_HAS_REALTIME) += $(librt-so-y) +libc-so-$(UCLIBC_HAS_GETTEXT_AWARENESS) += $(libintl-so-y) +libc-so-$(UCLIBC_HAS_BACKTRACE) += $(libubacktrace-so-y) + lib-a-y += $(top_builddir)lib/libc.a lib-gdb-y += $(top_builddir)lib/libc.gdb lib-so-y += $(libc.depend) @@ -58,9 +83,9 @@ $(libc.depend): $(libc_OUT)/libc_so.a $(LIBS-libc.so) $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp $(Q)$(OUTPUT_FORMAT) >> $@.tmp ifeq ($(COMPAT_ATEXIT),y) - $(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(SHARED_LIBNAME) $(ASNEEDED) )" >> $@.tmp + $(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(NONSHARED_LIBPTHREAD) $(SHARED_LIBNAME) $(ASNEEDED) )" >> $@.tmp else - $(Q)echo "GROUP ( $(SHARED_LIBNAME) $(NONSHARED_LIBNAME) $(ASNEEDED) )" >> $@.tmp + $(Q)echo "GROUP ( $(SHARED_LIBNAME) $(NONSHARED_LIBNAME) $(NONSHARED_LIBPTHREAD) $(ASNEEDED) )" >> $@.tmp endif $(Q)mv $@.tmp $@ diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 9bb81fc83..46e24d891 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -29,7 +29,6 @@ #include #endif #ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include #include #include #include @@ -69,42 +68,6 @@ uintptr_t __stack_chk_guard attribute_relro; void internal_function _dl_aux_init (ElfW(auxv_t) *av); -#ifdef __UCLIBC_HAS_THREADS__ -/* - * uClibc internal locking requires that we have weak aliases - * for dummy functions in case libpthread.a is not linked in. - * This needs to be in compilation unit that is pulled always - * in or linker will disregard these weaks. - */ - -static int __pthread_return_0 (pthread_mutex_t *unused) { return 0; } -weak_alias (__pthread_return_0, __pthread_mutex_lock) -weak_alias (__pthread_return_0, __pthread_mutex_trylock) -weak_alias (__pthread_return_0, __pthread_mutex_unlock) - -int weak_function -__pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) -{ - return 0; -} - -void weak_function -_pthread_cleanup_push_defer(struct _pthread_cleanup_buffer *__buffer, - void (*__routine) (void *), void *__arg) -{ - __buffer->__routine = __routine; - __buffer->__arg = __arg; -} - -void weak_function -_pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer *__buffer, - int __execute) -{ - if (__execute) - __buffer->__routine(__buffer->__arg); -} -#endif /* __UCLIBC_HAS_THREADS__ */ - #endif /* !SHARED */ /* Defeat compiler optimization which assumes function addresses are never NULL */ @@ -492,20 +455,12 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, else { /* Remove the thread-local data. */ -# ifdef SHARED - __libc_pthread_functions.ptr__nptl_deallocate_tsd (); -# else __nptl_deallocate_tsd (); -# endif /* One less thread. Decrement the counter. If it is zero we terminate the entire process. */ result = 0; -# ifdef SHARED - unsigned int *const ptr = __libc_pthread_functions.ptr_nthreads; -# else unsigned int *const ptr = &__nptl_nthreads; -# endif if (! atomic_decrement_and_test (ptr)) /* Not much left to do but to exit the thread, not the process. */ diff --git a/libc/signal/Makefile.in b/libc/signal/Makefile.in index 6c355b5f1..d5639d10a 100644 --- a/libc/signal/Makefile.in +++ b/libc/signal/Makefile.in @@ -7,7 +7,7 @@ subdirs += libc/signal -CSRC-y := allocrtsig.c killpg.c raise.c sigaction.c sigaddset.c sigandset.c \ +CSRC-y := allocrtsig.c killpg.c sigaction.c sigaddset.c sigandset.c \ sigdelset.c sigempty.c sigfillset.c \ sigisempty.c sigismem.c sigjmp.c signal.c \ sigorset.c sigsetops.c sigwait.c @@ -16,7 +16,10 @@ CSRC-$(UCLIBC_HAS_OBSOLETE_BSD_SIGNAL) += \ CSRC-$(UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL) += sysv_signal.c CSRC-$(UCLIBC_SUSV4_LEGACY) += sigintr.c sigpause.c -CSRC-$(UCLIBC_HAS_THREADS_NATIVE):=$(filter-out raise.c,$(CSRC-y)) +# only use simple raise.c when threads are disabled +ifeq ($(UCLIBC_HAS_THREADS),) +CSRC-y += raise.c +endif ifneq ($(strip $(ARCH_OBJS-y)),) CSRC-y := $(filter-out $(notdir $(ARCH_OBJS-y:.o=.c)),$(CSRC-y)) diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch index cda3db206..78f753361 100644 --- a/libc/sysdeps/linux/arm/Makefile.arch +++ b/libc/sysdeps/linux/arm/Makefile.arch @@ -13,7 +13,6 @@ SSRC-y := \ vfork.S clone.S SSRC-$(UCLIBC_HAS_LFS) += mmap64.S -SSRC-$(UCLIBC_HAS_THREADS_NATIVE) += libc-thumb_atomics.S libc-nonshared-$(UCLIBC_HAS_THREADS_NATIVE) += $(ARCH_OUT)/libc-aeabi_read_tp.os libc-static-$(UCLIBC_HAS_THREADS_NATIVE) += $(ARCH_OUT)/libc-aeabi_read_tp.o CSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.c diff --git a/libc/sysdeps/linux/arm/libc-thumb_atomics.S b/libc/sysdeps/linux/arm/libc-thumb_atomics.S deleted file mode 100644 index e7bc8950d..000000000 --- a/libc/sysdeps/linux/arm/libc-thumb_atomics.S +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 887dc3d62..6c35bff0b 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -75,11 +75,13 @@ CSRC-$(if $(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_ADVANCED_REALTIME),y,) += \ fallocate.c $(filter fallocate64.c,$(CSRC-y)) # NPTL needs these internally: madvise.c CSRC-$(findstring y,$(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE)) += madvise.c +ifeq ($(UCLIBC_HAS_THREADS),y) +CSRC- += raise.c +endif ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) -CSRC- += fork.c getpid.c raise.c #open.c close.c read.c write.c +CSRC- += fork.c getpid.c CSRC- += $(if $(findstring =arm=,=$(TARGET_ARCH)=),vfork.c) CSRC- += $(if $(findstring =x86_64=,=$(TARGET_ARCH)=),vfork.c) -#CSRC- += $(if $(findstring =mips=y=,=$(TARGET_ARCH)=$(CONFIG_MIPS_O32_ABI)=),waitpid.c) CSRC- += $(if $(findstring =metag=,=$(TARGET_ARCH)=),vfork.c) endif ifneq ($(ARCH_HAS_DEPRECATED_SYSCALLS),y) @@ -97,6 +99,10 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_adjtime.c clock_getres.c clock_gettime.c cl nanosleep.c __rt_sigtimedwait.c __rt_sigwaitinfo.c sched_getparam.c \ sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \ sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c +# use clock_gettime.c from librt only for NPTL +ifeq ($(UCLIBC_HAS_REALTIME)$(UCLIBC_HAS_THREADS_NATIVE),yy) +CSRC- += clock_gettime.c +endif # clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typed_mem_get_info|pthread_mutex_timedlock|sem_timedwait CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c \ posix_fallocate.c posix_fallocate64.c diff --git a/libc/sysdeps/linux/i386/Makefile.arch b/libc/sysdeps/linux/i386/Makefile.arch index 1c72d23fd..581e10a5e 100644 --- a/libc/sysdeps/linux/i386/Makefile.arch +++ b/libc/sysdeps/linux/i386/Makefile.arch @@ -9,8 +9,7 @@ CSRC-y := brk.c __syscall_error.c sigaction.c SSRC-y := \ __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \ - sync_file_range.S syscall.S mmap.S \ - copysign.S + sync_file_range.S syscall.S mmap.S SSRC-$(UCLIBC_HAS_LFS) += mmap64.S SSRC-$(if $(findstring yy,$(UCLIBC_HAS_ADVANCED_REALTIME)$(UCLIBC_HAS_LFS)),y) += posix_fadvise64.S diff --git a/libcrypt/Makefile.in b/libcrypt/Makefile.in index eb2d45246..fe3df2995 100644 --- a/libcrypt/Makefile.in +++ b/libcrypt/Makefile.in @@ -9,13 +9,6 @@ subdirs += libcrypt CFLAGS-libcrypt := -DNOT_IN_libc -DIS_IN_libcrypt $(SSP_ALL_CFLAGS) -LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libcrypt.so := -Wl,--dsbt-index=4 -LDFLAGS-libcrypt.so := $(LDFLAGS) - -LIBS-libcrypt.so := $(LIBS) - -libcrypt_FULL_NAME := libcrypt-$(VERSION).so - libcrypt_DIR := $(top_srcdir)libcrypt libcrypt_OUT := $(top_builddir)libcrypt @@ -35,31 +28,11 @@ libcrypt-a-y := $(libcrypt_OBJ) endif libcrypt-so-y := $(libcrypt_OBJ:.o=.os) -lib-a-$(UCLIBC_HAS_CRYPT) += $(top_builddir)lib/libcrypt.a -lib-so-$(UCLIBC_HAS_CRYPT) += $(top_builddir)lib/libcrypt.so objclean-y += CLEAN_libcrypt -ifeq ($(DOPIC),y) -$(top_builddir)lib/libcrypt.so: $(top_builddir)lib/libcrypt.a $(libc.depend) -else -$(top_builddir)lib/libcrypt.so: $(libcrypt_OUT)/libcrypt_so.a $(libc.depend) -endif - $(call link.so,$(libcrypt_FULL_NAME),$(ABI_VERSION)) - # link for backward compatibility - $(call link.so,$(libcrypt_FULL_NAME),0) - -$(libcrypt_OUT)/libcrypt_so.a: $(libcrypt-so-y) - $(Q)$(RM) $@ - $(do_ar) - $(libcrypt_OUT)/libcrypt.oS: $(libcrypt_SRC) $(Q)$(RM) $@ $(compile-m) -$(top_builddir)lib/libcrypt.a: $(libcrypt-a-y) - $(Q)$(INSTALL) -d $(dir $@) - $(Q)$(RM) $@ - $(do_ar) - CLEAN_libcrypt: $(do_rm) $(addprefix $(libcrypt_OUT)/*., o os oS a) diff --git a/libintl/Makefile.in b/libintl/Makefile.in index 6c3e79b69..b54e23dad 100644 --- a/libintl/Makefile.in +++ b/libintl/Makefile.in @@ -9,12 +9,6 @@ subdirs += libintl CFLAGS-libintl := -DNOT_IN_libc -DIS_IN_libintl $(SSP_ALL_CFLAGS) -LDFLAGS-libintl.so := $(LDFLAGS) - -LIBS-libintl.so := $(LIBS) - -libintl_FULL_NAME := libintl-$(VERSION).so - MOBJ := \ gettext.o ngettext.o dgettext.o dcgettext.o dngettext.o dcngettext.o \ textdomain.o bindtextdomain.o bind_textdomain_codeset.o \ @@ -33,32 +27,12 @@ libintl-a-y := $(libintl_MOBJ) endif libintl-so-y := $(libintl_MOBJ:.o=.os) -lib-a-$(UCLIBC_HAS_GETTEXT_AWARENESS) += $(top_builddir)lib/libintl.a -lib-so-$(UCLIBC_HAS_GETTEXT_AWARENESS) += $(top_builddir)lib/libintl.so objclean-y += CLEAN_libintl -ifeq ($(DOPIC),y) -$(top_builddir)lib/libintl.so: $(top_builddir)lib/libintl.a $(libc.depend) -else -$(top_builddir)lib/libintl.so: $(libintl_OUT)/libintl_so.a $(libc.depend) -endif - $(call link.so,$(libintl_FULL_NAME),$(ABI_VERSION)) - # link for backward compatibility - $(call link.so,$(libintl_FULL_NAME),0) - -$(libintl_OUT)/libintl_so.a: $(libintl-so-y) - $(Q)$(RM) $@ - $(do_ar) - $(libintl_OUT)/libintl.oS: $(libintl_MSRC) $(Q)$(RM) $@ $(compile-m) -$(top_builddir)lib/libintl.a: $(libintl-a-y) - $(Q)$(INSTALL) -d $(dir $@) - $(Q)$(RM) $@ - $(do_ar) - $(libintl_MOBJ): $(libintl_MSRC) $(compile.m) diff --git a/libm/Makefile.in b/libm/Makefile.in index 0d6ca057e..9b40a9400 100644 --- a/libm/Makefile.in +++ b/libm/Makefile.in @@ -24,13 +24,6 @@ subdirs += libm libm/$(TARGET_ARCH) CFLAGS-libm := -DNOT_IN_libc -DIS_IN_libm $(SSP_ALL_CFLAGS) -LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libm.so := -Wl,--dsbt-index=5 -LDFLAGS-libm.so := $(LDFLAGS) - -LIBS-libm.so := $(LIBS) - -libm_FULL_NAME := libm-$(VERSION).so - libm_DIR:=$(top_srcdir)libm libm_OUT:=$(top_builddir)libm @@ -286,32 +279,12 @@ libm-a-y += $(libm_OBJS) endif libm-so-y += $(libm_OBJS:.o=.os) -lib-a-$(UCLIBC_HAS_FLOATS) += $(top_builddir)lib/libm.a -lib-so-$(UCLIBC_HAS_FLOATS) += $(top_builddir)lib/libm.so objclean-y += CLEAN_libm -ifeq ($(DOPIC),y) -$(top_builddir)lib/libm.so: $(top_builddir)lib/libm.a $(libc.depend) -else -$(top_builddir)lib/libm.so: $(libm_OUT)/libm_so.a $(libc.depend) -endif - $(call link.so,$(libm_FULL_NAME),$(ABI_VERSION)) - # link for backward compatibility - $(call link.so,$(libm_FULL_NAME),0) - -$(libm_OUT)/libm_so.a: $(libm-so-y) - $(Q)$(RM) $@ - $(do_ar) - $(libm_OUT)/libm.oS: $(libm_SRC) $(libm_MSRC_FL) $(libm_MSRC_LD) $(libm_ARCH_SRC) $(Q)$(RM) $@ $(compile-m) -$(top_builddir)lib/libm.a: $(libm-a-y) - $(Q)$(INSTALL) -d $(dir $@) - $(Q)$(RM) $@ - $(do_ar) - $(libm_MOBJ_FL): $(libm_MSRC_FL) $(compile.m) diff --git a/libnsl/Makefile.in b/libnsl/Makefile.in index e79268c76..d6ee95601 100644 --- a/libnsl/Makefile.in +++ b/libnsl/Makefile.in @@ -9,13 +9,6 @@ subdirs += libnsl CFLAGS-libnsl := -DNOT_IN_libc -DIS_IN_libnsl $(SSP_ALL_CFLAGS) -LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libnsl.so := -Wl,--dsbt-index=6 -LDFLAGS-libnsl.so := $(LDFLAGS) $(call link.asneeded,-lc) - -LIBS-libnsl.so := $(LIBS) - -libnsl_FULL_NAME := libnsl-$(VERSION).so - libnsl_DIR := $(top_srcdir)libnsl libnsl_OUT := $(top_builddir)libnsl @@ -29,27 +22,7 @@ libnsl-a-y := $(libnsl_OBJ) endif libnsl-so-y := $(libnsl_OBJ:.o=.os) -lib-a-$(UCLIBC_HAS_LIBNSL_STUB) += $(top_builddir)lib/libnsl.a -lib-so-$(UCLIBC_HAS_LIBNSL_STUB) += $(top_builddir)lib/libnsl.so objclean-y += CLEAN_libnsl -ifeq ($(DOPIC),y) -$(top_builddir)lib/libnsl.so: $(top_builddir)lib/libnsl.a $(libc.depend) -else -$(top_builddir)lib/libnsl.so: $(libnsl_OUT)/libnsl_so.a $(libc.depend) -endif - $(call link.so,$(libnsl_FULL_NAME),$(ABI_VERSION)) - # link for backward compatibility - $(call link.so,$(libnsl_FULL_NAME),0) - -$(libnsl_OUT)/libnsl_so.a: $(libnsl-so-y) - $(Q)$(RM) $@ - $(do_ar) - -$(top_builddir)lib/libnsl.a: $(libnsl-a-y) - $(Q)$(INSTALL) -d $(dir $@) - $(Q)$(RM) $@ - $(do_ar) - CLEAN_libnsl: $(do_rm) $(addprefix $(libnsl_OUT)/*., o os a) diff --git a/libpthread/linuxthreads/Makefile.in b/libpthread/linuxthreads/Makefile.in index 47c45eff1..ffdd5d4eb 100644 --- a/libpthread/linuxthreads/Makefile.in +++ b/libpthread/linuxthreads/Makefile.in @@ -11,20 +11,6 @@ subdirs += libpthread/linuxthreads CFLAGS-dir_linuxthreads := -DNOT_IN_libc -DIS_IN_libpthread CFLAGS-libpthread/linuxthreads := $(CFLAGS-dir_linuxthreads) $(SSP_ALL_CFLAGS) -ifeq ($(PTHREADS_DEBUG_SUPPORT),y) -LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs -else -LDFLAGS-libpthread.so := $(LDFLAGS) -endif -LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libpthread.so := -Wl,--dsbt-index=10 - -LIBS-libpthread.so := $(LIBS) $(ldso) - -START_FILE-libpthread.so := $(SHARED_START_FILES) -END_FILE-libpthread.so := $(SHARED_END_FILES) - -libpthread_FULL_NAME := libpthread-$(VERSION).so - libpthread_DIR := $(top_srcdir)libpthread/linuxthreads libpthread_OUT := $(top_builddir)libpthread/linuxthreads @@ -50,9 +36,8 @@ libpthread_OBJ := $(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpt # # Stuff that goes into libc.so, not libpthread.so # -CFLAGS-OMIT-forward.c := $(CFLAGS-dir_linuxthreads) CFLAGS-OMIT-libc_pthread_init.c := $(CFLAGS-dir_linuxthreads) -libpthread_libc_CSRC := forward.c libc_pthread_init.c +libpthread_libc_CSRC := libc_pthread_init.c libpthread_libc_OBJ := $(patsubst %.c, $(libpthread_OUT)/%.o,$(libpthread_libc_CSRC)) libc-static-y += $(libpthread_OUT)/libc_pthread_init.o libc-shared-y += $(libpthread_libc_OBJ:.o=.oS) @@ -64,24 +49,6 @@ libpthread-a-y += $(libpthread_OBJ) endif libpthread-so-y += $(libpthread_OBJ:.o=.oS) -lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a -lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so - -$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend) $(top_builddir)lib/libpthread_nonshared.a - $(call link.so,$(libpthread_FULL_NAME),$(ABI_VERSION)) - # link for backward compatibility - $(call link.so,$(libpthread_FULL_NAME),0) - $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp - $(Q)echo "GROUP ( $(notdir $@).$(ABI_VERSION) libpthread_nonshared.a )" >> $@.tmp - $(Q)mv $@.tmp $@ - -ifeq ($(PTHREADS_DEBUG_SUPPORT),y) -$(libpthread_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug) -endif -$(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y) - $(Q)$(RM) $@ - $(do_ar) - ifeq ($(PTHREADS_DEBUG_SUPPORT),y) $(libpthread_OUT)/libpthread.oS: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug) endif @@ -89,14 +56,6 @@ $(libpthread_OUT)/libpthread.oS: $(libpthread_SRC) $(Q)$(RM) $@ $(compile-m) -ifeq ($(PTHREADS_DEBUG_SUPPORT),y) -$(top_builddir)lib/libpthread.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug) -endif -$(top_builddir)lib/libpthread.a: $(libpthread-a-y) - $(Q)$(INSTALL) -d $(dir $@) - $(Q)$(RM) $@ - $(do_ar) - $(top_builddir)include/pthread.h: $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@ $(top_builddir)include/semaphore.h: diff --git a/libpthread/linuxthreads/forward.c b/libpthread/linuxthreads/forward.c deleted file mode 100644 index 08295c8db..000000000 --- a/libpthread/linuxthreads/forward.c +++ /dev/null @@ -1,173 +0,0 @@ -/* Copyright (C) 2002, 2003 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, see - . */ - -#include -#include -#include - -/* psm: keep this before internals.h */ -#if 0 -vda: here is why: -headers contain libc_hidden_proto(foo). -In libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h -adding libc_hidden_proto(foo) just before weak_extern (__pthread_initialize) -will not warn: - /* libc_hidden_proto(foo) */ - weak_extern (__pthread_initialize) - /* libc_hidden_proto(foo) */ -but adding after will! Which is extremely strange - -weak_extern expands into just "#pragma weak __pthread_initialize". -TODO: determine whether it is a gcc bug or what -(see gcc.gnu.org/PR36282). -For now, just include all headers before internals.h -(they are again included in internals.h - maybe remove them there later) -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "internals.h" - -/* Pointers to the libc functions. */ -struct pthread_functions __libc_pthread_functions attribute_hidden; - - -# define FORWARD2(name, rettype, decl, params, defaction) \ -rettype \ -name decl \ -{ \ - if (__libc_pthread_functions.ptr_##name == NULL) \ - defaction; \ - \ - return __libc_pthread_functions.ptr_##name params; \ -} - -# define FORWARD(name, decl, params, defretval) \ - FORWARD2 (name, int, decl, params, return defretval) - -FORWARD (pthread_attr_destroy, (pthread_attr_t *attr), (attr), 0) - -FORWARD (pthread_attr_init, (pthread_attr_t *attr), (attr), 0) - -FORWARD (pthread_attr_getdetachstate, - (const pthread_attr_t *attr, int *detachstate), (attr, detachstate), - 0) -FORWARD (pthread_attr_setdetachstate, (pthread_attr_t *attr, int detachstate), - (attr, detachstate), 0) - -FORWARD (pthread_attr_getinheritsched, - (const pthread_attr_t *attr, int *inherit), (attr, inherit), 0) -FORWARD (pthread_attr_setinheritsched, (pthread_attr_t *attr, int inherit), - (attr, inherit), 0) - -FORWARD (pthread_attr_getschedparam, - (const pthread_attr_t *attr, struct sched_param *param), - (attr, param), 0) -FORWARD (pthread_attr_setschedparam, - (pthread_attr_t *attr, const struct sched_param *param), - (attr, param), 0) - -FORWARD (pthread_attr_getschedpolicy, - (const pthread_attr_t *attr, int *policy), (attr, policy), 0) -FORWARD (pthread_attr_setschedpolicy, (pthread_attr_t *attr, int policy), - (attr, policy), 0) - -FORWARD (pthread_attr_getscope, - (const pthread_attr_t *attr, int *scope), (attr, scope), 0) -FORWARD (pthread_attr_setscope, (pthread_attr_t *attr, int scope), - (attr, scope), 0) - - -FORWARD (pthread_condattr_destroy, (pthread_condattr_t *attr), (attr), 0) -FORWARD (pthread_condattr_init, (pthread_condattr_t *attr), (attr), 0) - - -FORWARD (pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0) - -FORWARD (pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0) - -FORWARD (pthread_cond_init, - (pthread_cond_t *cond, const pthread_condattr_t *cond_attr), - (cond, cond_attr), 0) - -FORWARD (pthread_cond_signal, (pthread_cond_t *cond), (cond), 0) - -FORWARD (pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex), - (cond, mutex), 0) - -FORWARD (pthread_cond_timedwait, - (pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime), (cond, mutex, abstime), 0) - - -FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2), - (thread1, thread2), 1) - - -/* Use an alias to avoid warning, as pthread_exit is declared noreturn. */ -FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS)) -strong_alias (__pthread_exit, pthread_exit) - - -FORWARD (pthread_getschedparam, - (pthread_t target_thread, int *policy, struct sched_param *param), - (target_thread, policy, param), 0) -FORWARD (pthread_setschedparam, - (pthread_t target_thread, int policy, - const struct sched_param *param), (target_thread, policy, param), 0) - - -FORWARD (pthread_mutex_destroy, (pthread_mutex_t *mutex), (mutex), 0) - -FORWARD (pthread_mutex_init, - (pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr), - (mutex, mutexattr), 0) -strong_alias(pthread_mutex_init, __pthread_mutex_init) - -FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0) -strong_alias(pthread_mutex_lock, __pthread_mutex_lock) - -FORWARD (pthread_mutex_trylock, (pthread_mutex_t *mutex), (mutex), 0) -strong_alias(pthread_mutex_trylock, __pthread_mutex_trylock) - -FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0) -strong_alias(pthread_mutex_unlock, __pthread_mutex_unlock) - -FORWARD2 (pthread_self, pthread_t, (void), (), return 0) - - -FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate), - 0) - -FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0) - -#if 0 -FORWARD2 (_pthread_cleanup_push, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return) -#endif -FORWARD2 (_pthread_cleanup_push_defer, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return) - -#if 0 -FORWARD2 (_pthread_cleanup_pop, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return) -#endif -FORWARD2 (_pthread_cleanup_pop_restore, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return) diff --git a/libpthread/linuxthreads/internals.h b/libpthread/linuxthreads/internals.h index 1b310b564..ab6b01528 100644 --- a/libpthread/linuxthreads/internals.h +++ b/libpthread/linuxthreads/internals.h @@ -446,7 +446,6 @@ static __inline__ pthread_descr thread_self (void) /* Defined and used in libc.so. */ extern int __libc_multiple_threads attribute_hidden; -extern int __librt_multiple_threads; /* Internal global functions */ @@ -524,6 +523,6 @@ extern void __linuxthreads_create_event (void) attribute_hidden; extern void __linuxthreads_death_event (void) attribute_hidden; extern void __linuxthreads_reap_event (void) attribute_hidden; -#include +extern int * __libc_pthread_init (void); #endif /* internals.h */ diff --git a/libpthread/linuxthreads/libc_pthread_init.c b/libpthread/linuxthreads/libc_pthread_init.c index b64da05d1..26f1abcb6 100644 --- a/libpthread/linuxthreads/libc_pthread_init.c +++ b/libpthread/linuxthreads/libc_pthread_init.c @@ -18,20 +18,11 @@ #include #include -#include - int __libc_multiple_threads attribute_hidden __attribute__((nocommon)); -int * __libc_pthread_init (const struct pthread_functions *functions) +int * __libc_pthread_init (void) { -#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)); -#endif #if !defined __UCLIBC_HAS_TLS__ && defined __UCLIBC_HAS_XLOCALE__ /* Initialize thread-locale current locale to point to the global one. diff --git a/libpthread/linuxthreads/manager.c b/libpthread/linuxthreads/manager.c index e4022f8ea..2a1ee62af 100644 --- a/libpthread/linuxthreads/manager.c +++ b/libpthread/linuxthreads/manager.c @@ -47,9 +47,6 @@ # define USE_SELECT #endif -libpthread_hidden_proto(waitpid) -libpthread_hidden_proto(raise) - /* Array of active threads. Entry 0 is reserved for the initial thread. */ struct pthread_handle_struct __pthread_handles[PTHREAD_THREADS_MAX] = { { __LOCK_INITIALIZER, &__pthread_initial_thread, 0}, diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c index 00197b158..d02da6b6c 100644 --- a/libpthread/linuxthreads/pthread.c +++ b/libpthread/linuxthreads/pthread.c @@ -36,9 +36,6 @@ #include #include -libpthread_hidden_proto(waitpid) -libpthread_hidden_proto(raise) - /* These variables are used by the setup code. */ extern int _errno; extern int _h_errno; @@ -216,16 +213,12 @@ int __pthread_timedsuspend_new(pthread_descr self, const struct timespec *abstim values to some unreasonable value which will signal failing of all the functions below. */ #ifndef __NR_rt_sigaction -static int current_rtmin = -1; -static int current_rtmax = -1; int __pthread_sig_restart = SIGUSR1; int __pthread_sig_cancel = SIGUSR2; int __pthread_sig_debug; #else #if __SIGRTMAX - __SIGRTMIN >= 3 -static int current_rtmin = __SIGRTMIN + 3; -static int current_rtmax = __SIGRTMAX; int __pthread_sig_restart = __SIGRTMIN; int __pthread_sig_cancel = __SIGRTMIN + 1; int __pthread_sig_debug = __SIGRTMIN + 2; @@ -233,8 +226,6 @@ void (*__pthread_restart)(pthread_descr) = __pthread_restart_new; void (*__pthread_suspend)(pthread_descr) = __pthread_wait_for_restart_signal; int (*__pthread_timedsuspend)(pthread_descr, const struct timespec *) = __pthread_timedsuspend_new; #else -static int current_rtmin = __SIGRTMIN; -static int current_rtmax = __SIGRTMAX; int __pthread_sig_restart = SIGUSR1; int __pthread_sig_cancel = SIGUSR2; int __pthread_sig_debug; @@ -242,32 +233,6 @@ void (*__pthread_restart)(pthread_descr) = __pthread_restart_old; void (*__pthread_suspend)(pthread_descr) = __pthread_suspend_old; int (*__pthread_timedsuspend)(pthread_descr, const struct timespec *) = __pthread_timedsuspend_old; -#endif - -/* Return number of available real-time signal with highest priority. */ -int __libc_current_sigrtmin (void) -{ - return current_rtmin; -} - -/* Return number of available real-time signal with lowest priority. */ -int __libc_current_sigrtmax (void) -{ - return current_rtmax; -} - -#if 0 -/* Allocate real-time signal with highest/lowest available - priority. Please note that we don't use a lock since we assume - this function to be called at program start. */ -int __libc_allocate_rtsig (int high); -int __libc_allocate_rtsig (int high) -{ - if (current_rtmin == -1 || current_rtmin > current_rtmax) - /* We don't have anymore signal available. */ - return -1; - return high ? current_rtmin++ : current_rtmax--; -} #endif #endif @@ -315,67 +280,6 @@ libpthread_hidden_proto(pthread_cond_timedwait) libpthread_hidden_proto(pthread_condattr_destroy) libpthread_hidden_proto(pthread_condattr_init) -struct pthread_functions __pthread_functions = - { -#if !defined __UCLIBC_HAS_TLS__ && defined __UCLIBC_HAS_RPC__ - .ptr_pthread_internal_tsd_set = __pthread_internal_tsd_set, - .ptr_pthread_internal_tsd_get = __pthread_internal_tsd_get, - .ptr_pthread_internal_tsd_address = __pthread_internal_tsd_address, -#endif -/* - .ptr_pthread_fork = __pthread_fork, -*/ - .ptr_pthread_attr_destroy = pthread_attr_destroy, - .ptr_pthread_attr_init = pthread_attr_init, - .ptr_pthread_attr_getdetachstate = pthread_attr_getdetachstate, - .ptr_pthread_attr_setdetachstate = pthread_attr_setdetachstate, - .ptr_pthread_attr_getinheritsched = pthread_attr_getinheritsched, - .ptr_pthread_attr_setinheritsched = pthread_attr_setinheritsched, - .ptr_pthread_attr_getschedparam = pthread_attr_getschedparam, - .ptr_pthread_attr_setschedparam = pthread_attr_setschedparam, - .ptr_pthread_attr_getschedpolicy = pthread_attr_getschedpolicy, - .ptr_pthread_attr_setschedpolicy = pthread_attr_setschedpolicy, - .ptr_pthread_attr_getscope = pthread_attr_getscope, - .ptr_pthread_attr_setscope = pthread_attr_setscope, - .ptr_pthread_condattr_destroy = pthread_condattr_destroy, - .ptr_pthread_condattr_init = pthread_condattr_init, - .ptr_pthread_cond_broadcast = pthread_cond_broadcast, - .ptr_pthread_cond_destroy = pthread_cond_destroy, - .ptr_pthread_cond_init = pthread_cond_init, - .ptr_pthread_cond_signal = pthread_cond_signal, - .ptr_pthread_cond_wait = pthread_cond_wait, - .ptr_pthread_cond_timedwait = pthread_cond_timedwait, - .ptr_pthread_equal = pthread_equal, - .ptr___pthread_exit = pthread_exit, - .ptr_pthread_getschedparam = pthread_getschedparam, - .ptr_pthread_setschedparam = pthread_setschedparam, - .ptr_pthread_mutex_destroy = __pthread_mutex_destroy, - .ptr_pthread_mutex_init = __pthread_mutex_init, - .ptr_pthread_mutex_lock = __pthread_mutex_lock, - .ptr_pthread_mutex_trylock = __pthread_mutex_trylock, - .ptr_pthread_mutex_unlock = __pthread_mutex_unlock, - .ptr_pthread_self = pthread_self, - .ptr_pthread_setcancelstate = pthread_setcancelstate, - .ptr_pthread_setcanceltype = pthread_setcanceltype, -/* - .ptr_pthread_do_exit = pthread_do_exit, - .ptr_pthread_thread_self = pthread_thread_self, - .ptr_pthread_cleanup_upto = pthread_cleanup_upto, - .ptr_pthread_sigaction = pthread_sigaction, - .ptr_pthread_sigwait = pthread_sigwait, - .ptr_pthread_raise = pthread_raise, - .ptr__pthread_cleanup_push = _pthread_cleanup_push, - .ptr__pthread_cleanup_pop = _pthread_cleanup_pop, -*/ - .ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer, - .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore - }; -#ifdef SHARED -# define ptr_pthread_functions &__pthread_functions -#else -# define ptr_pthread_functions NULL -#endif - static int *__libc_multiple_threads_ptr; /* Do some minimal initialization which has to be done during the @@ -388,7 +292,7 @@ void __pthread_initialize_minimal(void) INIT_THREAD_SELF(&__pthread_initial_thread, 0); #endif - __libc_multiple_threads_ptr = __libc_pthread_init (ptr_pthread_functions); + __libc_multiple_threads_ptr = __libc_pthread_init (); } diff --git a/libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h b/libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h index a7c0249cf..c00d60bf0 100644 --- a/libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h +++ b/libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h @@ -105,13 +105,8 @@ typedef pthread_key_t __libc_key_t; (FUNC != NULL ? FUNC ARGS : ELSE) # endif #endif -#if defined _LIBC && !defined NOT_IN_libc && defined SHARED -# define __libc_maybe_call2(FUNC, ARGS, ELSE) \ - ({__builtin_expect (__libc_pthread_functions.ptr_##FUNC != NULL, 0) \ - ? __libc_pthread_functions.ptr_##FUNC ARGS : ELSE; }) -#else -# define __libc_maybe_call2(FUNC, ARGS, ELSE) __libc_maybe_call (__##FUNC, ARGS, ELSE) -#endif + +#define __libc_maybe_call2(FUNC, ARGS, ELSE) __libc_maybe_call (__##FUNC, ARGS, ELSE) /* Initialize the named lock variable, leaving it in a consistent, unlocked state. */ @@ -351,63 +346,6 @@ extern int __pthread_atfork (void (*__prepare) (void), void (*__child) (void)); - -/* Make the pthread functions weak so that we can elide them from - single-threaded processes. */ -#ifndef __NO_WEAK_PTHREAD_ALIASES -# ifdef weak_extern -# define BP_SYM(sym) sym -weak_extern (BP_SYM (__pthread_mutex_init)) -weak_extern (BP_SYM (__pthread_mutex_destroy)) -weak_extern (BP_SYM (__pthread_mutex_lock)) -weak_extern (BP_SYM (__pthread_mutex_trylock)) -weak_extern (BP_SYM (__pthread_mutex_unlock)) -weak_extern (BP_SYM (__pthread_mutexattr_init)) -weak_extern (BP_SYM (__pthread_mutexattr_destroy)) -weak_extern (BP_SYM (__pthread_mutexattr_settype)) -weak_extern (BP_SYM (__pthread_rwlock_init)) -weak_extern (BP_SYM (__pthread_rwlock_destroy)) -weak_extern (BP_SYM (__pthread_rwlock_rdlock)) -weak_extern (BP_SYM (__pthread_rwlock_tryrdlock)) -weak_extern (BP_SYM (__pthread_rwlock_wrlock)) -weak_extern (BP_SYM (__pthread_rwlock_trywrlock)) -weak_extern (BP_SYM (__pthread_rwlock_unlock)) -weak_extern (BP_SYM (__pthread_key_create)) -weak_extern (BP_SYM (__pthread_setspecific)) -weak_extern (BP_SYM (__pthread_getspecific)) -weak_extern (BP_SYM (__pthread_once)) -weak_extern (__pthread_atfork) -weak_extern (BP_SYM (_pthread_cleanup_push)) -weak_extern (BP_SYM (_pthread_cleanup_pop)) -weak_extern (BP_SYM (_pthread_cleanup_push_defer)) -weak_extern (BP_SYM (_pthread_cleanup_pop_restore)) -# else -# pragma weak __pthread_mutex_init -# pragma weak __pthread_mutex_destroy -# pragma weak __pthread_mutex_lock -# pragma weak __pthread_mutex_trylock -# pragma weak __pthread_mutex_unlock -# pragma weak __pthread_mutexattr_init -# pragma weak __pthread_mutexattr_destroy -# pragma weak __pthread_mutexattr_settype -# pragma weak __pthread_rwlock_destroy -# pragma weak __pthread_rwlock_rdlock -# pragma weak __pthread_rwlock_tryrdlock -# pragma weak __pthread_rwlock_wrlock -# pragma weak __pthread_rwlock_trywrlock -# pragma weak __pthread_rwlock_unlock -# pragma weak __pthread_key_create -# pragma weak __pthread_setspecific -# pragma weak __pthread_getspecific -# pragma weak __pthread_once -# pragma weak __pthread_atfork -# pragma weak _pthread_cleanup_push_defer -# pragma weak _pthread_cleanup_pop_restore -# pragma weak _pthread_cleanup_push -# pragma weak _pthread_cleanup_pop -# endif -#endif - /* We need portable names for some functions. E.g., when they are used as argument to __libc_cleanup_region_start. */ #define __libc_mutex_unlock __pthread_mutex_unlock diff --git a/libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h b/libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h deleted file mode 100644 index 119953df0..000000000 --- a/libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2003. - - 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, see - . */ - -#ifndef _PTHREAD_FUNCTIONS_H -#define _PTHREAD_FUNCTIONS_H 1 - -#include -#if 0 -#include -#include - -struct fork_block; -#endif - -/* Data type shared with libc. The libc uses it to pass on calls to - the thread functions. Wine pokes directly into this structure, - so if possible avoid breaking it and append new hooks to the end. */ -struct pthread_functions -{ -#if 0 - pid_t (*ptr_pthread_fork) (struct fork_block *); -#endif - int (*ptr_pthread_attr_destroy) (pthread_attr_t *); - int (*ptr_pthread_attr_init) (pthread_attr_t *); - int (*ptr_pthread_attr_getdetachstate) (const pthread_attr_t *, int *); - int (*ptr_pthread_attr_setdetachstate) (pthread_attr_t *, int); - int (*ptr_pthread_attr_getinheritsched) (const pthread_attr_t *, int *); - int (*ptr_pthread_attr_setinheritsched) (pthread_attr_t *, int); - int (*ptr_pthread_attr_getschedparam) (const pthread_attr_t *, - struct sched_param *); - int (*ptr_pthread_attr_setschedparam) (pthread_attr_t *, - const struct sched_param *); - int (*ptr_pthread_attr_getschedpolicy) (const pthread_attr_t *, int *); - int (*ptr_pthread_attr_setschedpolicy) (pthread_attr_t *, int); - int (*ptr_pthread_attr_getscope) (const pthread_attr_t *, int *); - int (*ptr_pthread_attr_setscope) (pthread_attr_t *, int); - int (*ptr_pthread_condattr_destroy) (pthread_condattr_t *); - int (*ptr_pthread_condattr_init) (pthread_condattr_t *); - int (*ptr_pthread_cond_broadcast) (pthread_cond_t *); - int (*ptr_pthread_cond_destroy) (pthread_cond_t *); - int (*ptr_pthread_cond_init) (pthread_cond_t *, - const pthread_condattr_t *); - int (*ptr_pthread_cond_signal) (pthread_cond_t *); - int (*ptr_pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *); - int (*ptr_pthread_equal) (pthread_t, pthread_t); - void (*ptr___pthread_exit) (void *); - int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *); - int (*ptr_pthread_setschedparam) (pthread_t, int, - const struct sched_param *); - int (*ptr_pthread_mutex_destroy) (pthread_mutex_t *); - int (*ptr_pthread_mutex_init) (pthread_mutex_t *, - const pthread_mutexattr_t *); - int (*ptr_pthread_mutex_lock) (pthread_mutex_t *); - int (*ptr_pthread_mutex_trylock) (pthread_mutex_t *); - int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *); - pthread_t (*ptr_pthread_self) (void); - int (*ptr_pthread_setcancelstate) (int, int *); - int (*ptr_pthread_setcanceltype) (int, int *); -#if 0 - void (*ptr_pthread_do_exit) (void *retval, char *currentframe); - void (*ptr_pthread_cleanup_upto) (__jmp_buf target, - char *targetframe); - pthread_descr (*ptr_pthread_thread_self) (void); -#endif -#if !defined __UCLIBC_HAS_TLS__ && defined __UCLIBC_HAS_RPC__ - int (*ptr_pthread_internal_tsd_set) (int key, const void *pointer); - void * (*ptr_pthread_internal_tsd_get) (int key); - void ** __attribute__ ((__const__)) - (*ptr_pthread_internal_tsd_address) (int key); -#endif -#if 0 - int (*ptr_pthread_sigaction) (int sig, const struct sigaction * act, - struct sigaction *oact); - int (*ptr_pthread_sigwait) (const sigset_t *set, int *sig); - int (*ptr_pthread_raise) (int sig); -#endif - int (*ptr_pthread_cond_timedwait) (pthread_cond_t *, pthread_mutex_t *, - const struct timespec *); -#if 0 - void (*ptr__pthread_cleanup_push) (struct _pthread_cleanup_buffer * buffer, - void (*routine)(void *), void * arg); -#endif - void (*ptr__pthread_cleanup_push_defer) (struct _pthread_cleanup_buffer * buffer, - void (*routine)(void *), void * arg); -#if 0 - void (*ptr__pthread_cleanup_pop) (struct _pthread_cleanup_buffer * buffer, - int execute); -#endif - void (*ptr__pthread_cleanup_pop_restore) (struct _pthread_cleanup_buffer * buffer, - int execute); -}; - -/* Variable in libc.so. */ -extern struct pthread_functions __libc_pthread_functions attribute_hidden; - -extern int * __libc_pthread_init (const struct pthread_functions *functions); - -#endif /* pthread-functions.h */ diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in index f0d5ad611..0fc83e20e 100644 --- a/libpthread/nptl/Makefile.in +++ b/libpthread/nptl/Makefile.in @@ -12,14 +12,13 @@ libpthread_OUT = $(top_builddir)libpthread/nptl include $(libpthread_DIR)/sysdeps/Makefile.in -libc-shared-routines-y = forward.c libc-cancellation.c +libc-shared-routines-y = libc-cancellation.c libc-static-routines-y = alloca_cutoff.c libc-cancellation.c libpthread-shared-only-routines-y = version.c libpthread-static-only-routines-y = pthread_atfork.c libpthread-routines- += $(notdir $(wildcard $(libpthread_DIR)/gen_*.c)) # dummy generated files libpthread-routines- += allocatestack.c # dummy included by pthread_create.c libpthread-routines- += pthread_mutex_getprioceiling.c pthread_mutex_setprioceiling.c # XXX: delete those or use them! -libpthread-routines-$(UCLIBC_HAS_RESOLVER_SUPPORT) += res.c libpthread-routines-$(UCLIBC_SUSV4_LEGACY) += pthread_getconcurrency.c \ pthread_setconcurrency.c libpthread_CSRC = $(filter-out $(libpthread-routines-) \ @@ -42,6 +41,8 @@ else libpthread-a-y := $(libpthread-static-y) endif +libpthread-a-y += $(top_builddir)lib/libpthread_nonshared.a + libc-shared-routines-y := $(filter-out $(notdir $(libpthread_libc_OBJS:.o=.c)), $(libc-shared-routines-y)) libc-static-routines-y := $(filter-out $(notdir $(libpthread_libc_OBJS:.o=.c)), $(libc-static-routines-y)) libc-shared-routines-y := $(addprefix $(libpthread_OUT)/,$(libc-shared-routines-y:.c=.oS)) @@ -63,37 +64,6 @@ librt-a-y += $(librt_OBJS) endif librt-so-y += $(librt_OBJS:.o=.oS) $(librt-pt-shared-only-routines-y:.o=.oS) -ifeq ($(UCLIBC_CTOR_DTOR),y) -START_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/pt-crti.o -END_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/pt-crtn.o -LDFLAGS-libpthread.so += -nostartfiles -$(top_builddir)lib/libpthread.so: | $(START_FILE-libpthread.so) $(END_FILE-libpthread.so) -endif - -libpthread_FULL_NAME := libpthread-$(VERSION).so -lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a -lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so - -$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend) $(libdl.depend) $(top_builddir)lib/libpthread_nonshared.a - $(call link.so,$(libpthread_FULL_NAME),$(ABI_VERSION)) - # link for backward compatibility - $(call link.so,$(libpthread_FULL_NAME),0) - $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp - $(Q)echo "GROUP ( $(notdir $@).$(ABI_VERSION) libpthread_nonshared.a )" >> $@.tmp - $(Q)mv $@.tmp $@ - -ifeq ($(PTHREADS_DEBUG_SUPPORT),y) -$(libpthread_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug) -endif -$(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y) - $(Q)$(RM) $@ - $(do_ar) - -$(top_builddir)lib/libpthread.a: $(libpthread-a-y) - $(Q)$(INSTALL) -d $(dir $@) - $(Q)$(RM) $@ - $(do_ar) - $(libpthread_OUT)/pthread-errnos.h: $(top_srcdir)extra/scripts/gen-as-const.awk $(libpthread_OUT)/pthread-errnos.h: $(libpthread_DIR)/pthread-errnos.sym @$(disp_gen) @@ -132,17 +102,6 @@ HEADERCLEAN_libpthread/nptl: CLEAN_libpthread/nptl: $(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a) -ifeq ($(PTHREADS_DEBUG_SUPPORT),y) -LDFLAGS-libpthread.so += $(LDFLAGS_NOSTRIP) -Wl,-z,defs -else -LDFLAGS-libpthread.so += $(LDFLAGS) -endif - -LDFLAGS-libpthread.so += $(top_builddir)lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so $(top_builddir)lib/libdl-$(VERSION).so \ - -Wl,-z,nodelete,-z,initfirst,-init=$(SYMBOL_PREFIX)__pthread_initialize_minimal_internal - -LIBS-libpthread.so := $(LIBS) - CFLAGS-dir_nptl := -DNOT_IN_libc -DIS_IN_libpthread CFLAGS-libpthread/nptl := $(CFLAGS-dir_nptl) $(SSP_ALL_CFLAGS) @@ -171,10 +130,6 @@ CFLAGS-libc-cancellation.c = -fasynchronous-unwind-tables # function. CFLAGS-pthread_exit.c = -fexceptions -# Among others, __pthread_unwind is forwarded. This function must handle -# exceptions. -CFLAGS-forward.c = -fexceptions - # The following are cancellation points. Some of the functions can # block and therefore temporarily enable asynchronous cancellation. # Those must be compiled asynchronous unwind tables. @@ -235,8 +190,6 @@ CFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-write.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-writev.c = -fexceptions -fasynchronous-unwind-tables -CFLAGS-pt-system.c = -fexceptions -I$(top_srcdir)libc/stdlib - # # The rest of this file is uClibc specific. # @@ -249,6 +202,5 @@ CFLAGS-pthread_barrierattr_setpshared.c = -D_GNU_SOURCE CFLAGS-sem_open.c = -D_GNU_SOURCE CFLAGS-OMIT-alloca_cutoff.c = $(CFLAGS-dir_nptl) -CFLAGS-OMIT-forward.c = $(CFLAGS-dir_nptl) CFLAGS-OMIT-libc-lowlevelock.c = $(CFLAGS-dir_nptl) CFLAGS-OMIT-libc-cancellation.c = $(CFLAGS-dir_nptl) diff --git a/libpthread/nptl/forward.c b/libpthread/nptl/forward.c deleted file mode 100644 index 076d43711..000000000 --- a/libpthread/nptl/forward.c +++ /dev/null @@ -1,169 +0,0 @@ -/* Copyright (C) 2002, 2003, 2004, 2007 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, see - . */ - -#include -#include -#include -#include - -#include -#include - - -/* Pointers to the libc functions. */ -struct pthread_functions __libc_pthread_functions attribute_hidden; -int __libc_pthread_functions_init attribute_hidden; - - -#define FORWARD2(name, rettype, decl, params, defaction) \ -rettype \ -name decl \ -{ \ - if (!__libc_pthread_functions_init) { \ - defaction; \ - } else { \ - return PTHFCT_CALL (ptr_##name, params); \ - } \ -} - -#define FORWARD(name, decl, params, defretval) \ - FORWARD2 (name, int, decl, params, return defretval) - - -FORWARD (pthread_attr_destroy, (pthread_attr_t *attr), (attr), 0) - -FORWARD (__pthread_attr_init_2_1, (pthread_attr_t *attr), (attr), 0) -weak_alias(__pthread_attr_init_2_1, pthread_attr_init) - -FORWARD (pthread_attr_getdetachstate, - (const pthread_attr_t *attr, int *detachstate), (attr, detachstate), - 0) -FORWARD (pthread_attr_setdetachstate, (pthread_attr_t *attr, int detachstate), - (attr, detachstate), 0) - -FORWARD (pthread_attr_getinheritsched, - (const pthread_attr_t *attr, int *inherit), (attr, inherit), 0) -FORWARD (pthread_attr_setinheritsched, (pthread_attr_t *attr, int inherit), - (attr, inherit), 0) - -FORWARD (pthread_attr_getschedparam, - (const pthread_attr_t *attr, struct sched_param *param), - (attr, param), 0) -FORWARD (pthread_attr_setschedparam, - (pthread_attr_t *attr, const struct sched_param *param), - (attr, param), 0) - -FORWARD (pthread_attr_getschedpolicy, - (const pthread_attr_t *attr, int *policy), (attr, policy), 0) -FORWARD (pthread_attr_setschedpolicy, (pthread_attr_t *attr, int policy), - (attr, policy), 0) - -FORWARD (pthread_attr_getscope, - (const pthread_attr_t *attr, int *scope), (attr, scope), 0) -FORWARD (pthread_attr_setscope, (pthread_attr_t *attr, int scope), - (attr, scope), 0) - - -FORWARD (pthread_condattr_destroy, (pthread_condattr_t *attr), (attr), 0) -FORWARD (pthread_condattr_init, (pthread_condattr_t *attr), (attr), 0) - -FORWARD (__pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0) -weak_alias(__pthread_cond_broadcast, pthread_cond_broadcast) - -FORWARD (__pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0) -weak_alias(__pthread_cond_destroy, pthread_cond_destroy) - -FORWARD (__pthread_cond_init, - (pthread_cond_t *cond, const pthread_condattr_t *cond_attr), - (cond, cond_attr), 0) -weak_alias(__pthread_cond_init, pthread_cond_init) - -FORWARD (__pthread_cond_signal, (pthread_cond_t *cond), (cond), 0) -weak_alias(__pthread_cond_signal, pthread_cond_signal) - -FORWARD (__pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex), - (cond, mutex), 0) -weak_alias(__pthread_cond_wait, pthread_cond_wait) - -FORWARD (__pthread_cond_timedwait, - (pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime), (cond, mutex, abstime), 0) -weak_alias(__pthread_cond_timedwait, pthread_cond_timedwait) - - -FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2), - (thread1, thread2), 1) - - -/* Use an alias to avoid warning, as pthread_exit is declared noreturn. */ -FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS)) -strong_alias (__pthread_exit, pthread_exit); - - -FORWARD (pthread_getschedparam, - (pthread_t target_thread, int *policy, struct sched_param *param), - (target_thread, policy, param), 0) -FORWARD (pthread_setschedparam, - (pthread_t target_thread, int policy, - const struct sched_param *param), (target_thread, policy, param), 0) - - -FORWARD (pthread_mutex_destroy, (pthread_mutex_t *mutex), (mutex), 0) - -FORWARD (pthread_mutex_init, - (pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr), - (mutex, mutexattr), 0) - -FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0) -weak_alias (pthread_mutex_lock, __pthread_mutex_lock) - -FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0) -weak_alias (pthread_mutex_unlock, __pthread_mutex_unlock) - -FORWARD2 (pthread_self, pthread_t, (void), (), return 0) - - -FORWARD (pthread_setcancelstate, (int state, int *o