summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2016-09-24 02:55:31 +0200
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-09-26 20:23:24 +0200
commit29ff9055c80efe77a7130767a9fcb3ab8c67e8ce (patch)
treeb061656c1336d7d73ed5eef59352e3d50d8147a7
parentb06f85d62c41a4ed108628b1c564203f36c0ab4e (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
-rw-r--r--Makefile.in30
-rw-r--r--Rules.mak8
-rw-r--r--ldso/ldso/arm/dl-syscalls.h37
-rw-r--r--ldso/ldso/fdpic/dl-inlines.h2
-rw-r--r--ldso/libdl/Makefile.in18
-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
-rw-r--r--libcrypt/Makefile.in27
-rw-r--r--libintl/Makefile.in26
-rw-r--r--libm/Makefile.in27
-rw-r--r--libnsl/Makefile.in27
-rw-r--r--libpthread/linuxthreads/Makefile.in43
-rw-r--r--libpthread/linuxthreads/forward.c173
-rw-r--r--libpthread/linuxthreads/internals.h3
-rw-r--r--libpthread/linuxthreads/libc_pthread_init.c11
-rw-r--r--libpthread/linuxthreads/manager.c3
-rw-r--r--libpthread/linuxthreads/pthread.c98
-rw-r--r--libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h66
-rw-r--r--libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h113
-rw-r--r--libpthread/nptl/Makefile.in54
-rw-r--r--libpthread/nptl/forward.c169
-rw-r--r--libpthread/nptl/init.c74
-rw-r--r--libpthread/nptl/pt-system.c35
-rw-r--r--libpthread/nptl/pthreadP.h7
-rw-r--r--libpthread/nptl/pthread_setgid.c3
-rw-r--r--libpthread/nptl/pthread_setuid.c3
-rw-r--r--libpthread/nptl/res.c26
-rw-r--r--libpthread/nptl/sysdeps/arm/Makefile.arch1
-rw-r--r--libpthread/nptl/sysdeps/arm/aeabi_read_tp.S1
-rw-r--r--libpthread/nptl/sysdeps/arm/thumb_atomics.S1
-rw-r--r--libpthread/nptl/sysdeps/metag/metag_load_tp.S7
-rw-r--r--libpthread/nptl/sysdeps/mips/nptl-sysdep.S2
-rw-r--r--libpthread/nptl/sysdeps/pthread/Makefile.in51
-rw-r--r--libpthread/nptl/sysdeps/pthread/bits/libc-lock.h10
-rw-r--r--libpthread/nptl/sysdeps/pthread/pt-initfini.c128
-rw-r--r--libpthread/nptl/sysdeps/pthread/pt-sigaction.c7
-rw-r--r--libpthread/nptl/sysdeps/pthread/pthread-functions.h108
-rw-r--r--libpthread/nptl/sysdeps/pthread/setxid.h6
-rw-r--r--libpthread/nptl/sysdeps/pthread/uClibc-glue.h1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arc/pt-__syscall_error.c7
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arc/pt-__syscall_rt_sigaction.c13
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch5
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-__syscall_error.c1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-__syscall_rt_sigaction.c1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/i386/pt-__syscall_error.c1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c7
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c24
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/metag/Makefile.arch3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/metag/pt-__syscall_error.c7
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/metag/pt-__syscall_rt_sigaction.c7
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-__syscall_rt_sigaction.c1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch5
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/pt-__syscall_error.c1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pt-sigwait.c2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sh/pt-initfini.c125
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch5
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pt-__syscall_error.c1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pt-__syscall_error.c1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/Makefile.arch1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/pt-initfini.c134
-rw-r--r--libpthread/nptl/sysdeps/xtensa/Makefile.arch3
-rw-r--r--libresolv/Makefile.in27
-rw-r--r--librt/Makefile.in34
-rw-r--r--libuargp/Makefile.in25
-rw-r--r--libubacktrace/Makefile.in23
-rw-r--r--libutil/Makefile.in27
-rw-r--r--test/argp/Makefile.in2
77 files changed, 79 insertions, 1928 deletions
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 <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 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 <ldso/ldso/arm/thumb_atomics.S>
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