summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-09-14kvx: use a custom stat.h headerYann Sionneau
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>
2023-09-14kvx: define that kvx port supports statx syscallYann Sionneau
Define that kvx Linux port supports statx syscall. Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2023-09-14kvx: align specification of user regsYann Sionneau
Align the specification of the ptrace interface with how it is specified on RISC-V. Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2023-09-14kvx: atomic: rework using compiler builtinsYann Sionneau
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2023-09-14kvx: add support for kv3-2 (Coolidge v2 SoC)Yann Sionneau
The only difference, with regard to libc, is the compile flag: -march= Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2023-09-14fstatat: add wrapper that uses statx for non-legacy archYann Sionneau
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>
2023-09-14add support for systems without legacy setrlimit/getrlimit syscallsYann Sionneau
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>
2023-09-14fstat: add missing return value statement for the statx wrapping caseYann Sionneau
Add missing return value statement to fstat for the statx wrapping case. Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2023-09-14fstatat64: define it as a wrapper of statx if the kernel does not support ↵Yann Sionneau
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>
2023-06-12Fix compilation error on noMMU/nothread systems with old compilersYann Sionneau
For instance with buildroot config sipeed_maix_bit_defconfig the pre-processor generates if (1) r = ({ long _sys_result; { register long int _a7 __asm__ ("a7"); register long _a3 __asm__ ("a3"); long _a3tmp; register long _a2 __asm__ ("a2"); long _a2tmp; register long _a1 __asm__ ("a1"); long _a1tmp; long _a0tmp; register long _a0 __asm__ ("a0"); _a0tmp = (long) (clock_id); _a0 = _a0tmp; _a1tmp = (long) (flags); _a1 = _a1tmp; _a2tmp = (long) (req); _a2 = _a2tmp; _a3tmp = (long) (rem); _a3 = _a3tmp; _a7 = (115); __asm__ volatile ( "scall\n\t" : "=r" (_a0) : "r"(_a7) , "r" (_a0), "r" (_a1), "r" (_a2), "r" (_a3) : "memory"); _sys_result = _a0; } _sys_result; }); else { int oldstate = LIBC_CANCEL_ASYNC (); r = ({ long _sys_result; { register long int _a7 __asm__ ("a7"); register long _a3 __asm__ ("a3"); long _a3tmp; register long _a2 __asm__ ("a2"); long _a2tmp; register long _a1 __asm__ ("a1"); long _a1tmp; long _a0tmp; register long _a0 __asm__ ("a0"); _a0tmp = (long) (clock_id); _a0 = _a0tmp; _a1tmp = (long) (flags); _a1 = _a1tmp; _a2tmp = (long) (req); _a2 = _a2tmp; _a3tmp = (long) (rem); _a3 = _a3tmp; _a7 = (115); __asm__ volatile ( "scall\n\t" : "=r" (_a0) : "r"(_a7) , "r" (_a0), "r" (_a1), "r" (_a2), "r" (_a3) : "memory"); _sys_result = _a0; } _sys_result; }) ; LIBC_CANCEL_RESET (oldstate); } And also the compiler issues these warnings: librt/clock_nanosleep.c: In function 'clock_nanosleep': librt/clock_nanosleep.c:43:22: warning: implicit declaration of function 'LIBC_CANCEL_ASYNC'; did you mean 'LIBC_CANCEL_HANDLED'? [-Wimplicit-function-declaration] 43 | int oldstate = LIBC_CANCEL_ASYNC (); | ^~~~~~~~~~~~~~~~~ | LIBC_CANCEL_HANDLED librt/clock_nanosleep.c:48:7: warning: implicit declaration of function 'LIBC_CANCEL_RESET'; did you mean 'LIBC_CANCEL_HANDLED'? [-Wimplicit-function-declaration] 48 | LIBC_CANCEL_RESET (oldstate); | ^~~~~~~~~~~~~~~~~ | LIBC_CANCEL_HANDLED So if the compiler is a bit picky and does not optimize the if (1) {} else {} it can fail to link with undefined symbols. This patch fixes this issue: no more warning. Btw, that's the solution that is already used in the following cancellation point files: * libc/sysdeps/linux/common/__syscall_fcntl.c * libc/sysdeps/linux/common/__syscall_fcntl64.c * libc/sysdeps/linux/common/ioctl.c * libc/sysdeps/linux/common/openat.c * libc/sysdeps/linux/common/open.c Signed-off-by: Yann Sionneau <yann@sionneau.net>
2023-06-12Revert "librt: avoid compilation error"Yann Sionneau
This reverts commit 08d46f1ce21e4ec51b2b1626beeaea6cbe7fdc6b. Signed-off-by: Yann Sionneau <yann@sionneau.net>
2021-12-24Fix some warnings due to type issuesYann Sionneau
Fixes those two warnings: In file included from <command-line>: libc/sysdeps/linux/common/openat64.c:18:33: warning: 'openat64' alias between functions of incompatible types 'int(int, const char *, int, ...)' and 'int(int, const char *, int, mode_t)' {aka 'int(int, const char *, int, unsigned int)'} [-Wattribute-alias=] 18 | strong_alias_untyped(__openat64,openat64) | ^~~~~~~~ ./include/libc-symbols.h:177:31: note: in definition of macro '_strong_alias_untyped' 177 | extern __typeof (aliasname) aliasname __attribute__ ((alias (#name))) __attribute_copy__ (name); | ^~~~~~~~~ libc/sysdeps/linux/common/openat64.c:18:1: note: in expansion of macro 'strong_alias_untyped' 18 | strong_alias_untyped(__openat64,openat64) | ^~~~~~~~~~~~~~~~~~~~ libc/sysdeps/linux/common/openat64.c:14:12: note: aliased declaration here 14 | static int __openat64(int fd, const char *file, int oflag, mode_t mode) | ^~~~~~~~~~ and CC libc/sysdeps/linux/common/stat.os libc/sysdeps/linux/common/stat.c: In function 'stat': libc/sysdeps/linux/common/stat.c:28:40: warning: passing argument 3 of 'fstatat64' from incompatible pointer type [-Wincompatible-pointer-types] 28 | return fstatat64(AT_FDCWD, file_name, buf, 0); | ^~~ | | | struct stat * In file included from libc/sysdeps/linux/common/stat.c:11: ./include/sys/stat.h:258:35: note: expected 'struct stat64 * restrict' but argument is of type 'struct stat *' 258 | struct stat64 *__restrict __buf, int __flag) | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2021-12-24Fix -Wundef related warningsYann Sionneau
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2021-12-24kvx: fix warning about __BITS_PER_LONG not being definedYann Sionneau
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2021-08-25Fix warnings due to missing attributes for __EI_ prefixed symbolsYann Sionneau
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.
2021-06-04powerpc: fix PIE/PIC builds with newer gcc/binutils which use secureplt by ↵Yann Sionneau
default This patch fixes segfault of all user space processes (including init, which caused a panic) on recent buildroot powerpc32 builds. The issue has been reported by Romain Naour in this thread: https://mailman.uclibc-ng.org/pipermail/devel/2021-May/002068.html Recent buildroot toolchain enables secure PLT in powerpc gcc. The latter will then supply -msecure-plt to gas invocations by default. Recent buildroot also enables PIE by defaults. For the secure PLT to work in PIC, the r30 register needs to point to the GOT. Old "bss plt" was just a one-instruction-wide PLT slot, pointed-to by a R_PPC_JMP_SLOT relocation, which was written on-the-fly to contain a branch instruction to the correct address. It therefore had to stay writable. New secure PLT only contains read-only code which loads the branch address from the writable GOT. Note: secure PLT without PIC does not need r30 to be set. Because offset between plt stub code and got is known at link-time. In this case the PLT entry looks like: 1009b3e0 <__uClibc_main@plt>: 1009b3e0: 3d 60 10 0e lis r11,4110 1009b3e4: 81 6b 03 74 lwz r11,884(r11) 1009b3e8: 7d 69 03 a6 mtctr r11 1009b3ec: 4e 80 04 20 bctr Whereas secure PLT with PIC - offset between plt and got is unknown at link-time - looks like this: 000af800 <00000000.plt_pic32.__uClibc_main>: af800: 81 7e 03 80 lwz r11,896(r30) af804: 7d 69 03 a6 mtctr r11 af808: 4e 80 04 20 bctr af80c: 60 00 00 00 nop Signed-off-by: Yann Sionneau <yann@sionneau.net>
2020-12-23stdlib: fix potential UB and integer overflow with huge allocations using ↵Yann Sionneau
malloc-simple allocator Two things are fixed by this commit: 1/ It is wrong to allocate an object of size > PTRDIFF_MAX. It is explained in this thread: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303 2/ There was a possible integer overflow in both malloc() and memalign() implementations of stdlib/malloc-simple. The malloc() integer overflow issue is fixed by the side effect of fixing the PTRDIFF_MAX issue. The memalign() one is fixed by adding a comparison. Signed-off-by: Yann Sionneau <yann@sionneau.net>
2020-11-23libcrypt: add missing errno.h headerYann Sionneau
Fixes: libcrypt/crypt.c:29:15: error: 'EINVAL' undeclared (first use in this function) __set_errno(EINVAL); ^~~~~~ Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-10-19hasmntopt: better option matchingYann Sionneau
Previous implementation was respecting the man page description of what the function should do. Also the function does not seem to be defined by POSIX. But... to be really useful the function needs to handle option matching and not just substring matching. This is copy pasted from glibc. This fixes issue reported by https://github.com/wbx-github/uclibc-ng/issues/8 that can happen for instance there: https://github.com/frida/glib/blob/master/gio/gunixmounts.c#L622 Signed-off-by: Yann Sionneau <yann@sionneau.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>
2020-09-22Fix warning due to unused label in NPTLYann Sionneau
Fixes this: In file included from libpthread/nptl/pthread_create.c:48:0: libpthread/nptl/allocatestack.c: In function 'allocate_stack': libpthread/nptl/allocatestack.c:602:6: warning: label 'mprot_error' defined but not used [-Wunused-label] mprot_error: ^~~~~~~~~~~ Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-09-22Fix warning due to relaxed function declaration prototypeYann Sionneau
Fixes this: libintl/libintl.c:81:13: warning: function declaration isn't a prototype [-Wstrict-prototypes] const char *_nl_expand_alias () { return NULL; } ^~~~~~~~~~~~~~~~ Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-09-22Fix warning due to unused variable in strlenYann Sionneau
Fixes this: libc/string/generic/strlen.c: In function 'strlen': libc/string/generic/strlen.c:31:31: warning: variable 'magic_bits' set but not used [-Wunused-but-set-variable] unsigned long int longword, magic_bits, himagic, lomagic; ^~~~~~~~~~ Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-09-22Fix warning about macro redefinitionYann Sionneau
Fixes this: libc/misc/internals/tempname.c: In function 'brain_damaged_fillrand': libc/misc/internals/tempname.c:155:0: warning: "L" redefined #define L ((UINT32_MAX % NUM_LETTERS + 1) % NUM_LETTERS) In file included from ./libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.h:24:0, from ./include/bits/libc-lock.h:35, from ./include/bits/stdio-lock.h:22, from ./include/bits/uClibc_mutex.h:73, from ./include/bits/uClibc_stdio.h:83, from ./include/stdio.h:71, from libc/misc/internals/tempname.c:35: ./libc/sysdeps/linux/kvx/sysdep.h:40:0: note: this is the location of the previous definition # define L(name) $L##name Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-09-22Fix warning about missing const qualifierYann Sionneau
Fixes this: In file included from libc/misc/fnmatch/fnmatch.c:235:0: libc/misc/fnmatch/fnmatch_loop.c: In function 'internal_fnmatch': libc/misc/fnmatch/fnmatch_loop.c:207:21: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] CHAR *p_init = p; ^ libc/misc/fnmatch/fnmatch_loop.c:208:21: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] CHAR *n_init = n; Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-09-22Fix unused variable warning in dl-startup.cYann Sionneau
SEND_STDERR_DEBUG does nothing if __SUPPORT_LD_DEBUG_EARLY__ is not defined thus causing a warning. Fixes this: In file included from ldso/ldso/ldso.c:86:0: ldso/ldso/dl-startup.c: In function '_dl_start': ldso/ldso/dl-startup.c:313:13: warning: variable 'strtab' set but not used [-Wunused-but-set-variable] char *strtab; ^~~~~~ Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-09-15Fix memory corruption due to struct stat fieldYann Sionneau
Kernel stat/stat64 structure and uClibc-ng ones were not in sync regarding the timespec fields. Kernel had them but uClibc did not expose it in some cases. Man page says that stat struct should have timespec fields if: * _POSIX_C_SOURCE is defined to 200809L or greater or * _XOPEN_SOURCE is defined to 700 or greater or * _BSD_SOURCE is defined or * _SVID_SOURCE is defined In the case of buildroot vim build, neither _BSD_SOURCE nor _SVID_SOURCE were defined. Only _POSIX_C_SOURCE and _XOPEN_SOURCE were defined. uClibc-ng header only checked for _BSD_SOURCE and _SVID_SOURCE via __USE_MISC. This patch adds a check to __USE_XOPEN2K8 which is defined if _POSIX_C_SOURCE >= 200809L or _XOPEN_SOURCE >= 700 This for instance fixes a crash at startup of vim (not the busybox one) on aarch64 and all other arch where in kernel STAT_HAVE_NSEC is set and where stat.h in uClibc-ng comes from libc/sysdeps/linux/common-generic/bits Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-08-25ldso: Fix pointer cast warningYann Sionneau
Fixes the following compilation warning for 64-bit arch with TLS support: CC ldso/libdl/libdl.oS ldso/libdl/libdl.c: In function 'do_dlsym': ldso/libdl/libdl.c:739:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] ret = _dl_tls_symaddr ((struct link_map *)sym_ref.tpnt, (Elf32_Addr)ret); ^
2020-04-01or1k: fix some TLS issuesYann Sionneau
Before this commit tst-tls-at-ctor test would segfault. After it passes. testsuite run before: https://pastebin.com/504JgQXa testsuite run after: https://pastebin.com/d2aNciVt Stafford Horne already fixed it in glibc: * https://github.com/openrisc/or1k-glibc/blob/bcd87396ebe78228645c0731b06c934dfd88855a/sysdeps/or1k/dl-machine.h#L298 * https://github.com/openrisc/or1k-glibc/blob/bcd87396ebe78228645c0731b06c934dfd88855a/sysdeps/or1k/dl-machine.h#L99
2020-01-30poll: avoid calling select with empty sets which hangs the processYann Sionneau
Avoid calling select with empty sets which hangs the process This makes uClibc-ng act like glibc and musl Without this fix the test_poll of python3 testsuite hangs forever Scenario of the issue: If you call poll with only invalid file descriptors, like in python3 testsuite (https://github.com/python/cpython/blob/master/Lib/test/test_poll.py#L83) You will go through uClibc poll emulation code, which is based on select syscall. Your first call to select will fail, it will return -1 and errno will be set to EBADF: https://github.com/wbx-github/uclibc-ng/blob/master/libc/sysdeps/linux/common/poll.c#L120 Then you will go through the for loop which tests individually each file descriptor by calling select on each one: https://github.com/wbx-github/uclibc-ng/blob/master/libc/sysdeps/linux/common/poll.c#L163 each call will also return -1 with errno being equal to EBADF. Therefore all pollfd will have the POLLNVAL flag in their respective revents field. And, the most important, rset/wset/xset will stay empty. Then the for loop ends, the "continue" makes the while loop run again. The following select() is run again: https://github.com/wbx-github/uclibc-ng/blob/master/libc/sysdeps/linux/common/poll.c#L120 But this time the sets are empty. If the poll was called with timeout set to -1, this select will hang forever because there is no timeout and the sets are empty so no event will ever wake it up. test program: int main(void) { struct pollfd pfd; int ret; int pipe_fds[2]; pipe(pipe_fds); close(pipe_fds[0]); close(pipe_fds[1]); pfd.fd = pipe_fds[0]; pfd.events = POLLIN | POLLOUT | POLLPRI; pfd.revents = 0; ret = poll(&pfd, 1, -1); printf("ret: %d\n", ret); if (ret < 0) printf("error: %s", strerror(errno)); else { puts("revents: "); if (pfd.revents & POLLERR) printf(" POLLERR"); if (pfd.revents & POLLHUP) printf(" POLLHUP"); if (pfd.revents & POLLNVAL) printf(" POLLNVAL"); puts(""); } return 0; } This hangs on uClibc-ng aarch64 and Kalray's arch (kv3) but does the following on musl and glibc: " ret: 1 revents: POLLNVAL " strace output of this program with uClibc *without* the patch applied: pselect6(4, [3], [3], [3], NULL, NULL) = -1 EBADF (Bad file descriptor) pselect6(4, [3], [3], [3], {tv_sec=0, tv_nsec=0}, NULL) = -1 EBADF (Bad file descriptor) pselect6(0, 0x7ffffffb80, 0x7ffffffb68, 0x7ffffffb50, NULL, NULL (never finishes) strace output of this program with uClibc *with* the patch applied: pselect6(4, [3], [3], [3], NULL, NULL) = -1 EBADF (Bad file descriptor) pselect6(4, [3], [3], [3], {tv_sec=0, tv_nsec=0}, NULL) = -1 EBADF (Bad file descriptor) write(1, "ret: 1\n", 7ret: 1 ) = 7 write(1, "revents: \n", 10revents: ) = 10 write(1, " POLLNVAL\n", 10 POLLNVAL ) = 10 exit_group(0) = ? +++ exited with 0 +++
2019-11-17riscv64: fix comments borrowed from or1k portYann Sionneau
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2019-07-05Fix header installation for recent 64-only archYann Sionneau
Summary: Recent arch do not support Legacy. Thus they don't define ARCH_HAS_DEPRECATED_SYSCALLS But this led to per-arch headers not being installed and common-generic ones taking precedence. So it was impossible to declare arch-specific statfs.h for instance, to force 64-bit mode only. This was leading to the following situation to happen: 1/ an application compiles (say without -D_FILE_OFFSET_BITS set) it therefore uses struct statfs from libc/sysdeps/linux/common-generic/bits/statfs.h where f_type and f_bsize fields are U32: https://elixir.bootlin.com/uclibc-ng/latest/source/libc/sysdeps/linux/common-generic/bits/statfs.h#L18 2/ application calls "statfs" 3/ uClibc issues "statfs64" syscall (because __NR_statfs64 is defined and __NR_statfs is undefined): https://elixir.bootlin.com/uclibc-ng/latest/source/libc/sysdeps/linux/common/statfs.c#L14 4/ if Linux kernel port is not defining CONFIG_COMPAT, it calls do_statfs_native https://elixir.bootlin.com/linux/latest/source/fs/statfs.c#L195 5/ it does copy_to_user of the size of struct statfs defined in the kernel source tree: https://elixir.bootlin.com/linux/latest/source/fs/statfs.c#L161 6/ Generic struct statfs in the kernel is defined like this: https://elixir.bootlin.com/linux/latest/source/include/uapi/asm-generic/statfs.h#L23 f_type and f_bsize fields are long (64 bits) for 64-bit archs. 7/ memory corruption occurs because of this mismatch Solution: Allow to not define __ARCH_HAS_DEPRECATED_SYSCALLS__ *and* declare its own arch-specific statfs.h header, matching the kernel one. (for instance with f_type and f_bsize defined as long) Does this change break other archs? This change allows headers in libc/sysdeps/linux/<ARCH>/bits/ to override ones in libc/sysdeps/linux/common-generic/bits/ The only arch which does not define __ARCH_HAS_DEPRECATED_SYSCALLS__ *and* has a header in libc/sysdeps/linux/<ARCH>/bits/ which can conflict with one in libc/sysdeps/linux/common-generic/bits/ is c6x. The file that can override is ../libc/sysdeps/linux/c6x/bits/kernel_stat.h This, btw, means that, today, this file is there and is not used (during compilation, GNU Make overrides the rule): Makefile.in:152: warning: overriding recipe for target `include/bits/kernel_stat.h' Makefile.in:148: warning: ignoring old recipe for target `include/bits/kernel_stat.h' I was not able to compile uClibc with the only binary toolchain I found for c6x arch (gcc-4.5.1 from code sourcery: https://sourcery.mentor.com/GNUToolchain/release1882) However, I can tell that c6x's kernel_stat.h only defines two structs: kernel_stat and kernel_stat64: https://elixir.bootlin.com/uclibc-ng/latest/source/libc/sysdeps/linux/c6x/bits/kernel_stat.h And I can also tell that those structs are only used when using xstat conversion functions (__xstat32_conv / xstat_conv) which are only used and present in the __ARCH_HAS_DEPRECATED_SYSCALLS__ == y case. However, c6x does not define __ARCH_HAS_DEPRECATED_SYSCALLS__ So I think I can say that this change does not affect c6x nor other archs.
2019-06-21Fix compilation issue when libuargp is compiled without ↵Yann Sionneau
__UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ This fixes the issue reported at https://github.com/wbx-github/uclibc-ng/issues/2 Signed-off-by: Yann Sionneau <yann@sionneau.net>
2019-04-14Fix _dl_deallocate_tls in !SHARED caseYann Sionneau
This patch seems needed in builds where - SHARED is not defined (no shared lib support) - and USE_TLS is set Without this patch, static_dtv is free'ed. See the following backtrace: 0 __do_check_chunk (p=0x52638 <fork_handler_pool+2296>) at libc/stdlib/malloc-standard/malloc.c:80 1 0x0000000000017fa0 in __do_check_inuse_chunk (p=0x52638 <fork_handler_pool+2296>) at libc/stdlib/malloc-standard/malloc.c:143 2 0x0000000000017354 in free (mem=0x52648 <static_dtv>) at libc/stdlib/malloc-standard/free.c:293 3 0x000000000002d5b0 in _dl_deallocate_tls (tcb=0x58690, dealloc_tcb=false) at libpthread/nptl/sysdeps/generic/dl-tls.c:588 4 0x0000000000021c0c in __deallocate_stack (pd=0x58000) at libpthread/nptl/allocatestack.c:717 5 0x0000000000024408 in __free_tcb (pd=0x58000) at libpthread/nptl/pthread_create.c:217 6 0x00000000000200ac in pthread_join (threadid=360448, thread_return=0x0 <k1c_start>) at libpthread/nptl/pthread_join.c:109 7 0x0000000000010354 in tf (a=0x58000) at tst-basic3.c:42 8 0x00000000000247c8 in start_thread (arg=0x4000200960) at libpthread/nptl/pthread_create.c:285 9 0x0000000000026560 in ?? () This backtrace is obtained while debugging tst-basic3 from the uclibc-ng nptl testsuite. It aborts because of the assert in malloc: https://elixir.bootlin.com/uclibc-ng/v1.0.31/source/libc/stdlib/malloc-standard/malloc.c#L80 Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2019-04-14Fix TLS allocation and loading in !SHARED caseYann Sionneau
For ARCH where shared lib are not supported: - SHARED is not set (!SHARED is true) - __ARCH_HAS_NO_LDSO__ is set so code inside #if !defined __ARCH_HAS_NO_LDSO__ && !defined SHARED is compiled-out. But without a call do _dl_aux_init(), _dl_phdr stays NULL and __libc_setup_tls won't be able to allocate memory for the in-executable TLS and also won't be able to load the initimage from ELF TLS segment. This results in segfault when doing things like "errno = 0" like in tst-cancel15.c for instance in uClibc-ng testsuite. Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>