Age | Commit message (Collapse) | Author |
|
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>
|
|
- 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>
|
|
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>
|
|
|
|
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>
|
|
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>
|
|
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>
|
|
The tst-rlimit/tst-rlimit64 tests pointed to several issueses in
prlimit() function for 32-bit CPUs. This patch adds name redirection to
prlimit64 in prlimit declaration to provide correct support for 64-bit
offset (_FILE_OFFSET_BITS=64) on 32-bit CPUs and fixes improper field
assignment and incorrect syscall paramerets in the prlimit() function.
Fixes: 8c2f6218 ("setrlimit/getrlimit: fix prlimit64 syscall use for 32-bit CPUs")
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
|
|
elf-fdpic.h is included by link.h. When a C++ program includes <link.h>,
we get the following build failure:
<...>/usr/include/bits/elf-fdpic.h: In function ‘void* __reloc_pointer(void*, const elf32_fdpic_loadmap*)’:
<...>/usr/include/bits/elf-fdpic.h:94:54: error: invalid use of ‘void’
94 | unsigned long offset = p - (void*)map->segs[c].p_vaddr;
| ^~~~~~~
void pointer addition and subtraction is not allowed in C++ as it has
undetermined size, however in C with language extension it is possible
because sizeof void is treated as one byte.
This patch was previously applied to Blackfin, FR-V and C6x, but not
ARM.
Signed-off-by: Ben Wolsieffer <ben.wolsieffer@hefring.com>
|
|
Fix the [-Warray-parameter=] warning for __sigsetjmp generated by GCC 11 and
later GCC versions:
|
| warning: argument 1 of type 'struct __jmp_buf_tag *' declared as a pointer [-Warray-parameter=]
| extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
| ...
| note: previously declared as an array 'struct __jmp_buf_tag[1]'
| extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask)
|
Use the same fix as in glibc. The fix is to move the struct __jmp_buf_tag
definition to a separate bits/ header so it can be included in
pthread.h, to allow to use an array (as in setjmp.h) rather than a pointer
in the declaration.
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
|
|
Commit 95e38b37 ("add support for systems without legacy setrlimit/getrlimit
syscalls") has added use of the prlimit64 syscall in getrlimit and setrlimit
functions. This change causes memory corruption on getrlimit call for 32-bit
CPUs like ARC, as ARC doesn't have ugetrlimit syscall and uses prlimit64.
Also, setrlimit has been broken by prlimit64 call on 32-bit CPUs like, i386,
ARM, ARC.
For the prlimit64 syscall the kernel expects an rlimit struct with 64-bit fields,
but on 32-bit CPUs without _FILE_OFFSET_BITS=64 the struct rlimit has 32-bit
fields.
Add safe implementations of getrlimit, setrlimit, prlimit for 32-bit CPUs with a
local struct rlimit64 variable for use in the prlimit64 syscall.
For 64-bit CPUs and configurations with _FILE_OFFSET_BITS=64 use
getrlimit, setrlimit, prlimit as aliases to getrlimit64, setrlimit64 and
prlimit64. Add a new function prlimit64.
Tested on aarch64, arm, i386, arc.
Fixes: 95e38b37 ("add support for systems without legacy setrlimit/getrlimit syscalls")
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
|
|
Fixes compilation issues on mips64 n32.
|
|
|
|
fork() can be implemented using either the fork or clone syscalls on MMU
systems. Therefore the stub is only generated if neither __NR_fork nor
__NR_clone are defined. The stub code manually undefines __NR_fork on
no-MMU systems in an attempt to enable the stub, but this doesn't work
because __NR_clone is still defined. It is not appropriate to undefine
__NR_clone because clone is available on no-MMU, it is just not capable
of implementing fork.
This patch directly enables the fork stub if __ARCH_USE_MMU__ is not
defined. This eliminates the need to undefine __NR_fork, so this code is
removed
Signed-off-by: Ben Wolsieffer <ben.wolsieffer@hefring.com>
|
|
Previously kvx assembler considered all separators (",", "?", "=", "[]")
to be the same, this is not the case anymore hence we need to fix all
the misformed assembly.
Signed-off-by: Paul Iannetta <piannetta@kalray.eu>
Acked-by: Yann Sionneau <ysionneau@kalray.eu>
Tested-by: Yann Sionneau <ysionneau@kalray.eu>
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
Use a custom stat.h header for kvx arch.
This makes sure it is aligned with Linux kernel one.
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
Define that kvx Linux port supports statx syscall.
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
Align the specification of the ptrace interface with how it is specified on RISC-V.
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
Add fstatat wrapper that uses statx for non-legacy arch.
This allows non-legacy arch to opt-out from defining the old stat* syscalls
by not defining __ARCH_WANT_NEW_STAT in their
arch/xxx/include/asm/unistd.h
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
Those must have the recent prlimit64 syscall which exists since
Linux 3.2.
This patch is necessary for non-legacy architectures that wish to remove
support for legacy setrlimit/getrlimit syscalls.
The non-legacy arch are those who opt-out via non defining
__ARCH_WANT_SET_GET_RLIMIT in their arch/xxx/include/uapi/asm/unistd.h
setrlimit and getrlimit are then emulated via the new prlimit64 syscall.
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
Add missing return value statement to fstat for the statx wrapping case.
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
fstatat64 syscall
Define fstatat64 as a wrapper of statx if the kernel does not support fstatat64 syscall
This is the case for non-legacy architectures that don't define __ARCH_WANT_NEW_STAT
in their linux arch/xxx/include/asm/unistd.h
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
issue with gcc 12
The current definition of __WCHAR_MIN and __WCHAR_MAX are only correct
when wchar_t is an int. This is not the case on ARM/AArch64 where
wchar_t is an unsigned int, or some other architectures where wchar_t
is a long.
The current incorrect definition causes a build issue for example when
building mpd, which uses boost, with gcc 12.x:
In file included from /home/thomas/buildroot/aarch64/host/aarch64-buildroot-linux-uclibc/sysroot/usr/include/boost/integer.hpp:20,
from /home/thomas/buildroot/aarch64/host/aarch64-buildroot-linux-uclibc/sysroot/usr/include/boost/crc.hpp:42,
from ../src/storage/StorageState.cxx:43:
/home/thomas/buildroot/aarch64/host/aarch64-buildroot-linux-uclibc/sysroot/usr/include/boost/integer_traits.hpp:105:69: error: narrowing conversion of ‘-2147483648’ from ‘int’ to ‘wchar_t’ [-Wnarrowing]
105 | public detail::integer_traits_base<wchar_t, WCHAR_MIN, WCHAR_MAX>
| ^
This issue was fixed in glibc in 2013, see bug report
https://sourceware.org/bugzilla/show_bug.cgi?id=15036, and upstream
commit
https://sourceware.org/git/?p=glibc.git;a=commit;h=052aff95782fefe9c63566471063e8b20836bfb8.
Since the i386-specific definition of __WCHAR_MIN and __WCHAR_MAX was
also removed at the same time in glibc, we do the same as part of this
commit.
Reported-by: Clément Ramirez <clement.ramirez@bootlin.com>
With-some-useful-help-from: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
|
|
|
|
See here for details:
https://sourceware.org/bugzilla/show_bug.cgi?id=28509
|
|
Added definition for MAP_FIXED_NOREPLACE which was added in kernel 4.17
Signed-off-by: linted <linted@users.noreply.github.com>
|
|
|
|
|
|
Added 32-bit RISC-V support. I have managed to get 32-bit RISC-V No-MMU
Linux running based on mainstream buildroot. It's nice to have uclibc
support this 32-bit No-MMU target.
There's no substantial code change except definations and config
options.
Signed-off-by: Yimin Gu <ustcymgu@gmail.com>
|
|
Modified config files and crt1.S to support static pie elf generation.
Signed-off-by: linted <linted@users.noreply.github.com>
|
|
Add ability to use optimized versions of string functions for ARCv3 32-bit
CPUs with UCLIBC_HAS_STRING_ARCH_OPT option. Add optimized
memcpy/memset/memcmp code for ARCv3 CPUs based on the code from newlib
and adapt for ARCv3 existed optimized strchr/strcmp/strcpy/strlen.
Link to the Synopsys newlib repo with code for ARCv3 on GitHub:
https://github.com/foss-for-synopsys-dwc-arc-processors/newlib
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
|
|
New ARCv3 ISA includes both 64-bit and 32-bit CPU family.
This patch adds support for 32-bit ARCv3 HS5x processors.
Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
|
|
Add a header file with assembler macros to be able to handle in one
place the differences between ARCv2 and ARCv3 ISAs. It is a preparatory
step before the introduction of support for ARCv3 CPUs.
Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
|
|
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
on mips
Updated config to allow compilation of rcrt1.o for mips and modified it's crt1.S to perform relocates in __start.
The mips architecture performs relocations differently then most other architectures. reloc_static_pie was rewritten, taking code from dl-startup.c, in order to perfrom the additional relocations. Modifications were made to mips' dl-startup.h to allow for the use of contained macros without including _start definition.
Signed-off-by: linted <linted@users.noreply.github.com>
|
|
on aarch64
Updated config to allow compilation of rcrt1.o for aarch64 and modified it's crt1.S to relocate dynamic section prior to __uClibc_main.
Disabled stack protector when compiling reloc_static_pie.c to avoid TLS access prior to it being setup.
Signed-off-by: linted <linted@users.noreply.github.com>
|
|
There is a real-world usage of RUSAGE_THREAD by the pistache project,
https://github.com/oktal/pistache.
Reported-By: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
on i386, x86_64, and arm.
This patch adds the generation of rcrt1.o which is used by gcc when compiling with the --static-pie flag.
rcrt1.o differs from crt1.o and Scrt1.o in that it the executable has a dynamic section but no relocations have been performed prior to _start being called.
crt1.o assumes there to be no dynamic relocations, and Scrt1.o has all relocations performed prior to execution by lsdo.
The new reloc_static_pie function handles parsing the dynamic section, and performing the relocations in a architecture agnostic method.
It also sets _dl_load_base which is used when initalizing TLS to ensure loading from the proper location.
This allows for easier porting of static-pie support to additional architectures as only modifications to crt1.S to find the load address are required.
Signed-off-by: linted <linted@users.noreply.github.com>
|
|
Implement getcontext, makecontext, setcontext and swapcontext.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
This macro exists since Linux 2.6.25 [1] and is defined in glibc
since 2.14 [2] for sparc and most supported architectures.
RLIMIT_RTTIME has been added later for mips [3] and alpha [4].
For example, RLIMIT_RTTIME is needed to build qemu 7.0.0 with
Linux user-land emulation support [5].
[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=78f2c7db6068fd6ef75b8c120f04a388848eacb5
[2] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=67f86a251e0d36107fe28999281d46e76941c7b9
[3] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=8969f4df1a526aa60dd0bc1c4736cf02104d4a05
[4] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=53c2cb7641bd866398156625ef672bbd2d78a0d8
[5] https://git.qemu.org/?p=qemu.git;a=commitdiff;h=244fd08323088db73590ff2317dfe86f810b51d7
Signed-off-by: Romain Naour <romain.naour@gmail.com>
|
|
|