summaryrefslogtreecommitdiff
path: root/libpthread/nptl/sysdeps/unix/sysv
AgeCommit message (Collapse)Author
8 daysSwitch x86 NPTL impl to generic C code.Dmitry Chestnykh
The asm code has high maintainance cost. The cost is extremely high if we take into consideration time64 implementation which implies operating with 64bit numbers on 32bit system. Also glibc uses mainly C in NPTL code. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-04-13Provide fixups for riscv32.Dmitry Chestnykh
- Use TIME64 by default for rv32, usage of 32-bit time leads to a lot of incompatibilities with linux kernel 6.6.x and later versions. - Add some other corrections to use proper system calls on riscv32 platform. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-03-20riscv32: sync with riscv64Waldemar Brodkorb
2024-03-19riscv64: clone behaves like on aarch64, fixes tst-basic3, reported by sorearWaldemar Brodkorb
2024-03-19riscv64: sync with glibc, fix all TLS errors in uClibc-ng-testWaldemar Brodkorb
2024-03-03riscv32: add basic support for NPTLWaldemar Brodkorb
2024-02-26Add time64 support for MIPS32.Dmitry Chestnykh
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-02-25Add support for using time64 on big-endian machines.Dmitry Chestnykh
For BE architectures there is one significant difference in comparison with time64 support for little-endian architectures like ARMv7. The difference is that we strictly need to pass two 64bit values to system calls because Linux Kernel internally uses `struct __kernel_timespec` and similar, which consists of two 64bit fields. For this reason many files have been changed to convert pointers to timespec-family structures (mixed of 64bit and 32bit values) to the pointer of the similar but 64bit-only structures for using as system calls args. This is general prerequisite for any BE architecture. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-02-22Introduce time64 support.Dmitry Chestnykh
This patch introduces *time64 syscalls support for uClibc-ng. Currently the redirection of syscalls to their *time64 analogs is fully supported for 32bit ARM (ARMv5, ARMv6, ARMv7). The main changes that take effect when time64 feature is enabled are: - sizeof(time_t) is 8. - There is a possibility os setting date beyond year 2038. - some syscalls are redirected: clock_adjtime -> clock_adjtime64 clock_getres -> clock_getres_time64 clock_gettime -> clock_gettime64 clock_nanosleep -> clock_nanosleep_time64 clock_settime -> clock_settime64 futex -> futex_time64 mq_timedreceive -> mq_timedreceive_time64 mq_timedsend -> mq_timedsend_time64 ppoll -> ppoll_time64 pselect6 -> pselect6_time64 recvmmsg -> recvmmsg_time64 rt_sigtimedwait -> rt_sigtimedwait_time64 sched_rr_get_interval -> sched_rr_get_interval_time64 semtimedop -> semtimedop_time64 timer_gettime -> timer_gettime64 timer_settime -> timer_settime64 timerfd_gettime -> timerfd_gettime64 timerfd_settime -> timerfd_settime64 utimensat -> utimensat_time64. - settimeofday uses clock_settime (like in glibc/musl). - gettimeofday uses clock_gettime (like in glibc/musl). - nanosleep uses clock_nanosleep (like in glibc/musl). - There are some fixes in data structures used by libc and kernel for correct data handling both with and without enabled time64 support. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2021-04-18libpthread/nptl: create timer thread with sufficiant stack size (account for ↵Peter Seiderer
TLS) Create timer thread with sufficiant stack size (take into account allocated space for thread-local-storage), for this backport glibc commit 'Create internal threads with sufficient stack size' ([1], [2]) introducing __pthread_get_minstack() and use it in __start_helper_thread(). Fixes timer_create() in case of linking with library using large TLS area (e.g openblas, see [3]). [1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=2c1094bd700e63a8d7f547b3f5495bedb55c0a08 [2] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=630f4cc3aa019ede55976ea561f1a7af2f068639 [3] http://lists.busybox.net/pipermail/buildroot/2021-April/308281.html Signed-off-by: Peter Seiderer <ps.report@gmx.net>
2020-10-02kvx: add support for kvx arch to uClibc-ngYann Sionneau
This commit adds support for Kalray VLIW family (kvx) Kalray kv3 core is embedded in Kalray Coolidge SoC. This core which is the third of the KV family has the following features: 32/64 bits execution mode 6-issue VLIW architecture 64 x 64bits general purpose registers SIMD instructions little-endian In order to build a usable toolchain, build scripts are provided at the following address: https://github.com/kalray/build-scripts. Kalray uses FOSS which is available at https://github.com/kalray This includes Linux kernel, uClibc-ng, gcc, binutils, etc. Signed-off-by: Clément Léger <cleger@kalray.eu> Signed-off-by: Guillaume Thouvenin <gthouvenin@kalray.eu> Signed-off-by: Laurent Thevenoux <lthevenoux@kalray.eu> Signed-off-by: Marc Poulhies <mpoulhies@kalray.eu> Signed-off-by: Marius Gligor <mgligor@kalray.eu> Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2019-11-08riscv64: implement NPTL/TLSWaldemar Brodkorb
basically from or1k port of uClibc-ng, with fixes for structures in pthreadtypes.h from 64 bit architectures. 18 testsuite failures counted.
2019-10-30Make __syscall_error return long, as expected by syscall() callersCarlos Santos
The return type of syscall() is long so __syscall_error, which is jumped to by syscall handlers to stash an error number into errno, must return long too otherwhise it returs 4294967295L instead of -1L. For example, syscall for x86_64 is defined in libc/sysdeps/linux/x86_64/syscall.S as syscall: movq %rdi, %rax /* Syscall number -> rax. */ movq %rsi, %rdi /* shift arg1 - arg5. */ movq %rdx, %rsi movq %rcx, %rdx movq %r8, %r10 movq %r9, %r8 movq 8(%rsp),%r9 /* arg6 is on the stack. */ syscall /* Do the system call. */ cmpq $-4095, %rax /* Check %rax for error. */ jae __syscall_error /* Branch forward if it failed. */ ret /* Return to caller. */ In libc/sysdeps/linux/x86_64/__syscall_error.c, __syscall_error is defined as int __syscall_error(void) attribute_hidden; int __syscall_error(void) { register int err_no __asm__ ("%rcx"); __asm__ ("mov %rax, %rcx\n\t" "neg %rcx"); __set_errno(err_no); return -1; } So __syscall_error returns -1 as a 32-bit int in a 64-bit register, %rax (0x00000000ffffffff, whose decimal value is decimal 4294967295) and a test like this always returns false: if (syscall(number, ...) == -1) foo(); Fix the error by making __syscall_error return a long, like syscall(). The problem can be circumvented by the caller by coercing the returned value to int before comparing it to -1: if ((int) syscall(number, ...) == -1) foo(); The same problem probably occurs on other 64-bit systems but so far only x86_64 was tested, so this change must be considered experimental. Signed-off-by: Carlos Santos <unixmania@gmail.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-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.
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-18use atomic instructions for atomicsStafford Horne
Signed-off-by: Stafford Horne <shorne@gmail.com>
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-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-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-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>
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
2016-11-27microblaze: fixup gcc warningsWaldemar Brodkorb
2016-11-27microblaze: sync sysdep-cancel.h/sydep.h with GNU libcWaldemar Brodkorb
2016-11-27sh: remove duplicate codeWaldemar Brodkorb
2016-11-27Revert "sh: fix static linking issue"Waldemar Brodkorb
This reverts commit c13f823941b103cf744929e5afcb3e2bc1342354.
2016-11-04nios2: sync support with glibcWaldemar Brodkorb
Only static linking is supported for now. More debugging and analyzing for ld.so, TLS and NPTL is required. But at least you can bootup a static root fileystem in Qemu.
2016-11-03microblaze: add NPTL/TLS support from GNU libcWaldemar Brodkorb
Not perfect, but a starting point. Some tests of the test suite are failing.
2016-10-13cleanup and fix static linking issuesWaldemar Brodkorb
There was a deadlock hanging in a sycall to futex, which should be solved now. Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2016-10-13ARC: nptl: cancellable wrappers were broken #2Vineet Gupta
Despite the prev fix, tst-mqueue3 was still segfaulting. The issue was BLINK register not restored properly for return 00002690 <mq_timedsend>: 2690: sub r9,r25,0x448 2698: ld r10,[r9] 269c: cmp r10,0 26a0: beq -36 26a4: st.aw blink,[sp,-4] 26a8: st.aw r0,[sp,-4] 26ac: st.aw r1,[sp,-4] 26b0: st.aw r2,[sp,-4] 26b4: st.aw r3,[sp,-4] 26b8: st.aw r4,[sp,-4] 26bc: bl 1e28 <__librt_enable_asynccancel> 26c0: mov r9,r0 26c4: ld.ab r4,[sp,4] 26c8: ld.ab r3,[sp,4] 26cc: ld.ab r2,[sp,4] 26d0: ld.ab r1,[sp,4] 26d4: ld.ab r0,[sp,4] 26d8: ld.ab blink,[sp, 4] <---- function return BLINK 26dc: mov r8,182 26e0: trap_s 0 26e2: cmp r0,-1024 26e6: st.aw r0,[sp,-4] 26ea: mov r0,r9 26ee: bl 1e90 <__librt_disable_asynccancel> <-- BLINK clobbered to next PC 26f2: ld.ab r0,[sp,4] <----| loops here until sp is out of bound 26fa: cmp r0,-1024 | 26fe: jls [blink] -----| 2702: b 15d8 2706: nop_s So the fix was to retain BLINK on stack before function call, and pop it later - 26d8: ld.ab blink,[sp, 4] + 26d8: ld blink,[sp] <--- restore BLINK, but retain on stack 26dc: mov r8,182 26e0: trap_s 0 26e2: cmp r0,-1024 26e6: st.aw r0,[sp,-4] 26ea: mov r0,r9 26ee: bl 1e90 <__librt_disable_asynccancel> 26f2: ld.ab r0,[sp,4] + 26f6: ld.ab blink,[sp,4] <--- finally pop BLINK 26fa: cmp r0,-1024 26fe: jls [blink] Reported-by: Eugeniy Paltsev <paltsev@synopsys.com> Cc: Alexey Brodkin <abrodkin@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
2016-10-13ARC: nptl: cancellable wrappers were brokenVineet Gupta
This was reported as uClibc test suite failures of tst-mqueue3 and tst-mqueue5. The syscall args were getting clobbered, so use scratch regs which are not used for syscall args 00002690 <mq_timedsend>: ; SINGLE_THREAD_P 2690: sub r1,r25,0x448 <--- clobers r1, r2 2698: ld r2,[r1] 269c: cmp r2,0 26a0: bz mq_timedsend_nocancel ; DOCARGS (saves syscall args but r1, r2 clobbered already) 26a4: st.aw blink,[sp,-4] 26a8: st.aw r0,[sp,-4] 26ac: st.aw r1,[sp,-4] 26b0: st.aw r2,[sp,-4] 26b4: st.aw r3,[sp,-4] 26b8: st.aw r4,[sp,-4] 26bc: bl 1e28 <__librt_enable_asynccancel> Reported-by: Eugeniy Paltsev <paltsev@synopsys.com> Cc: Alexey Brodkin <abrodkin@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
2016-10-05cleanup ppc portWaldemar Brodkorb
Remove powerpc64 bits as we only support powerpc32.
2016-09-26use a single libc and deduplicate threading codeWaldemar Brodkorb
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
2016-09-26always assume tgkill is presentWaldemar Brodkorb
We do not support 2.4 Linux kernels anyway, and almost all newer 2.6 kernels should have tgkill syscall. Cleanup the raise situation, pt-raise.c is unused, sync raise.c with latest GNU libc. Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2016-09-26remove dead code and documentationWaldemar Brodkorb
The code was disabled a while ago in commit: 814b0901f460a246315bfa7933a661f415bdc7fa Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2016-07-10x86_64: use C implementation for pthread_cond_wait/pthread_cond_timedwaitWaldemar Brodkorb
Add test case for the deadlock detection. Reported-By: Martin Willi <martin@strongswan.org>