summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/Makefile.in31
-rw-r--r--libc/misc/internals/__uClibc_main.c45
-rw-r--r--libc/signal/Makefile.in7
-rw-r--r--libc/sysdeps/linux/arm/Makefile.arch1
-rw-r--r--libc/sysdeps/linux/arm/libc-thumb_atomics.S1
-rw-r--r--libc/sysdeps/linux/common/Makefile.in10
-rw-r--r--libc/sysdeps/linux/i386/Makefile.arch3
7 files changed, 42 insertions, 56 deletions
diff --git a/libc/Makefile.in b/libc/Makefile.in
index 05cec18..55fd3d3 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 9bb81fc..46e24d8 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -29,7 +29,6 @@
#include <fcntl.h>
#endif
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-#include <pthread-functions.h>
#include <not-cancel.h>
#include <atomic.h>
#include <tls.h>
@@ -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 6c355b5..d5639d1 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 cda3db2..78f7533 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 e7bc895..0000000
--- a/libc/sysdeps/linux/arm/libc-thumb_atomics.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <ldso/ldso/arm/thumb_atomics.S>
diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
index 887dc3d..6c35bff 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 1c72d23..581e10a 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