| 00e03fea | 06-Mar-2025 |
Louis Taylor <[email protected]> |
tools/nolibc: drop outdated example from overview comment
This behaviour was changed in commit a7604ba149e7 ("tools/nolibc/sys: make open() take a vararg on the 3rd argument").
Signed-off-by: Louis
tools/nolibc: drop outdated example from overview comment
This behaviour was changed in commit a7604ba149e7 ("tools/nolibc/sys: make open() take a vararg on the 3rd argument").
Signed-off-by: Louis Taylor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| 90e1f9f7 | 06-Mar-2025 |
Louis Taylor <[email protected]> |
tools/nolibc: process open() vararg as mode_t
openat() uses mode_t for this, so also update open() to be consistent.
Signed-off-by: Louis Taylor <[email protected]> Link: https://lore.kernel.org/r/2
tools/nolibc: process open() vararg as mode_t
openat() uses mode_t for this, so also update open() to be consistent.
Signed-off-by: Louis Taylor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| fbd4f52f | 06-Mar-2025 |
Louis Taylor <[email protected]> |
tools/nolibc: always use openat(2) instead of open(2)
All architectures support openat, so we don't need to make its use conditional.
Signed-off-by: Louis Taylor <[email protected]> Link: https://lo
tools/nolibc: always use openat(2) instead of open(2)
All architectures support openat, so we don't need to make its use conditional.
Signed-off-by: Louis Taylor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| 22edf1f8 | 09-Feb-2025 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: add support for [v]sscanf()
These functions are used often, also in selftests. sscanf() itself is also used by kselftest.h itself.
The implementation is limited and only supports nume
tools/nolibc: add support for [v]sscanf()
These functions are used often, also in selftests. sscanf() itself is also used by kselftest.h itself.
The implementation is limited and only supports numeric arguments.
Acked-by: Willy Tarreau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| 665fa8de | 09-Feb-2025 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: add support for directory access
Add an implementation for directory access operations. To keep nolibc itself allocation-free, a "DIR *" does not point to any data, but directly encode
tools/nolibc: add support for directory access
Add an implementation for directory access operations. To keep nolibc itself allocation-free, a "DIR *" does not point to any data, but directly encodes a filedescriptor number, equivalent to "FILE *". Without any per-directory storage it is not possible to implement readdir() POSIX confirming. Instead only readdir_r() is provided. While readdir_r() is deprecated in glibc, the reasons for that are not applicable to nolibc.
Signed-off-by: Thomas Weißschuh <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| dde5625d | 09-Feb-2025 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: add support for sys_llseek()
Not all architectures have the old sys_lseek(), notably riscv32. Implement lseek() in terms of sys_llseek() in that case.
Signed-off-by: Thomas Weißschuh
tools/nolibc: add support for sys_llseek()
Not all architectures have the old sys_lseek(), notably riscv32. Implement lseek() in terms of sys_llseek() in that case.
Signed-off-by: Thomas Weißschuh <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| cfb1bfe9 | 28-Jan-2025 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: make signature of ioctl() more flexible
POSIX defines the signature of ioctl() as follows, to allow passing a pointer or integer without casting: int ioctl(int fildes, int request, ..
tools/nolibc: make signature of ioctl() more flexible
POSIX defines the signature of ioctl() as follows, to allow passing a pointer or integer without casting: int ioctl(int fildes, int request, ... /* arg */);
Nolibc ioctl() expects a pointer, forcing the user to manually cast. Using va_arg to make the signature more flexible would work but seems to prevent inlining of the function. Instead use a macro. "fd" and "req" will still be typechecked through sys_ioctl().
Acked-by: Willy Tarreau <[email protected]> Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| 079ec6a3 | 30-Sep-2024 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: compiler: add macro __nolibc_fallthrough
Recent version of GCC and clang gained -Wimplicit-fallthrough, warning about implicit fall-through between switch labels. As nolibc does not co
tools/nolibc: compiler: add macro __nolibc_fallthrough
Recent version of GCC and clang gained -Wimplicit-fallthrough, warning about implicit fall-through between switch labels. As nolibc does not control the compilation flags, this can trigger warnings for when built by the user. Make use of the "fallthrough" attribute to explicitly annotate the expected fall-throughs and silence the warning.
Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| 25fb329a | 12-Aug-2024 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: x86_64: use local label in memcpy/memmove
Compiling arch-x86_64.h with clang and binutils LD yields duplicate label errors:
.../gcc-13.2.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: err
tools/nolibc: x86_64: use local label in memcpy/memmove
Compiling arch-x86_64.h with clang and binutils LD yields duplicate label errors:
.../gcc-13.2.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: error: LLVM gold plugin: <inline asm>:44:1: symbol '.Lbackward_copy' is already defined .Lbackward_copy:leaq -1(%rdi, %rcx, 1), %rdi
Instead of a local symbol use a local label which can be defined multiple times and therefore avoids the error.
Reviewed-by: Ammar Faizi <[email protected]> Acked-by: Willy Tarreau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| ff7b9abb | 12-Aug-2024 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: stackprotector: mark implicitly used symbols as used
During LTO the references from the compiler-generated prologue and epilogues to the stack protector symbols are not visible and the
tools/nolibc: stackprotector: mark implicitly used symbols as used
During LTO the references from the compiler-generated prologue and epilogues to the stack protector symbols are not visible and the symbols are removed. This will then lead to errors during linking. As those symbols are already #ifdeffed-out if unused mark them as "used" to prevent their removal.
Acked-by: Willy Tarreau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| e098eebb | 07-Aug-2024 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: compiler: use attribute((naked)) if available
The current entrypoint attributes optimize("Os", "omit-frame-pointer") are intended to avoid all compiler generated code, like function po
tools/nolibc: compiler: use attribute((naked)) if available
The current entrypoint attributes optimize("Os", "omit-frame-pointer") are intended to avoid all compiler generated code, like function porologue and epilogue. This is the exact usecase implemented by the attribute "naked".
Unfortunately this is not implemented by GCC for all targets, so only use it where available. This also provides compatibility with clang, which recognizes the "naked" attribute but not the previously used attribute "optimized".
Acked-by: Willy Tarreau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| ef32e9b6 | 07-Aug-2024 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: move entrypoint specifics to compiler.h
The specific attributes for the _start entrypoint are duplicated for each architecture. Deduplicate it into a dedicated #define into compiler.h.
tools/nolibc: move entrypoint specifics to compiler.h
The specific attributes for the _start entrypoint are duplicated for each architecture. Deduplicate it into a dedicated #define into compiler.h.
For clang compatibility, the epilogue will also need to be adapted, so move that one, too.
Acked-by: Willy Tarreau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| 02a62b55 | 07-Aug-2024 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: compiler: introduce __nolibc_has_attribute()
Recent compilers support __has_attribute() to check if a certain compiler attribute is supported. Unfortunately we have to first check if _
tools/nolibc: compiler: introduce __nolibc_has_attribute()
Recent compilers support __has_attribute() to check if a certain compiler attribute is supported. Unfortunately we have to first check if __has_attribute is supported in the first place and then if a specific attribute is present. These two checks can't be folded into a single condition as that would lead to errors.
Nesting the two conditions like below works, but becomes ugly as soon as #else blocks are used as those need to be duplicated for both levels of #if.
#if defined __has_attribute # if __has_attribute (nonnull) # define ATTR_NONNULL __attribute__ ((nonnull)) # endif #endif
Introduce a new helper which makes the usage of __has_attribute() nicer and migrate the current user to it.
Acked-by: Willy Tarreau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| 1daea158 | 07-Aug-2024 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: powerpc: limit stack-protector workaround to GCC
As mentioned in the comment, the workaround for __attribute__((no_stack_protector)) is only necessary on GCC. Avoid applying the workar
tools/nolibc: powerpc: limit stack-protector workaround to GCC
As mentioned in the comment, the workaround for __attribute__((no_stack_protector)) is only necessary on GCC. Avoid applying the workaround on clang, as clang does not recognize __attribute__((__optimize__)) and would fail.
Acked-by: Willy Tarreau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| 0daf8c86 | 07-Aug-2024 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: mips: load current function to $t9
The MIPS calling convention requires the address of the current function to be available in $t9. This was not done so far.
For GCC this seems to hav
tools/nolibc: mips: load current function to $t9
The MIPS calling convention requires the address of the current function to be available in $t9. This was not done so far.
For GCC this seems to have worked, but when compiled with clang the executable segfault instantly. Properly load the address of _start_c() into $t9 before calling it.
Acked-by: Willy Tarreau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
| 754283ce | 28-Jul-2024 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: pass argc, argv and envp to constructors
Since 2005 glibc has passed argc, argv, and envp to all constructors. As it is cheap and easy to do so, mirror that behaviour in nolibc. This m
tools/nolibc: pass argc, argv and envp to constructors
Since 2005 glibc has passed argc, argv, and envp to all constructors. As it is cheap and easy to do so, mirror that behaviour in nolibc. This makes it easier to migrate applications to nolibc.
Link: https://lore.kernel.org/r/20240728-nolibc-constructor-args-v1-1-36d0bf5cd4c0@weissschuh.net Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|