| 31b4d3af | 29-Oct-2025 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: remove more __nolibc_enosys() fallbacks
Commit e6366101ce1f ("tools/nolibc: remove __nolibc_enosys() fallback from time64-related functions") removed many of these fallbacks but forgot
tools/nolibc: remove more __nolibc_enosys() fallbacks
Commit e6366101ce1f ("tools/nolibc: remove __nolibc_enosys() fallback from time64-related functions") removed many of these fallbacks but forgot a few.
Finish the job.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu>
show more ...
|
| 3e1da545 | 29-Oct-2025 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: remove now superfluous overflow check in llseek
As off_t is now always 64-bit wide this overflow can not happen anymore, remove the check.
Signed-off-by: Thomas Weißschuh <linux@weiss
tools/nolibc: remove now superfluous overflow check in llseek
As off_t is now always 64-bit wide this overflow can not happen anymore, remove the check.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
show more ...
|
| e800e944 | 29-Oct-2025 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: use 64-bit off_t
The kernel uses 64-bit values for file offsets. Currently these might be truncated to 32-bit when assigned to nolibc's off_t values.
Switch to 64-bit off_t consistent
tools/nolibc: use 64-bit off_t
The kernel uses 64-bit values for file offsets. Currently these might be truncated to 32-bit when assigned to nolibc's off_t values.
Switch to 64-bit off_t consistently.
Suggested-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/lkml/cec27d94-c99d-4c57-9a12-275ea663dda8@app.fastmail.com/ Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu>
show more ...
|
| 19c5a681 | 29-Oct-2025 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: prefer the llseek syscall
Make sure to always use the 64-bit safe system call in preparation for 64-bit off_t on 32 bit architectures.
Signed-off-by: Thomas Weißschuh <linux@weissschu
tools/nolibc: prefer the llseek syscall
Make sure to always use the 64-bit safe system call in preparation for 64-bit off_t on 32 bit architectures.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu>
show more ...
|
| d93d0593 | 29-Oct-2025 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: handle 64-bit off_t for llseek
Correctly handle 64-bit off_t values in preparation for 64-bit off_t on 32-bit architectures.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Ack
tools/nolibc: handle 64-bit off_t for llseek
Correctly handle 64-bit off_t values in preparation for 64-bit off_t on 32-bit architectures.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Willy Tarreau <w@1wt.eu>
show more ...
|
| 87506e44 | 29-Oct-2025 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: use 64-bit ino_t
The kernel uses 64-bit values for inode numbers. Currently these might be truncated to 32-bit when assigned to nolibc's ino_t values.
Switch to 64-bit ino_t consisten
tools/nolibc: use 64-bit ino_t
The kernel uses 64-bit values for inode numbers. Currently these might be truncated to 32-bit when assigned to nolibc's ino_t values.
Switch to 64-bit ino_t consistently.
As ino_t is never used directly in kernel ABIs, no systemcall wrappers need to be adapted.
Suggested-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/lkml/cec27d94-c99d-4c57-9a12-275ea663dda8@app.fastmail.com/ Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu>
show more ...
|
| 2d848295 | 09-Nov-2025 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: avoid using plain integer as NULL pointer
While an integer zero is a valid NULL pointer as per the C standard, sparse will complain about it.
Use explicit NULL pointers instead.
Repo
tools/nolibc: avoid using plain integer as NULL pointer
While an integer zero is a valid NULL pointer as per the C standard, sparse will complain about it.
Use explicit NULL pointers instead.
Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/r/202509261452.g5peaXCc-lkp@intel.com/ Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu>
show more ...
|
| 7534b9bf | 02-Nov-2025 |
Willy Tarreau <w@1wt.eu> |
tools/nolibc: clean up outdated comments in generic arch.h
Along the code reorganizations, the file has been keeping the original comments about argv and envp which are no longer relevant to this fi
tools/nolibc: clean up outdated comments in generic arch.h
Along the code reorganizations, the file has been keeping the original comments about argv and envp which are no longer relevant to this file anymore. Let's just drop them.
Acked-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
| 1868c027 | 02-Nov-2025 |
Willy Tarreau <w@1wt.eu> |
tools/nolibc: make the "headers" target install all supported archs
The efforts we go through by installing a single arch are counter productive when the base directory already supports them all, an
tools/nolibc: make the "headers" target install all supported archs
The efforts we go through by installing a single arch are counter productive when the base directory already supports them all, and the arch-specific files are really small. Let's make the "headers" target simply install headers for all supported archs and stop trying to build a hybrid "arch.h" file on the fly, to instead keep the generic one. Now the same nolibc headers installation will be usable with any arch-specific uapi installation.
Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
show more ...
|
| 44bf8bbe | 02-Nov-2025 |
Willy Tarreau <w@1wt.eu> |
tools/nolibc: add the more portable inttypes.h
It's often recommended to only use inttypes.h instead of stdint.h for portability reasons since the former is always present when the latter is present
tools/nolibc: add the more portable inttypes.h
It's often recommended to only use inttypes.h instead of stdint.h for portability reasons since the former is always present when the latter is present, but not conversely, and the former includes the latter. Due to this some simple programs fail to build when including inttypes.h. Let's add one that simply includes nolibc.h to better support these programs.
Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
show more ...
|
| 10f407c6 | 02-Nov-2025 |
Willy Tarreau <w@1wt.eu> |
tools/nolibc: provide the portable sys/select.h
Modern programs tend to include sys/select.h to get FD_SET() and FD_CLR() definitions as well as struct fd_set, but in our case it didn't exist.
The
tools/nolibc: provide the portable sys/select.h
Modern programs tend to include sys/select.h to get FD_SET() and FD_CLR() definitions as well as struct fd_set, but in our case it didn't exist.
The definitions were moved from types.h to sys/select.h, which is now included from nolibc.h, and the sys_select() definition moved there as well from sys.h.
Signed-off-by: Willy Tarreau <w@1wt.eu> [Thomas: adapt to current -next branch] Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
show more ...
|
| 3d66c4e1 | 24-Sep-2025 |
Benjamin Berg <benjamin.berg@intel.com> |
tools/nolibc: add option to disable runtime
In principle, it is possible to use nolibc for only some object files in a program. In that case, the startup code in _start and _start_c is not going to
tools/nolibc: add option to disable runtime
In principle, it is possible to use nolibc for only some object files in a program. In that case, the startup code in _start and _start_c is not going to be used. Add the NOLIBC_NO_RUNTIME compile time option to disable it entirely and also remove anything that depends on it.
Doing this avoids warnings from modpost for UML as the _start_c code references the main function from the .init.text section while it is not inside .init itself.
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
show more ...
|
| 2cb6cc83 | 24-Sep-2025 |
Benjamin Berg <benjamin.berg@intel.com> |
tools/nolibc: use __fallthrough__ rather than fallthrough
Use the version of the attribute with underscores to avoid issues if fallthrough has been defined by another header file already.
Signed-of
tools/nolibc: use __fallthrough__ rather than fallthrough
Use the version of the attribute with underscores to avoid issues if fallthrough has been defined by another header file already.
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
show more ...
|
| fbd1b7f6 | 24-Sep-2025 |
Benjamin Berg <benjamin.berg@intel.com> |
tools/nolibc: implement %m if errno is not defined
For improved compatibility, print %m as "unknown error" when nolibc is compiled using NOLIBC_IGNORE_ERRNO.
Signed-off-by: Benjamin Berg <benjamin.
tools/nolibc: implement %m if errno is not defined
For improved compatibility, print %m as "unknown error" when nolibc is compiled using NOLIBC_IGNORE_ERRNO.
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
show more ...
|
| 4ada5679 | 24-Sep-2025 |
Benjamin Berg <benjamin.berg@intel.com> |
tools/nolibc/dirent: avoid errno in readdir_r
Using errno is not possible when NOLIBC_IGNORE_ERRNO is set. Use sys_lseek instead of lseek as that avoids using errno.
Fixes: 665fa8dea90d ("tools/nol
tools/nolibc/dirent: avoid errno in readdir_r
Using errno is not possible when NOLIBC_IGNORE_ERRNO is set. Use sys_lseek instead of lseek as that avoids using errno.
Fixes: 665fa8dea90d ("tools/nolibc: add support for directory access") Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
show more ...
|
| c485ca3a | 24-Sep-2025 |
Benjamin Berg <benjamin.berg@intel.com> |
tools/nolibc/stdio: let perror work when NOLIBC_IGNORE_ERRNO is set
There is no errno variable when NOLIBC_IGNORE_ERRNO is defined. As such, simply print the message with "unknown error" rather than
tools/nolibc/stdio: let perror work when NOLIBC_IGNORE_ERRNO is set
There is no errno variable when NOLIBC_IGNORE_ERRNO is defined. As such, simply print the message with "unknown error" rather than the integer value of errno.
Fixes: acab7bcdb1bc ("tools/nolibc/stdio: add perror() to report the errno value") Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
show more ...
|
| 089c0a98 | 28-Oct-2025 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: remove outdated comment about __sysret() in mmap()
Since commit fb01ff635efd ("tools/nolibc: keep brk(), sbrk(), mmap() away from __sysret()") the implementation of mmap() does not use
tools/nolibc: remove outdated comment about __sysret() in mmap()
Since commit fb01ff635efd ("tools/nolibc: keep brk(), sbrk(), mmap() away from __sysret()") the implementation of mmap() does not use the __sysret() macro anymore.
Remove the outdated comment.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
show more ...
|
| 2602949b | 27-Oct-2025 |
Willy Tarreau <w@1wt.eu> |
tools/nolibc: x86: fix section mismatch caused by asm "mem*" functions
I recently got occasional build failures at -Os or -Oz that would always involve waitpid(), where the assembler would complain
tools/nolibc: x86: fix section mismatch caused by asm "mem*" functions
I recently got occasional build failures at -Os or -Oz that would always involve waitpid(), where the assembler would complain about this:
init.s: Error: .size expression for waitpid.constprop.0 does not evaluate to a constant
And without -fno-asynchronous-unwind-tables it could also spit such errors:
init.s:836: Error: CFI instruction used without previous .cfi_startproc init.s:838: Error: .cfi_endproc without corresponding .cfi_startproc init.s: Error: open CFI at the end of file; missing .cfi_endproc directive
A trimmed down reproducer is as simple as this:
int main(int argc, char **argv) { int ret, status;
if (argc == 0) ret = waitpid(-1, &status, 0); else ret = waitpid(-1, &status, 0);
return status; }
It produces the following asm code on x86_64:
.text .section .text.nolibc_memmove_memcpy .weak memmove .weak memcpy memmove: memcpy: movq %rdx, %rcx (...) retq .section .text.nolibc_memset .weak memset memset: xchgl %eax, %esi movq %rdx, %rcx pushq %rdi rep stosb popq %rax retq
.type waitpid.constprop.0.isra.0, @function waitpid.constprop.0.isra.0: subq $8, %rsp (...) jmp *.L5(,%rax,8) .section .rodata .align 8 .align 4 .L5: .quad .L10 (...) .quad .L4 .text .L10: (...) .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE273: .size waitpid.constprop.0.isra.0, .-waitpid.constprop.0.isra.0
It's a bit dense, but here's the explanation: the compiler has emitted a ".text" statement because it knows it's working in the .text section.
Then, our hand-written asm code for the mem* functions forced the section to .text.something without the compiler knowing about it, so it thinks the code is still being emitted for .text. As such, without any .section statement, the waitpid.constprop.0.isra.0 label is in fact placed in the previously created section, here .text.nolibc_memset.
The waitpid() function involves a switch/case statement that can be turned to a jump table, which is what the compiler does with the .rodata section, and after that it restores .text, which is no longer the previous .text.nolibc_memset section. Then the CFI statements cross a section, so does the .size calculation, which explains the error.
While a first approach consisting in placing an explicit ".text" at the end of these functions was verified to work, it's still unreliable as it depends on what the compiler remembers having emitted previously. A better approach is to replace the ".section" with ".pushsection", and place a ".popsection" at the end, so that these code blocks are agnostic to where they're placed relative to other blocks.
Fixes: 553845eebd60 ("tools/nolibc: x86-64: Use `rep movsb` for `memcpy()` and `memmove()`") Fixes: 12108aa8c1a1 ("tools/nolibc: x86-64: Use `rep stosb` for `memset()`") Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
show more ...
|