|
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14, v6.14-rc7, v6.14-rc6, v6.14-rc5, v6.14-rc4, v6.14-rc3, v6.14-rc2 |
|
| #
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 ...
|
|
Revision tags: v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4, v6.13-rc3, v6.13-rc2, v6.13-rc1, v6.12, v6.12-rc7, v6.12-rc6, v6.12-rc5, v6.12-rc4, v6.12-rc3, v6.12-rc2 |
|
| #
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 ...
|
|
Revision tags: v6.12-rc1, v6.11, v6.11-rc7, v6.11-rc6, v6.11-rc5, v6.11-rc4, v6.11-rc3, v6.11-rc2, v6.11-rc1, v6.10, v6.10-rc7, v6.10-rc6, v6.10-rc5, v6.10-rc4, v6.10-rc3, v6.10-rc2, v6.10-rc1, v6.9, v6.9-rc7, v6.9-rc6 |
|
| #
d20d0b10 |
| 26-Apr-2024 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: implement strerror()
strerror() is commonly used. For example in kselftest which currently needs to do an #ifdef NOLIBC to handle the lack of strerror().
Keep it simple and reuse the
tools/nolibc: implement strerror()
strerror() is commonly used. For example in kselftest which currently needs to do an #ifdef NOLIBC to handle the lack of strerror().
Keep it simple and reuse the output format of perror() for strerror().
Acked-by: Shuah Khan <[email protected]> Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
|
Revision tags: v6.9-rc5, v6.9-rc4, v6.9-rc3, v6.9-rc2, v6.9-rc1, v6.8, v6.8-rc7, v6.8-rc6, v6.8-rc5, v6.8-rc4, v6.8-rc3, v6.8-rc2, v6.8-rc1, v6.7, v6.7-rc8, v6.7-rc7, v6.7-rc6, v6.7-rc5, v6.7-rc4, v6.7-rc3 |
|
| #
dece8476 |
| 23-Nov-2023 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: annotate va_list printf formats
__attribute__(format(printf)) can also be used for functions that take a va_list argument.
As per the GCC docs:
For functions where the arguments
tools/nolibc: annotate va_list printf formats
__attribute__(format(printf)) can also be used for functions that take a va_list argument.
As per the GCC docs:
For functions where the arguments are not available to be checked (such as vprintf), specify the third parameter as zero.
Link: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html Signed-off-by: Thomas Weißschuh <[email protected]>
show more ...
|
|
Revision tags: v6.7-rc2, v6.7-rc1, v6.6, v6.6-rc7, v6.6-rc6, v6.6-rc5, v6.6-rc4, v6.6-rc3, v6.6-rc2, v6.6-rc1 |
|
| #
b56a9492 |
| 30-Aug-2023 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: add stdarg.h header
This allows nolic to work with `-nostdinc` avoiding any reliance on system headers.
The implementation has been lifted from musl libc 1.2.4. There is already an im
tools/nolibc: add stdarg.h header
This allows nolic to work with `-nostdinc` avoiding any reliance on system headers.
The implementation has been lifted from musl libc 1.2.4. There is already an implementation of stdarg.h in include/linux/stdarg.h but that is GPL licensed and therefore not suitable for nolibc.
The used compiler builtins have been validated to be at least available since GCC 4.1.2 and clang 3.0.0.
Signed-off-by: Thomas Weißschuh <[email protected]> Signed-off-by: Willy Tarreau <[email protected]>
show more ...
|
|
Revision tags: v6.5, v6.5-rc7, v6.5-rc6, v6.5-rc5 |
|
| #
809145f8 |
| 03-Aug-2023 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: setvbuf: avoid unused parameter warnings
This warning will be enabled later so avoid triggering it.
Signed-off-by: Thomas Weißschuh <[email protected]> Signed-off-by: Willy Tarreau
tools/nolibc: setvbuf: avoid unused parameter warnings
This warning will be enabled later so avoid triggering it.
Signed-off-by: Thomas Weißschuh <[email protected]> Signed-off-by: Willy Tarreau <[email protected]>
show more ...
|
|
Revision tags: v6.5-rc4 |
|
| #
4893c22e |
| 26-Jul-2023 |
Ryan Roberts <[email protected]> |
tools/nolibc/stdio: add setvbuf() to set buffering mode
Add a minimal implementation of setvbuf(), which error checks the mode argument (as required by spec) and returns. Since nolibc never buffers
tools/nolibc/stdio: add setvbuf() to set buffering mode
Add a minimal implementation of setvbuf(), which error checks the mode argument (as required by spec) and returns. Since nolibc never buffers output, nothing needs to be done.
The kselftest framework recently added a call to setvbuf(). As a result, any tests that use the kselftest framework and nolibc cause a compiler error due to missing function. This provides an urgent fix for the problem which is preventing arm64 testing on linux-next.
Example:
clang --target=aarch64-linux-gnu -fintegrated-as -Werror=unknown-warning-option -Werror=ignored-optimization-argument -Werror=option-ignored -Werror=unused-command-line-argument --target=aarch64-linux-gnu -fintegrated-as -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib \ -include ../../../../include/nolibc/nolibc.h -I../..\ -static -ffreestanding -Wall za-fork.c build/kselftest/arm64/fp/za-fork-asm.o -o build/kselftest/arm64/fp/za-fork In file included from <built-in>:1: In file included from ./../../../../include/nolibc/nolibc.h:97: In file included from ./../../../../include/nolibc/arch.h:25: ./../../../../include/nolibc/arch-aarch64.h:178:35: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes] void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) __no_stack_protector _start(void) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from za-fork.c:12: ../../kselftest.h:123:2: error: call to undeclared function 'setvbuf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] setvbuf(stdout, NULL, _IOLBF, 0); ^ ../../kselftest.h:123:24: error: use of undeclared identifier '_IOLBF' setvbuf(stdout, NULL, _IOLBF, 0); ^ 1 warning and 2 errors generated.
Signed-off-by: Ryan Roberts <[email protected]> Reported-by: Linux Kernel Functional Testing <[email protected]> Link: https://lore.kernel.org/linux-kselftest/CA+G9fYus3Z8r2cg3zLv8uH8MRrzLFVWdnor02SNr=rCz+_WGVg@mail.gmail.com/ Reviewed-by: Mark Brown <[email protected]> Signed-off-by: Willy Tarreau <[email protected]>
show more ...
|
| #
58e2847a |
| 24-Jul-2023 |
Ryan Roberts <[email protected]> |
selftests: line buffer test program's stdout
Patch series "selftests/mm fixes for arm64", v3.
Given my on-going work on large anon folios and contpte mappings, I decided it would be a good idea to
selftests: line buffer test program's stdout
Patch series "selftests/mm fixes for arm64", v3.
Given my on-going work on large anon folios and contpte mappings, I decided it would be a good idea to start running mm selftests to help guard against regressions. However, it soon became clear that I couldn't get the suite to run cleanly on arm64 with a vanilla v6.5-rc1 kernel (perhaps I'm just doing it wrong??), so got stuck in a rabbit hole trying to debug and fix all the issues. Some were down to misconfigurations, but I also found a number of issues with the tests and even a couple of issues with the kernel.
This patch (of 8):
The selftests runner pipes the test program's stdout to tap_prefix. The presence of the pipe means that the test program sets its stdout to be fully buffered (as aposed to line buffered when directly connected to the terminal). The block buffering means that there is often content in the buffer at fork() time, which causes the output to end up duplicated. This was causing problems for mm:cow where test results were duplicated 20-30x.
Solve this by using `stdbuf`, when available to force the test program to use line buffered mode. This means previously printf'ed results are flushed out of the program before any fork().
Additionally, explicitly set line buffer mode in ksft_print_header(), which means that all test programs that use the ksft framework will benefit even if stdbuf is not present on the system.
[[email protected]: add setvbuf() to set buffering mode] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ryan Roberts <[email protected]> Reviewed-by: Mark Brown <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Florent Revest <[email protected]> Cc: Jérôme Glisse <[email protected]> Cc: John Hubbard <[email protected]> Cc: Peter Xu <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
|
Revision tags: v6.5-rc3, v6.5-rc2, v6.5-rc1, v6.4, v6.4-rc7, v6.4-rc6, v6.4-rc5, v6.4-rc4, v6.4-rc3, v6.4-rc2, v6.4-rc1, v6.3, v6.3-rc7, v6.3-rc6, v6.3-rc5 |
|
| #
5df28c15 |
| 02-Apr-2023 |
Thomas Weißschuh <[email protected]> |
tools/nolibc: implement fd-based FILE streams
This enables the usage of the stream APIs with arbitrary filedescriptors.
It will be used by a future testcase.
Signed-off-by: Thomas Weißschuh <linux
tools/nolibc: implement fd-based FILE streams
This enables the usage of the stream APIs with arbitrary filedescriptors.
It will be used by a future testcase.
Signed-off-by: Thomas Weißschuh <[email protected]> Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
show more ...
|
| #
322759f9 |
| 06-Apr-2023 |
Mark Brown <[email protected]> |
tools/nolibc/stdio: Implement vprintf()
vprintf() is equivalent to vfprintf() to stdout so implement it as a simple wrapper for the existing vfprintf(), allowing us to build kselftest.h.
Suggested-
tools/nolibc/stdio: Implement vprintf()
vprintf() is equivalent to vfprintf() to stdout so implement it as a simple wrapper for the existing vfprintf(), allowing us to build kselftest.h.
Suggested-by: Willy Tarreau <[email protected]> Signed-off-by: Mark Brown <[email protected]> Acked-by: Willy Tarreau <[email protected]> Acked-by: Paul E. McKenney <[email protected]> Acked-by: Shuah Khan <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
|
Revision tags: v6.3-rc4, v6.3-rc3, v6.3-rc2, v6.3-rc1, v6.2, v6.2-rc8, v6.2-rc7, v6.2-rc6, v6.2-rc5, v6.2-rc4 |
|
| #
55abdd1f |
| 09-Jan-2023 |
Willy Tarreau <[email protected]> |
tools/nolibc: fix missing includes causing build issues at -O0
After the nolibc includes were split to facilitate portability from standard libcs, programs that include only what they need may miss
tools/nolibc: fix missing includes causing build issues at -O0
After the nolibc includes were split to facilitate portability from standard libcs, programs that include only what they need may miss some symbols which are needed by libgcc. This is the case for raise() which is needed by the divide by zero code in some architectures for example.
Regardless, being able to include only the apparently needed files is convenient.
Instead of trying to move all exported definitions to a single file, since this can change over time, this patch takes another approach consisting in including the nolibc header at the end of all standard include files. This way their types and functions are already known at the moment of inclusion, and including any single one of them is sufficient to bring all the required ones.
Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
show more ...
|
|
Revision tags: v6.2-rc3, v6.2-rc2, v6.2-rc1, v6.1, v6.1-rc8, v6.1-rc7, v6.1-rc6, v6.1-rc5, v6.1-rc4, v6.1-rc3, v6.1-rc2, v6.1-rc1, v6.0, v6.0-rc7, v6.0-rc6, v6.0-rc5, v6.0-rc4, v6.0-rc3, v6.0-rc2, v6.0-rc1, v5.19, v5.19-rc8, v5.19-rc7, v5.19-rc6, v5.19-rc5, v5.19-rc4, v5.19-rc3, v5.19-rc2, v5.19-rc1, v5.18 |
|
| #
4f2c9703 |
| 19-May-2022 |
Alviro Iskandar Setiawan <[email protected]> |
tools/nolibc/stdio: Add format attribute to enable printf warnings
When we use printf and fprintf functions from the nolibc, we don't get any warning from the compiler if we have the wrong arguments
tools/nolibc/stdio: Add format attribute to enable printf warnings
When we use printf and fprintf functions from the nolibc, we don't get any warning from the compiler if we have the wrong arguments. For example, the following calls will compile silently: ``` printf("%s %s\n", "aaa"); fprintf(stdout, "%s %s\n", "xxx", 1); ``` (Note the wrong arguments).
Those calls are undefined behavior. The compiler can help us warn about the above mistakes by adding a `printf` format attribute to those functions declaration. This patch adds it, and now it yields these warnings for those mistakes: ``` warning: format `%s` expects a matching `char *` argument [-Wformat=] warning: format `%s` expects argument of type `char *`, but argument 4 has type `int` [-Wformat=] ```
[ ammarfaizi2: Simplify the attribute placement. ]
Signed-off-by: Alviro Iskandar Setiawan <[email protected]> Signed-off-by: Ammar Faizi <[email protected]> Acked-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
show more ...
|
|
Revision tags: v5.18-rc7, v5.18-rc6, v5.18-rc5, v5.18-rc4, v5.18-rc3, v5.18-rc2, v5.18-rc1 |
|
| #
bd845a19 |
| 21-Mar-2022 |
Willy Tarreau <[email protected]> |
tools/nolibc/stdio: add support for '%p' to vfprintf()
%p remains quite useful in test code, and the code path can easily be merged with the existing "%x" thus only adds ~50 bytes, thus let's add it
tools/nolibc/stdio: add support for '%p' to vfprintf()
%p remains quite useful in test code, and the code path can easily be merged with the existing "%x" thus only adds ~50 bytes, thus let's add it.
Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
show more ...
|
| #
170b230d |
| 21-Mar-2022 |
Willy Tarreau <[email protected]> |
tools/nolibc/stdio: make printf(%s) accept NULL
It's often convenient to support this, especially in test programs where a NULL may correspond to an allocation error or a non-existing value. Let's m
tools/nolibc/stdio: make printf(%s) accept NULL
It's often convenient to support this, especially in test programs where a NULL may correspond to an allocation error or a non-existing value. Let's make printf("%s") support being passed a NULL. In this case it prints "(null)" like glibc's printf().
Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
show more ...
|
|
Revision tags: v5.17, v5.17-rc8, v5.17-rc7, v5.17-rc6, v5.17-rc5, v5.17-rc4 |
|
| #
45a794bf |
| 07-Feb-2022 |
Willy Tarreau <[email protected]> |
tools/nolibc/errno: extract errno.h from sys.h
This allows us to provide a minimal errno.h to ease porting applications that use it.
Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. M
tools/nolibc/errno: extract errno.h from sys.h
This allows us to provide a minimal errno.h to ease porting applications that use it.
Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
show more ...
|
| #
acab7bcd |
| 07-Feb-2022 |
Willy Tarreau <[email protected]> |
tools/nolibc/stdio: add perror() to report the errno value
It doesn't contain the text for the error codes, but instead displays "errno=" followed by the errno value. Just like the regular errno, if
tools/nolibc/stdio: add perror() to report the errno value
It doesn't contain the text for the error codes, but instead displays "errno=" followed by the errno value. Just like the regular errno, if a non-empty message is passed, it's placed followed with ": " on the output before the errno code. The message is emitted on stderr.
Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
show more ...
|
| #
7e4346f4 |
| 07-Feb-2022 |
Willy Tarreau <[email protected]> |
tools/nolibc/stdio: add a minimal [vf]printf() implementation
This adds a minimal vfprintf() implementation as well as the commonly used fprintf() and printf() that rely on it.
For now the function
tools/nolibc/stdio: add a minimal [vf]printf() implementation
This adds a minimal vfprintf() implementation as well as the commonly used fprintf() and printf() that rely on it.
For now the function supports: - formats: %s, %c, %u, %d, %x - modifiers: %l and %ll - unknown chars are considered as modifiers and are ignored
It is designed to remain minimalist, despite this printf() is 549 bytes on x86_64. It would be wise not to add too many formats.
Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
show more ...
|
| #
e3e19052 |
| 07-Feb-2022 |
Willy Tarreau <[email protected]> |
tools/nolibc/stdio: add fwrite() to stdio
We'll use it to write substrings. It relies on a simpler _fwrite() that only takes one size. fputs() was also modified to rely on it.
Signed-off-by: Willy
tools/nolibc/stdio: add fwrite() to stdio
We'll use it to write substrings. It relies on a simpler _fwrite() that only takes one size. fputs() was also modified to rely on it.
Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
show more ...
|
| #
99b037cb |
| 07-Feb-2022 |
Willy Tarreau <[email protected]> |
tools/nolibc/stdio: add stdin/stdout/stderr and fget*/fput* functions
The standard puts() function always emits the trailing LF which makes it unconvenient for small string concatenation. fputs() ou
tools/nolibc/stdio: add stdin/stdout/stderr and fget*/fput* functions
The standard puts() function always emits the trailing LF which makes it unconvenient for small string concatenation. fputs() ought to be used instead but it requires a FILE*.
This adds 3 dummy FILE* values (stdin, stdout, stderr) which are in fact pointers to struct FILE of one byte. We reserve 3 pointer values for them, -3, -2 and -1, so that they are ordered, easing the tests and mapping to integer.
>From this, fgetc(), fputc(), fgets() and fputs() were implemented, and the previous putchar() and getchar() now remap to these. The standard getc() and putc() macros were also implemented as pointing to these ones.
There is absolutely no buffering, fgetc() and fgets() read one byte at a time, fputc() writes one byte at a time, and only fputs() which knows the string's length writes all of it at once.
Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
show more ...
|
| #
4e383a66 |
| 07-Feb-2022 |
Willy Tarreau <[email protected]> |
tools/nolibc/stdio: add a minimal set of stdio functions
This only provides getchar(), putchar(), and puts().
Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <paulmck@kernel
tools/nolibc/stdio: add a minimal set of stdio functions
This only provides getchar(), putchar(), and puts().
Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
show more ...
|