summaryrefslogtreecommitdiff
path: root/libc/sysdeps
AgeCommit message (Collapse)Author
2024-05-21xtensa: use compiler-provided XCHAL macrosMax Filippov
Starting with gcc-13 the compiler provides configuration-specific macro definitions for the target xtensa core. Use them when available instead of the configuration overlay file xtensa-config.h Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2024-05-20libc/sysdeps/linux/common/utime.c: fix riscv32 buildFabrice Fontaine
Commit 48591e2a259d84247ae38f050bd58e6f7450bb77 forgot to update utime.c resulting in the following riscv32 build failure with applications using utime such as bzip2: /home/buildroot/autobuild/instance-0/output-1/host/riscv32-buildroot-linux-uclibc/bin/ld.real: bzip2.o: in function `copyFileName': bzip2.c:(.text+0x1fcc): undefined reference to `utime' Fixes: 48591e2a259d84247ae38f050bd58e6f7450bb77 - http://autobuild.buildroot.org/results/2e37d4e0bcef515fe9e643737419bfd26aa2833e Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2024-05-18Fix wrong `struct ucontext_t` typedef for all arches.Dmitry Chestnykh
The correct one is `struct ucontext` -> `ucontext_t`. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-05-18riscv32: Fix `struct ucontext` definition.Dmitry Chestnykh
The correct typedef is `struct ucontext` -> `ucontext_t`, not `struct ucontext_t` -> `ucontext_t` like for other architectures. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-05-18Fix riscv32 build with gcc-14.Dmitry Chestnykh
Add missing includes and function decls. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-05-18Fix uClibc build for nds32 with gcc-14.Dmitry Chestnykh
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-05-18Revert "nds32: sync with binutils 2.37, gcc 11.2 and linux 5.10.93 changes"Waldemar Brodkorb
This reverts commit 6b6f51c21dd29685bd1339de0bdffc0929316c63.
2024-05-16Correct uClibc compilation.Dmitry Chestnykh
- Include sys/types.h instead of asm/types.h to prevent types conflict for uClibc typedefs and kernel headers typedefs. - Cast 3rd arg of utimensat_time64 syscall to integer type to avoid compiler's -Wint-conversion error. The error was found during uClibc compilation for mips32. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-05-15fix kernel_stat64 definitionMax Filippov
The commit 74ca8d6f5d2e ("remove UCLIBC_HAS_LFS") removed conditional compilation dependent on __UCLIBC_HAS_LFS__, assuming it to be always defined, but removed the wrong branch in the definition of kernel_stat64. Fix kernel_stat64 definition to be stat64. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Tested-by: Chris Packham <judge.packham@gmail.com>
2024-05-10csky: allow time64Waldemar Brodkorb
2024-05-08sparc64: Fix incorrect sigreturn stub function implementationWaldemar Brodkorb
2024-05-08futimesat: add missing headerWaldemar Brodkorb
2024-04-30sparc: Fix incorrect sigreturn stub function implementation.Dmitry Chestnykh
This function haven't have prologue/epilogue/cfi directives etc. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-04-20x86: Fix __libc_sigaction implementation.Dmitry Chestnykh
For x86 we have to copy only mask, handler and flags. We haven't set SA_RESTORER bit in sa_flags anyway. This patch fixes multiple test failures on x86. Also we have to build uClibc with FP for x86 because without FP NPTL and libgcc code cannot properly unwind the stack during asynchronous cancellation of system calls. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-04-18Fix vDSO support for all supported architectures.Dmitry Chestnykh
- Cleanup dl-vdso.c code. - Pass `void *` as first arg to `load_vdso()`, using 32-bit type is completely wrong on 64bit architectures. - Split libc code and vDSO-related code. Move arch-specific implementations into separate files. The performance improvement is for example 50-60 times on ARMv7 and about 4 times on x86_64. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-04-14tree: Remove ^LPetr Vorel
Remove ^L (0x0c) chars from source code. Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
2024-04-14riscv32: allow ELF PIE noMMU buildWaldemar Brodkorb
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-04-01riscv64: partially revert cb9d1f53717dd67892ba943626f3d1b46f3e760b, fixes no ↵Waldemar Brodkorb
MMU ELF
2024-03-29riscv32: implement linuxthreads, from sorearWaldemar Brodkorb
2024-03-28riscv64: implement Linuxthreads, from sorearWaldemar Brodkorb
2024-03-27riscv: add __UCLIBC_ABORT_INSTRUCTION__, suggested by sorearWaldemar Brodkorb
2024-03-22riscv: fix pread64/pwrite64 users like git, suggested by sorearWaldemar Brodkorb
2024-03-20riscv32: sync with riscv64Waldemar Brodkorb
2024-03-19riscv64: add atomic.h, fixes tst-cond16, suggested by sorearWaldemar Brodkorb
2024-03-19riscv64: sync with glibc clone.SWaldemar Brodkorb
2024-03-19riscv64: page size is 4096, reported by sorearWaldemar Brodkorb
2024-03-03x86: enable time64Waldemar Brodkorb
2024-03-03m68k: enable time64Waldemar Brodkorb
2024-03-03superh: enable time64Waldemar Brodkorb
2024-03-03microblaze: enable time64Waldemar Brodkorb
2024-03-03riscv32: decouple from riscv64Waldemar Brodkorb
2024-03-03remove symlinkWaldemar Brodkorb
2024-03-02Add time64 support to ARC.Dmitry Chestnykh
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-03-01libc: Remove 32bit timespec structures everywhere.Dmitry Chestnykh
With time64 enabled we use statx() system call and the appropriate routines for results conversion. There is no need in `__ts32_struct` anymore. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-02-29libc: restore correct definition of semid_ds struct.Dmitry Chestnykh
Previously the common definition of this structure was broken by a mistake. Restore it correctly for all needed architectures and all use cases. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-02-29Add time64 support for sparc.Dmitry Chestnykh
By some reason sparc ld.so cannot work properly with statx() system call, so fallback to regular stat() family in ld.so. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-02-28Add time64 support to OpenRISC.Dmitry Chestnykh
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-02-28libc: always redirect *stat() family to statx() with time64 enabled.Dmitry Chestnykh
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-02-27Fix *stat() and *stat64() when the time is beyond year 2038.Dmitry Chestnykh
To obtain correct `st_atim`, `st_mtim` and `st_ctim` fields we need to use statx() syscall and then convert the data from the kernel to the regular stat structure. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-02-26Add time64 support for MIPS32.Dmitry Chestnykh
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-02-26Refactor `ts32_struct` and `TO_ITS64_P`.Dmitry Chestnykh
- Renamed `ts32_struct` to `__ts32_struct` like `__ts64_struct` and moved its definition to the header. - Removed extra space from TO_ITS64_P() macro. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-02-25Add time64 support for PowerPC.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-22xtensa: Add time64 support.Dmitry Chestnykh
- xtensa is the second architecture that supports time64 inside uClibc-ng. - Linux Kernel always uses 32bit time variables inside `stat` structures, so there is a need to use `st_atime`, `st_mtime` and `st_ctime` structures with the same 32bit-wide `tv_sec` and `tv_nsec` variables even if time64 is enabled. 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>
2024-02-18add newline at end of fileWaldemar Brodkorb
2023-12-12elf: support ELF binaries in noMMUGreg Ungerer
The Linux kernels ELF-FDPIC binfmt program loader can support loading and running conventional ELF format binaries on noMMU kernels when compiled appropriately. That is when they are constant displacement binaries such as generated using the -pie compile option. Add a configure option to allow selecting ELF binary support in noMMU mode configurations on architectures that support this. The main requirement is to generate the ldso run-time loader to perform relocation at load time. These configurations do not support shared libraries, so there is no need to generate a full shared library, only the static version is required. The use of ELF format binaries does mean a slightly simpler toolchain generation (does not require a -uclinux- for some architectures) and does not require an extra tool like elf2flt. This initial support targets M68K, ARM and RISC-V architectures. No kernel changes are required, the required support for this is already in mainline kernels (certainly as of linux-6.6). Note that for the M68K and ARM architectures that the initialized registers and stack layout at process startup is slightly different for the flat format loader and the ELF/ELF-FDPIC loaders. So we need some changes to the startup code (crt1.S) for them. I have not done extensive testing outside of M68K, ARM and RISC-V. I had to make changes to a couple of the dl-startup.h architecture files to get them to build for this noMMU case. I did not dig down too deep on the reasons, but they still seem ok for the MMU case as well. Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
2023-11-17rlimit: fix 64-bit RLIM64_INFINITY macroPavel Kozlov
Linux kernel returns -1ULL as RLIM64_INFINITY for all cpus. Fix RLIM64_INFINTIY and 64-bit variant of RLIM_INFINITY macro for sparc, mips, alpha, as for these CPUs the library uses different value than what the kernel sets and it can cause incorrect RLIM64_INFINTY check. Because alpha is a 64-bit arch, fix the RLIM_INFINITY macro twice (the value should be the same with and without __USE_FILE_OFFSET64 definition) to match the prlimit64 syscall in the kernel. Previous implementation of setrlimit/getrlimit functions didn't use prlimit64 syscall and didn't receive RLIM64_INFINTIY from the kernel, RLIM64_INFINTY macro was used by the library itself to mimic the 64-bit rlimit in the getrlimit64/setrlimit64 functions, that allowed to have RLIM64_INFINTIY different from what the kernel sets. New implementation of setrlimit/getrlimit uses prlimit64 and checks for RLIM64_INFINITY value and must have equal RLIM64_INFINITY definition with what the kernel uses. This issue is indicated by the tst-rlim/tst-rlim64 tests on sparc/mips32/alpha, tests return 23 (UNSUPPORTED) because of incorrect RLIM_INFINTY check for available rlimit type. This patch will require rebuild of sparc/mips32/alpha binaries that explicitly use RLIM64_INFINTY or 64-bit variant of RLIM_INFINITY (if binary for 32-bit CPU was built with _FILE_OFFSET_BITS=64) to update the macro value. Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
2023-11-10arc: add acq/rel variants for atomic cmpxchg/xchgPavel Kozlov
Add acquire/release variants for atomic functions cmpxchg/xchg and provide a memory barrier after/before exchange. For cmpxchg use compiler builtins. For xchg functions add memory barrier explicitly. These barriers are required to keep memory consistency of ARCv3 CPU cores in SMP. For ARC700 barriers are not required and the compiler doesn't provide _atomic_compare_exchange*, use current asm insertion without acquire/release variants for ARC700. Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>