summaryrefslogtreecommitdiff
path: root/libpthread
AgeCommit message (Collapse)Author
2018-08-10nptl: Replace sbrk with mmapChristophe Lyon
Replace sbrk with mmap since this commit disables sbrk area for FDPIC MMU-less platform: fs/binfmt_elf_fdpic.c: fix brk area overlap with stack on NOMMU https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/fs/binfmt_elf_fdpic.c?id=4ac313111018cb44ecc250445de5ccb93026a980 * libpthread/nptl/sysdeps/generic/libc-tls.c (__libc_setup_tls): Handle __FDPIC__. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-08-10nptl: Clear TLS area for static binaries.Christophe Lyon
busybox init checks it has pid 1, but getpid() returns another value when building busybox statically. This is because the corresponding area is not cleared when allocated (it is allocated with MAP_UNINITIALIZED, whose behavior depends on the Linux kernel's CONFIG_MMAP_ALLOW_UNINITIALIZED). This patch fixes the problem by explicitly clearing the memory area. * libpthread/nptl/sysdeps/generic/libc-tls.c (__libc_tls_setup): Clear tlsblock. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-08-10nptl: Add pthread_mutex_getprioceiling and pthread_mutex_setprioceiling supportChristophe Lyon
* libpthread/nptl/Makefile.in (libpthread-routines-): Remove pthread_mutex_getprioceiling.c and pthread_mutex_setprioceiling.c. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-08-10nptl: Allow sem_open to work on MMU-less systemsChristophe Lyon
Allow both tmpfs and ramfs for shm devices. * libpthread/nptl/linux_fsinfo.h (SHMFS_SUPER_MAGIC_WITH_MMU): Define. (SHMFS_SUPER_MAGIC_WITHOUT_MMU): Define. * libpthread/nptl/sem_open.c (__where_is_shmfs): Add support for SHMFS_SUPER_MAGIC_WITHOUT_MMU. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-08-10nptl: Use linker-defined symbol to find start of .tdata section.Christophe Lyon
phdr->p_vaddr of TLS segment is not a valid value for FDPIC so we can either translate phdr->p_vaddr using loadmap (not easy here) or use a new linker script defined symbol, whih this patch does. * libpthread/nptl/sysdeps/generic/libc-tls.c (__tdata_start): Declare. (__libc_setup_tls): Support __FDPIC__. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-08-10nptl: Do not use madviseChristophe Lyon
start_thread() uses it, but it is not supported on MMU-less systems. * libpthread/nptl/pthread_create.c (start_thread): Call madvise only if __ARCH_USE_MMU__ is defined. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-08-10nptl: Disable fork and atfork on MMU-less systems.Christophe Lyon
They do not work on MMU-less systems. For atfork, implement a hidden function that always returns EPERM. * libpthread/nptl/sysdeps/unix/sysv/linux/fork.c: Disable if __ARCH_USE_MMU__ is not defined. * libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c (__libc_pthread_init): Handle __ARCH_USE_MMU__. * libpthread/nptl/sysdeps/unix/sysv/linux/register-atfork.c: Likewise. * libpthread/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c: Likewise. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-08-10nptl: disable mprotect usage in stack protectionChristophe Lyon
Since mprotect does not work on MMU-less systems, disable it if __ARCH_USE_MMU__ is not defined. * libpthread/nptl/allocatestack.c (change_stack_perm): Call mprotect only if __ARCH_USE_MMU__ is defined. (allocate_stack): Likewise. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-04-22linuxthreads: implement pthread_condattr_{s,g}etclock()Waldemar Brodkorb
More applications are using pthread_condattr_setclock()/ pthread_condattr_getclock() in their code. Port these two functions from NPTL over to be more compatible.
2018-02-03add libc version compatibilityWaldemar Brodkorb
2018-01-15libpthread/nptl: bugfix malloc segfault in race conditions.Guo Ren
In libc/sysdeps/linux/common/bits/uClibc_pthread.h: extern void weak_function _pthread_cleanup_push_defer(...) This *weak_function* declaration will cause nptl/cleanup_defer_compat.c: strong_alias (...) !!!FAIL!!!, because it include pthreadP.h->pthread.h ->uClibc_pthread.h That means: Readelf -s libpthread/nptl/cleanup_defer_compat.o you will get: 18: 00000000 198 FUNC WEAK DEFAULT 1 _pthread_cleanup_push_def Readelf -s libc/misc/internals/__uClibc_main.o you will also get: 32: 00000038 58 FUNC WEAK DEFAULT 1 _pthread_cleanup_push_def Final: gcc malloc_pthread_test.c -lpthread The libc/stdlib/malloc-standard/malloc.c:839 (__MALLOC_LOCK-> _pthread_cleanup_push_def) will use the one in __uClibc_main.o !!!not in cleanup_defer_compat.o!!!, becasue two cleanup_defer_compat in libc.a with the same weak declarations and the __uClibc_main.o is close to front. ==== All of malloc/free will failed in muti-threads' race conditions probabilistic. As it happens, uClibc-0.9.33.2 is OK, Becasue: It's seperated in libpthread.a and libc.a, and the libc.a is the last lib for ld internal-cmd, and malloc will get right cleanup_defer_compat from libpthread.a. This BUG is from 2016-09-24 to now: >>> commit 29ff9055c80efe77a7130767a9fcb3ab8c67e8ce Author: Waldemar Brodkorb <wbx@uclibc-ng.org> Date: Sat Sep 24 02:55:31 2016 +0200 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 <<< Perharps we need carefully check all of the impact about that commit. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2018-01-15nptl: use generic lowlevellock.h for most architecturesWaldemar Brodkorb
Only mips/x86/x86_64 needs a special version of lowlevellock.h. No regressions found.
2018-01-03fdpic: fix ld.so crashingWaldemar Brodkorb
Newer binutils is creating a section INIT_ARRAY from any .init_array and .ctors in the code. When ld.so runs initialization functions for loaded objects with _dl_run_init_array() it crashes on Bfin FDPIC system. It is trying to execute the function in pthread.c, which is no longer useful with the combined C library approach. Gcc -Wl,-M debugging output was very useful to find the reason for the INIT_ARRAY section.
2017-12-31m68k: add NPTL/TLS supportWaldemar Brodkorb
Port over NPTL/TLS support from GNU C Library. In the first step only the slower syscall is used for TLS access. The uClibc-ng testsuite shows 79 errors, so their is room for bugfixes and improvements.
2017-12-28csky: add Copyright.Guo Ren
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2017-12-16sh: remove assembly code from NPTLWaldemar Brodkorb
2017-11-25or1k: Fix tls value passed during cloneStafford Horne
From or1k-glibc from blueCmd, his commit "Fix TLS, removed too much in rebase". Signed-off-by: Stafford Horne <shorne@gmail.com>
2017-11-25or1k: correctly pass tid in 4th paramStafford Horne
2017-11-22librt: fix broken posix_spawnWaldemar Brodkorb
Fix iteration over signals, synced with GNU C library code and pending patches. Issues found when running dhcpcd with hook scripts. (exit status 127) Reported-By: kapeka <kapeka@bering-uclibc.de>
2017-11-19csky: port to uclibc-ngGuo Ren
Follow the steps to build c-sky uclibc linux system: 1. git clone https://github.com/c-sky/buildroot.git 2. cd buildroot 3. make qemu_csky_ck810_uclibc_defconfig 4. make Follow the buildroot/board/qemu/csky/readme.txt to run. This buildroot toolchain is pre-build, But you can rebuild the c-sky uclibc-ng alone and install it to the buildroot sysroot manually. We'll try our best to improve the uclibc-ng continuously. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2017-11-19linuxthreads: add dummy for pthread_atforkWaldemar Brodkorb
For noMMU targets we need a pthread_atfork dummy, otherwise libraries like libressl using pthread_atfork, but not fork() for itself, can not be used. But software like curl with ssl support linking against libressl still work fine on noMMU targets.
2017-11-18use the right file for tls in buildStafford Horne
Signed-off-by: Stafford Horne <shorne@gmail.com>
2017-11-18use atomic instructions for atomicsStafford Horne
Signed-off-by: Stafford Horne <shorne@gmail.com>
2017-11-02convert accept4() to use cancel.h macrosWaldemar Brodkorb
2017-10-10libpthread/nptl: bugfix compile warning.Guo Ren
warning: unused variable 'self' [-Wunused-variable] Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2017-10-01recvmmsg/sendmmsg: add recvmmsg sendmmsg support.Guo Ren
The recvmmsg and sendmmsg is very important for UDP stream application. If we only use recvmsg for UDP stream, it will only copy one mtu size of data in a syscall. And recvmmsg copy as many as you want in a syscall. So recvmmsg is more efficient,and some applications will depends on the recvmmsg and sendmmsg, eg: UDP media stream player. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2017-08-19fix compile issue when DOASSERTS=yWaldemar Brodkorb
Pthread pid caching was removed recently but an assert is still present which checks pthread->pid, and this breaks the build when debugging is enabled. Reported-By: Bogdan Harjoc <harjoc@gmail.com>
2017-08-05fix issues with gdb 8.0Waldemar Brodkorb
GDB 8.0 is compiled and linked with g++, but the linking of static targets (f.e. coldfire) fails, without declaring the functions in thread_db.h extern C. The compilation of gdb errors out with: thread-db.o: In function `thread_db_init()': thread-db.c:(.text+0x5b6): undefined reference to `td_ta_new(ps_prochandle*, td_thragent**)' thread-db.c:(.text+0x61e): undefined reference to `td_thr_get_info(td_thrhandle const*, td_thrinfo*)' thread-db.c:(.text+0x632): undefined reference to `td_symbol_list()' ..
2017-07-28nptl: remove asm from sysdep-cancel.hWaldemar Brodkorb
Similar to a changeset planned in GNU C library remove any assembly code from sysdep-cancel.h. This allows to port to new architectures in a simpler way.
2017-07-28nptl: remove sysdep-cancel ASM macros, convert to CWaldemar Brodkorb
2017-07-05Remove CALL_THREAD_FCT macroWaldemar Brodkorb
Following glibc commit a358c805300e358e30d4788a6f19c69988623a5c
2017-06-11remove outdated manpages and README's for ld.so/linuxthreadsWaldemar Brodkorb
2017-06-06silence gcc, add missing includeWaldemar Brodkorb
2017-05-14or1k: add NPTL/TLS supportWaldemar Brodkorb
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
2017-05-12pthread_getcpuclockid.c: fix clockid computationSergey Korolev
For the linux kernel (since 2.6.12) MAKE_THREAD_CPUCLOCK macro-like computation should be used to get clockid.
2017-04-22remove unused HP_TIMING_AVAIL and headerWaldemar Brodkorb
cleanup unused and unsupported code.
2017-04-22remove unused pt-raise.c filesWaldemar Brodkorb
2017-04-16or1k: silence gcc warningsWaldemar Brodkorb
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
2017-03-20remove RPC implementationWaldemar Brodkorb
The included RPC implementation is ipv4 only. Other C library projects have either deprecated the internal RPC implementation (GNU C Library) or never implemented such functionality (musl C Library). The latest rpcbind release (0.2.4) checks for libtirpc and does not allow to be build with uClibc-ng RPC without patching. The common use case for RPC nowadays is to use rpcbind together with nfs-utils to provide NFS server or client support to a system. The included RPC implementation does create issues with duplicate symbol failures when statically compiling with RPC enabled.
2017-02-17arm: fix static linking issuesWaldemar Brodkorb
As reported by Buildroot developers these files causing static linking issues. The original contribution with the ARM unwind-resume rework and GNU libc sync was made before the combined libc change. But the patch was applied later, after the libc change and it seems the test coverage for static linking didn't catch it in the regression testing. Remove the files. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
2017-02-01add experimental aarch64 supportWaldemar Brodkorb
Ported over from GNU C Library and runtime tested in Qemu.
2017-01-28remove PID cachingWaldemar Brodkorb
Follow GNU C Library from c579f48edba88380635ab98cb612030e3ed8691e and remove the PID caching. These simplifies the architecture specific assembly code. The run of the test suite found no regressions, it even solves some of the test failures for x86/x86_64/sparc. Reviewed-by: Max Filippov <jcmvbkbc@gmail.com> Reviewed-by: Vineet Gupta <Vineet.Gupta1@synopsys.com> Acked-by: Matthew Fortune <Matthew.Fortune@imgtec.com> Acked-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
2017-01-22nds32: add NPTL/TLS, *context function, libm changes and code cleanupVincent Ren-Wei Chen
This commit includes following features. 1. Support NPTL/TLS 2. Add libm function which is used to handle FP rounding and excpetions (ex: fclrexcpt,fedisblxcpti,feenablxcpt... ) 3. Add *context function for operating user context (ex: setcontext,getcontext,makecontext... ) 4. Change the return flow from signal handler 5. Cleanup of old code The testsuite only has 2 errors, tst-cpuclock1 and tst-cputimer1, which are related to timing accuracy. (math and locale tests are disabled) Signed-off-by: Vincent Ren-Wei Chen <vincentc@andestech.com>
2017-01-14nptl_db: fix gcc compiler warningsWaldemar Brodkorb
2017-01-14nptl: remove pthread_attr_init/pthread_create weak aliasesWaldemar Brodkorb
We do not support symbol versioning, so remove these weak aliases.
2016-12-10xtensa: fix static linkingWaldemar Brodkorb
uClibc-ng 1.0.20 fixed static linking with "libdl" by adding all libdl functions into the libc. On xtensa, though, libdl contains an unresolved reference that is satisfied by the ld.so - which is not a part of the linking in a static case. Signed-off-by: Alexey Neyman <stilor@att.net> Acked-by: Max Filippov <jcmvbkbc@gmail.com>
2016-12-02remove libintl stub and libintl.h headerWaldemar Brodkorb
As __UCLIBC_HAS_GETTEXT_AWARENESS__ is never defined, this is mostly dead code. It is planned to integrate libiconv-tiny and gettext-tiny into uClibc-ng after the next release, so that more software packages can be used without modification. Remove any _/_N macro usage.
2016-11-30NONTLS_INIT_TP is never defined, remove dead codeWaldemar Brodkorb
2016-11-29libpthread: Fix inclusion of unwind code.Ignacy Gawędzki
Since librt and libpthread are now integrated into libc, including unwind-resume and unwind-forcedunwind implementations of unwind code makes no sense. Only unwind-forcedunwind is now included with functions hidden to avoid them overriding the ones from libgcc_s. * libpthread/nptl/sysdeps/generic/unwind-resume.h: New. Define generic PERSONALITY_PROTO and PERSONALITY_ARGS and set HAVE_ARCH_UNWIND_RESUME to 0. * libpthread/nptl/sysdeps/pthread/unwind-resume.c: Move... * libpthread/nptl/sysdeps/generic/unwind-resume.c: ... here. Include generic implementation of _Unwind_Resume on the condition that !HAVE_ARCH_UNWIND_RESUME. Make functions hidden to prevent them from overriding libgcc_s's ones. * libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c: Likewise. * libpthread/nptl/sysdeps/arm/unwind-resume.h: New. Define ARM-specific PERSONALITY_PROTO and PERSONALITY_ARGS and set HAVE_ARCH_UNWIND_RESUME to 1. * libpthread/nptl/sysdeps/arm/arm-unwind-resume.c, * libpthread/nptl/sysdeps/arm/pt-arm-unwind-resume.c, * libpthread/nptl/sysdeps/arm/rt-arm-unwind-resume.c: New. ARM-specific implementations of _Unwind_Resume resp. for libc, libpthread and librt. * libpthread/nptl/sysdeps/Makefile.commonarch: Remove both arm-unwind-resume and rt-arm-unwind-resume from libpthread_arch_CSRC. * libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c, * libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c: Remove. Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
2016-11-27remove UCLIBC_HAS_LFSWaldemar Brodkorb