Age | Commit message (Collapse) | Author |
|
|
|
|
|
For architectures without ucontext implementation it is possible
to use libucontext with this small adaptation.
|
|
Clang also supports the gnu_inline attribute and the
__GNUC_STDC_INLINE__ macro (C99 semantics). However, it reports as
GCC 4.2 compatible (__GNUC_MINOR__ / __GNUC__) and thus the current
defines do not think it can support this.
Add clang as an alternative for this support. Documentation shows that
this attribute is supported since at least Clang 8.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
This can be used to guard features for specific clang versions.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
Dynamic exception specification using `throw()` is deprecated since
C++11 and removed in C++17. This change replaces `throw()` with
`noexcept` when compiling for newer standards.
Co-authored-by: Sven Linker <sven.linker@kernkonzept.com>
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
The existing limit of 20 was found to be insufficient when moving from
gcc 8 to gcc 9. At the time a test ran already 16 handlers had been
installed leaving only minimal room for application installed handlers.
Musl uses 32, as does newlib. Further, the ISO C standard for C99
specifies that:
The implementation shall support the registration of at least
32 functions.
(7.20.4.2 The atexit function)
Co-authored-by: Yann Le Du <yann.le.du@kernkonzept.com>
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
This change implements Xtensa FDPIC ABI as specified in the first
version of the following document:
https://github.com/jcmvbkbc/xtensa-abi/blob/master/fdpic-xtensa.txt
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
GCC-14 raises `-Wint-conversion` error
if lvalues are of pointer types and rvalues
are of integer types.
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
- 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>
|
|
Glibc and musl both defines this macro.
Glibc defines it for 64-bit time_t on 32-bit arch
and for 64-bit architectures.
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
Remove ^L (0x0c) chars from source code.
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
|
Macros __attribute__, __format__ and __printf__ are defined in argp.h
for compatibility with ANSI and old gccs. But leaving them effective
out of the scope of the header may break applications relying on
these compiler attributes even with __STRICT_ANSI__ defined. So undef
the macros after using.
Signed-off-by: Yao Zi <ziyao@disroot.org>
Reviewed-by: Petr Vorel <petr.vorel@gmail.com>
|
|
|
|
|
|
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>
|
|
- 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>
|
|
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>
|
|
The (glibc) documentation for _DEFAULT_SOURCE states:
The "default" definitions comprise those required by
POSIX.1-2008 and ISO C99, as well as various definitions
originally derived from BSD and System V. On glibc 2.19
and earlier, these defaults were approximately equivalent
to explicitly defining the following:
cc -D_BSD_SOURCE -D_SVID_SOURCE -D_POSIX_C_SOURCE=200809
It also states that _BSD_SOURCE and _SVID_SOURCE are deprecated, and
have the same effect as setting _DEFAULT_SOURCE.
Therefore, when any of _BSD_SOURCE, _SVID_SOURCE or _DEFAULT_SOURCE is
set, the three macros should be set, and POSIX 2008.09 compatibility
should be enabled.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
|
|
Nowadays modern libcs like Glibc and musl currently
support processing of RELATIVE relocations compressed
with DT_RELR format. However I have noticed that uClibc-ng
doesn't support this feature and if the source will be linked with
`-Wl,-z,pack-relative-relos` (bfd) or `-Wl,--pack-dyn-relocs=relr`
(lld) then ld.so cannot properly load the produced DSO.
This patch is intended to fix this issue and adds applying
of DT_RELR relative relocation.
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
The fchmod() function is present in POSIX 2001.12.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
|
|
The S_ISSOCK() macro is present in POSIX 2001.12.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
|
|
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>
|
|
Commit 21cbb6fe ("unistd.h: put getppid under XOPEN2K8") introduced a
new __THROWNL specification for non-leaf throws. It also made use of
these in the setjmp.h header. The functions that use this specification
(longjmp and siglongjmp) have their extern __libc__* equivalent
definition prototype specified using __typeof__ for the internal
function signatures. For C++ this copies the throw() specifier, since
this is part of the type for C++. The attribute in C is not.
This commit explicitly types out the signature for the two functions to
be compatible between the C++ and C worlds.
An alternative would be to keep the __typeof__ declaration and use
the copy attribute. Then the __THROWNL part could be thrown out since
the C attribute would be copied and the C++ exception specifier would
be part of the signature from __type__. However, since the copy
attribute is not supported for all compilers supported by uclibc-ng
this is not viable at this time.
|
|
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>
|
|
|
|
|
|
Signed-off-by: Evgeniy Manachkin <sfstudio@wi-cat.ru>
|
|
|
|
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 missing ARCv2 check in MATCH_MACHINE macro.
Update comment for EM_ARCV2 define.
Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
|
|
See the C11 standard 7.2 §3
The definition is copied from glibc.
Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
|
|
This borrows getloadavg.c from musl.
getloadavg pops up often. Recently llvm and rust are dependent on it.
glibc and musl have it and no-one actually checks if it's available in your libc.
It's just become way easier to add it in uclibc-ng rather than patch everything else.
Signed-off-by: Lance Fredrickson <lancethepants@gmail.com>
|
|
|
|
|
|
- use the provided __res_state() method instead of direct access
to struct __res_state pointer &_res/*__resp
- change the __UCLIBC_HAS_TLS__ protected __res_state() implementation
to the one where the comment 'When threaded, _res may be a per-thread
variable.' indicates this should be used with threads/TLS enabled
Fixes the following segfaults with buildroot raspberrypi3_64_defconfig
(uclibc, -Os, Note: runs fine using the raspberrypi3_defconfig):
$ /usr/sbin/ntpd -n -d
1970-01-01T00:01:49 ntpd[249]: INIT: ntpd ntpsec-1.2.0 2021-11-03T20:39:50Z: Starting
1970-01-01T00:01:49 ntpd[249]: INIT: Command line: /usr/sbin/ntpd -n -d
1970-01-01T00:01:49 ntpd[249]: INIT: precision = 7.240 usec (-17)
1970-01-01T00:01:49 ntpd[249]: INIT: successfully locked into RAM
1970-01-01T00:01:49 ntpd[249]: CONFIG: readconfig: parsing file: /etc/ntp.conf
1970-01-01T00:01:49 ntpd[249]: CONFIG: restrict nopeer ignored
1970-01-01T00:01:49 ntpd[249]: INIT: Using SO_TIMESTAMPNS
1970-01-01T00:01:49 ntpd[249]: IO: Listen and drop on 0 v6wildcard [::]:123
1970-01-01T00:01:49 ntpd[249]: IO: Listen and drop on 1 v4wildcard 0.0.0.0:123
1970-01-01T00:01:49 ntpd[249]: IO: Listen normally on 2 lo 127.0.0.1:123
1970-01-01T00:01:49 ntpd[249]: IO: Listen normally on 3 eth0 172.16.0.30:123
1970-01-01T00:01:49 ntpd[249]: IO: Listen normally on 4 lo [::1]:123
1970-01-01T00:01:49 ntpd[249]: IO: Listen normally on 5 eth0 [fe80::ba27:ebff:fea6:340%2]:123
1970-01-01T00:01:49 ntpd[249]: IO: Listening on routing socket on fd #22 for interface updates
1970-01-01T00:01:50 ntpd[249]: SYNC: Found 10 servers, suggest minsane at least 3
1970-01-01T00:01:50 ntpd[249]: INIT: MRU 10922 entries, 13 hash bits, 65536 bytes
1970-01-01T00:01:50 ntpd[249]: statistics directory /var/NTP/ does not exist or is unwriteable, error No such file or directory
1970-01-01T00:01:51 ntpd[249]: DNS: dns_probe: 0.pool.ntp.org, cast_flags:8, flags:101
Segmentation fault (core dumped)
$ ./host/bin/aarch64-buildroot-linux-uclibc-gdb ./build/ntpsec-1_2_0/build/main/ntpd/ntpd core
Core was generated by `/usr/sbin/ntpd -n -d'.
Program terminated with signal SIGSEGV, Segmentation fault.
(gdb) where
#0 0x0000007f8ff1f150 in res_sync_func () at libc/inet/resolv.c:3356
#1 0x0000007f8ff1c468 in __open_nameservers () at libc/inet/resolv.c:949
#2 0x0000007f8ff1b498 in __dns_lookup (name=0x55943c67f0 "0.pool.ntp.org",
type=1, outpacket=0x7f8fe91c48, a=0x7f8fe91c08) at libc/inet/resolv.c:1134
#3 0x0000007f8ff1d744 in __GI_gethostbyname_r (
name=0x55943c67f0 "0.pool.ntp.org", result_buf=0x7f8fe92628,
buf=0x7f8fe91d90 "", buflen=992, result=0x7f8fe92670,
h_errnop=0x7f8fe92668) at libc/inet/resolv.c:1966
#4 0x0000007f8ff1d9a0 in __GI_gethostbyname2_r (
name=0x55943c67f0 "0.pool.ntp.org", family=2, result_buf=0x7f8fe92628,
buf=0x7f8fe91d70 "0.pool.ntp.org", buflen=1024, result=0x7f8fe92670,
h_errnop=0x7f8fe92668) at libc/inet/resolv.c:2065
#5 0x0000007f8ff16924 in gaih_inet (name=0x55943c67f0 "0.pool.ntp.org",
service=0x7f8fe92828, req=0x7f8fe92890, pai=0x7f8fe92838)
at libc/inet/getaddrinfo.c:596
#6 0x0000007f8ff17624 in __GI_getaddrinfo (
name=0x55943c67f0 "0.pool.ntp.org",
service=0x5582eb8acd "\377H\213D$\bL\211\367H\213\260\270",
hints=0x7f8fe92890, pai=0x5582ee1bf8) at libc/inet/getaddrinfo.c:957
#7 0x0000005582ea60f4 in _start ()
(gdb) p _res
$1 = {options = 0, nsaddr_list = {{sin_family = 0, sin_port = 0, sin_addr = {
s_addr = 0}, sin_zero = "\000\000\000\000\000\000\000"}, {
sin_family = 0, sin_port = 0, sin_addr = {s_addr = 0},
sin_zero = "\000\000\000\000\000\000\000"}, {sin_family = 0,
sin_port = 0, sin_addr = {s_addr = 0},
sin_zero = "\000\000\000\000\000\000\000"}}, dnsrch = {0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0}, nscount = 0 '\000', ndots = 0 '\000',
retrans = 0 '\000', retry = 0 '\000', defdname = '\000' <repeats 255 times>,
nsort = 0 '\000', pfcode = 0, id = 0, res_h_errno = 0, sort_list = {{addr = {
s_addr = 0}, mask = 0}, {addr = {s_addr = 0}, mask = 0}, {addr = {
s_addr = 0}, mask = 0}, {addr = {s_addr = 0}, mask = 0}, {addr = {
s_addr = 0}, mask = 0}, {addr = {s_addr = 0}, mask = 0}, {addr = {
s_addr = 0}, mask = 0}, {addr = {s_addr = 0}, mask = 0}, {addr = {
s_addr = 0}, mask = 0}, {addr = {s_addr = 0}, mask = 0}}, _u = {
_ext = {nsaddrs = {0x0, 0x0, 0x0}, nscount = 0 '\000', nstimes = {0, 0,
0}, nssocks = {0, 0, 0}, nscount6 = 0, nsinit = 0}}}
(gdb) p &_res
$2 = (struct __res_state *) 0x7f8ff8fd98 <_res>
(gdb) p rp
$3 = (struct __res_state *) 0x7fffffffff
And the following uclibc code at libc/inet/resolv.c:3356:
3345 static void res_sync_func(void)
3346 {
3347 struct __res_state *rp = &(_res);
3348 int n;
3349
3350 /* If we didn't get malloc failure earlier... */
3351 if (__nameserver != (void*) &__local_nameserver) {
3352 /* TODO:
3353 * if (__nameservers < rp->nscount) - try to grow __nameserver[]?
3354 */
3355 #ifdef __UCLIBC_HAS_IPV6__
3356 if (__nameservers > rp->_u._ext.nscount)
3357 __nameservers = rp->_u._ext.nscount;
3358 n = __nameservers;
The special thing about ntpsec is the DNS lookup in an extra thread
and/or the call to res_init(), see ntpsec-1_2_0/ntpd/ntp_dns.c:
69 msyslog(LOG_INFO, "DNS: dns_probe: %s, cast_flags:%x, flags:%x%s",
70 hostname, pp->cast_flags, pp->cfg.flags, busy);
71 if (NULL != active) /* normally redundant */
72 return false;
73
74 active = pp;
75
76 sigfillset(&block_mask);
77 pthread_sigmask(SIG_BLOCK, &block_mask, &saved_sig_mask);
78 rc = pthread_create(&worker, NULL, dns_lookup, pp);
and
165 static void* dns_lookup(void* arg)
166 {
167 struct peer *pp = (struct peer *) arg;
168 struct addrinfo hints;
169
170 #ifdef HAVE_SECCOMP_H
171 setup_SIGSYS_trap(); /* enable trap for this thread */
172 #endif
173
174 #ifdef HAVE_RES_INIT
175 /* Reload DNS servers from /etc/resolv.conf in case DHCP has updated it.
176 * We only need to do this occasionally, but it's not expensive
177 * and simpler to do it every time than it is to figure out when
178 * to do it.
179 * This res_init() covers NTS too.
180 */
181 res_init();
182 #endif
183
184 if (pp->cfg.flags & FLAG_NTS) {
185 #ifndef DISABLE_NTS
186 nts_probe(pp);
187 #endif
188 } else {
189 ZERO(hints);
190 hints.ai_protocol = IPPROTO_UDP;
191 hints.ai_socktype = SOCK_DGRAM;
192 hints.ai_family = AF(&pp->srcadr);
193 gai_rc = getaddrinfo(pp->hostname, NTP_PORTA, &hints, &answer);
194 }
$ /usr/lib/uclibc-ng-test/test/inet/tst-res
Segmentation fault (core dumped)
$ ./host/bin/aarch64-buildroot-linux-uclibc-gdb ./build/uclibc-ng-test-0844445e7358eb10e716155b55b0fb23e88d644a/test/inet/tst-res core
Core was generated by `/usr/lib/uclibc-ng-test/test/inet/tst-res'.
Program terminated with signal SIGSEGV, Segmentation fault.
(gdb) where
#0 __GI___res_init () at libc/inet/resolv.c:3514
#1 0x0000005591e507e4 in main (argc=<optimized out>, argv=<optimized out>)
at tst-res.c:20
First reported here:
https://lore.kernel.org/buildroot/20211028230131.5f50d6e7@gmx.net/
https://www.mail-archive.com/devel@uclibc-ng.org/msg01085.html
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
|
|
With new compiler (gcc >= 9 ?) building uClibc-ng now gives this sort of warnings:
./include/libc-symbols.h:426:25: warning: '__EI_localeconv' specifies less restrictive attribute than its target 'localeconv': 'nothrow' [-Wmissing-attributes]
426 | extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local))))
| ^~~~~
./include/libc-symbols.h:429:29: note: in expansion of macro '__hidden_ver1'
429 | # define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
| ^~~~~~~~~~~~~
./include/libc-symbols.h:497:32: note: in expansion of macro 'hidden_def'
497 | # define libc_hidden_def(name) hidden_def (name)
| ^~~~~~~~~~
libc/misc/locale/locale.c:306:1: note: in expansion of macro 'libc_hidden_def'
306 | libc_hidden_def(localeconv)
| ^~~~~~~~~~~~~~~
In file included from libc/misc/locale/localeconv.c:8:
libc/misc/locale/locale.c:261:15: note: '__EI_localeconv' target declared here
261 | struct lconv *localeconv(void)
| ^~~~~~~~~~
The fix is mostly being backported/adapted from glibc.
|
|
The trigger for this resync was ADDR_NO_RANDOMIZE, which was not
defined in uClibc-ng, but is used for example by the uftrace project.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
Since Linux 3.11, O_TMPFILE allows to create unnamed files that can be
linked later on. It is internally defined as (O_TMPFILE | O_DIRECTORY)
to make it fail on old kernels.
Copying definitions from glibc for O_TMPFILE is not enough to support
O_TMPFILE; The open() wrapper also need to pass the mode when the flag
contains O_TMPFILE, otherwise, it will pass mode 000 which will succeed
but yield unexpected results.
openat() is curiously not affected since it passes the mode
unconditionally..
Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
|
|
The strdup() function is present in POSIX 2008.09.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
|
|
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>
|
|
Signed-off-by: akater <nuclearspace@gmail.com>
|
|
|
|
copied from musl 1.2.1.
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
|
Import musl C sockatmark implementation into uClibc-ng.
Signed-off-by: Clement Leger <cleger@kalray.eu>
Acked-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
|
|
Recent is*_l fix broke uclibc build because removed __isctype_l
definition was used in libc/misc/ctype/ctype.c. Restore it.
Fixes: d1a3ca7ca566 ("include/ctype.h: drop is*_l macro definitions")
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
ctype locale-specific macro definitions are broken because they result
in dereference of pointer to structure of incomplete type.
Drop these macros since they are optional and let applications use
functions with the same names.
This change fixes parted-3.3 build with uClibc-ng:
http://autobuild.buildroot.net/results/b7ba1210d5aa184b133f0171da621d2b0083ec39/build-end.log
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
Similar to glibc commit
https://sourceware.org/git/?p=glibc.git;a=commit;h=6bbfc5c09fc5b5e3d4a0cddbbd4e2e457767dae7
we need to handle Linux kernel change, which removed stat64 family from default syscall set.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Waldemar Brodkorb <wbrodkorb@conet.de>
|