Re: [PATCH v3 4/4] tools/nolibc: add signal support

2025-08-02 Thread Thomas Weißschuh
Note: Please also Cc the patches to LKML in the future. On 2025-08-02 10:26:34+, Berg, Benjamin wrote: > On Fri, 2025-08-01 at 17:09 +0200, Thomas Weißschuh wrote: > > On 2025-07-31 22:12:25+0200, Benjamin Berg wrote: > > > From: Benjamin Berg > > > > > &g

Re: [PATCH v3 4/4] tools/nolibc: add signal support

2025-08-01 Thread Thomas Weißschuh
Hi Benjamin, On 2025-07-31 22:12:25+0200, Benjamin Berg wrote: > From: Benjamin Berg > > Add support for sigaction() using the rt_sigaction syscall and implement > the normal sa_mask helpers. > > For the uapi definitions, everything is copied into nolibc. This avoids > issues with kernel archit

Re: [PATCH v2 4/4] tools/nolibc: add signal support

2025-07-14 Thread Thomas Weißschuh
On 2025-07-14 14:52:23+0200, Benjamin Berg wrote: > On Sun, 2025-07-13 at 17:50 +0200, Willy Tarreau wrote: > > On Sun, Jul 13, 2025 at 05:02:27PM +0200, Thomas Weißschuh wrote: > > > On 2025-07-11 09:25:26+0200, Benjamin Berg wrote: > > > > On Fri, 2025-07-11 at

Re: [PATCH v2 4/4] tools/nolibc: add signal support

2025-07-13 Thread Thomas Weißschuh
On 2025-07-11 09:25:26+0200, Benjamin Berg wrote: > On Fri, 2025-07-11 at 07:40 +0200, Thomas Weißschuh wrote: > > On 2025-07-10 12:39:50+0200, Benjamin Berg wrote: > > > From: Benjamin Berg > > > > > > Add support for sigaction() and implement the normal s

Re: [PATCH v2 4/4] tools/nolibc: add signal support

2025-07-10 Thread Thomas Weißschuh
On 2025-07-10 12:39:50+0200, Benjamin Berg wrote: > From: Benjamin Berg > > Add support for sigaction() and implement the normal sa_mask helpers. > > On many architectures, linux/signal.h pulls in compatibility definitions > for the old sigaction syscall instead of rt_sigaction. However, the > k

Re: [PATCH 2/3] tools/nolibc: add more generic BITSET_* macros for FD_*

2025-07-10 Thread Thomas Weißschuh
On 2025-07-09 20:44:43+0200, Willy Tarreau wrote: > Hi Thomas, > > On Wed, Jul 09, 2025 at 08:36:49PM +0200, Thomas Weißschuh wrote: > > > +#define FD_CLR(fd, set) BITSET_CLR(fd, (set)->fds) > > > +#define FD_SET(fd, set) BITSET_SET(fd, (set)->fds) > > >

Re: [PATCH v2 2/4] selftests/nolibc: validate order of constructor calls

2025-07-10 Thread Thomas Weißschuh
On 2025-07-10 12:39:48+0200, Benjamin Berg wrote: > From: Benjamin Berg > > Add new helpers to track multiple steps as bits in an integer. Store > each step in a bit and use the lowest bit to store whether all steps > occurred in the correct order and only once. > > Use this for the constructor

Re: [PATCH v2 1/4] selftests/nolibc: fix EXPECT_NZ macro

2025-07-10 Thread Thomas Weißschuh
On 2025-07-10 12:39:47+0200, Benjamin Berg wrote: > From: Benjamin Berg > > The expect non-zero macro was incorrect and never used. Fix its > definition. Missing sign-off. A Fixes would also be nice. (...)

Re: [PATCH 3/3] tools/nolibc: add signal support

2025-07-09 Thread Thomas Weißschuh
On 2025-07-09 17:55:12+0200, Benjamin Berg wrote: (...) > --- a/tools/testing/selftests/nolibc/nolibc-test.c > +++ b/tools/testing/selftests/nolibc/nolibc-test.c > @@ -1270,6 +1270,72 @@ int test_namespace(void) > return ret; > } > > +sig_atomic_t signal_check; static? > + > +static voi

Re: [PATCH 2/3] tools/nolibc: add more generic BITSET_* macros for FD_*

2025-07-09 Thread Thomas Weißschuh
On 2025-07-09 17:55:11+0200, Benjamin Berg wrote: > From: Benjamin Berg > > The FD_* macros are assuming a specific type for the bitset. Add new > macros that introspect the type of the passed variable in order to know > the size of the bitset. This way the same macros can be used for other > pur

Re: [PATCH 1/3] tools/nolibc: show failed run if test process crashes

2025-07-09 Thread Thomas Weißschuh
On 2025-07-09 17:55:10+0200, Benjamin Berg wrote: > From: Benjamin Berg > > The logic would not catch if the test process crashes and would > incorrectly report a "success" state. Fix this by looking for the final > "Total number of errors:" message and printing "failure" if it was not > seen. N

Re: [RFC v2] tools/nolibc: add sigaction()

2025-07-07 Thread Thomas Weißschuh
On 2025-07-04 15:33:09+0200, Willy Tarreau wrote: > On Fri, Jul 04, 2025 at 12:50:32PM +0200, Thomas Weißschuh wrote: > > On 2025-07-02 17:33:24+0200, Benjamin Berg wrote: > > > On Wed, 2025-07-02 at 00:04 +0200, Thomas Weißschuh wrote: > > > > [SNIP] > > > &

Re: [RFC v2] tools/nolibc: add sigaction()

2025-07-04 Thread Thomas Weißschuh
On 2025-07-02 17:33:24+0200, Benjamin Berg wrote: > On Wed, 2025-07-02 at 00:04 +0200, Thomas Weißschuh wrote: > > [SNIP] > > > --- a/tools/include/nolibc/arch-i386.h > > > +++ b/tools/include/nolibc/arch-i386.h > > > @@ -10,6 +10,19 @@ > > >

Re: [RFC v2] tools/nolibc: add sigaction()

2025-07-01 Thread Thomas Weißschuh
Hi Benjamin, Thanks for your patch! On 2025-07-01 14:29:10+0200, Benjamin Berg wrote: > From: Benjamin Berg Please send the next revisions to the nolibc maintainers from the MAINTAINERS file. Willy and my @weissschuh.net address. > In preparation to add tests that use it. Here "tests" is not

Re: [Patch v2 2/2] selftests: harness: Add kselftest harness selftest with variant

2025-06-19 Thread Thomas Weißschuh
On Fri, Jun 20, 2025 at 03:28:15AM +, Wei Yang wrote: > Each fixture could support variant. Add fixture with variant to verify > the behavior, so we can validate for further change. > > Signed-off-by: Wei Yang > Cc: Muhammad Usama Anjum Reviewed-by: Thomas Weißsch

Re: [PATCH 3/3] selftests: harness: Add kselftest harness selftest with variant

2025-06-17 Thread Thomas Weißschuh
On Tue, Jun 17, 2025 at 11:57:48PM +, Wei Yang wrote: > On Tue, Jun 17, 2025 at 09:35:12AM +0200, Thomas Weißschuh wrote: > >> +FIXTURE_SETUP(fixture_variant) { > >> + TH_LOG("setup %d", variant->value); > >> + self->testpid = g

Re: [PATCH 3/3] selftests: harness: Add kselftest harness selftest with variant

2025-06-17 Thread Thomas Weißschuh
Good idea. On Mon, Jun 16, 2025 at 12:23:38PM +, Wei Yang wrote: > Each fixture could support variant. Add fixture with variant to verify > the behavior, so we can validate for further change. > > Signed-off-by: Wei Yang > --- > .../kselftest_harness/harness-selftest.c | 34 +++

Re: [PATCH 1/3] selftests: correct one typo in comment

2025-06-17 Thread Thomas Weißschuh
f-by: Wei Yang With the above comments addressed: Reviewed-by: Thomas Weißschuh > --- > tools/testing/selftests/kselftest_harness.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/kselftest_harness.h > b/tools/testing/selftes

Re: nolibc test target overwites kernel config without asking

2025-06-10 Thread Thomas Weißschuh
On 2025-06-10 18:21:27+0100, Mark Brown wrote: > On Tue, Jun 10, 2025 at 07:05:59PM +0200, Thomas Weißschuh wrote: > > On 2025-06-09 17:42:47+0100, Mark Brown wrote: > > > > KUnit deals with this by doing it's kernel build in a .kunit directory, > > > it'd

Re: nolibc test target overwites kernel config without asking

2025-06-10 Thread Thomas Weißschuh
Hi Mark, On 2025-06-09 17:42:47+0100, Mark Brown wrote: > While running the nolibc tests I discovered that they build a kernel in > the current directory, including overwriting the existing .config. This > is rather suprising for the selftests build system - it usually wouldn't > do a kernel buil

[PATCH v3 2/2] kunit: qemu_configs: Add MIPS configurations

2025-04-15 Thread Thomas Weißschuh
Add basic support to run various MIPS variants via kunit_tool using the virtualized malta platform. Signed-off-by: Thomas Weißschuh --- tools/testing/kunit/qemu_configs/mips.py | 18 ++ tools/testing/kunit/qemu_configs/mips64.py | 19 +++ tools/testing

[PATCH 27/32] tools/nolibc: add snprintf() and friends

2025-03-03 Thread Thomas Weißschuh
Add more of the printf() functions. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/stdio.h | 55 1 file changed, 55 insertions(+) diff --git a/tools/include/nolibc/stdio.h b/tools/include/nolibc/stdio.h index

[PATCH v2 14/15] selftests/nolibc: use correct clang target for s390/powerz

2024-08-07 Thread Thomas Weißschuh
The target names between GCC and clang differ for s390. While GCC uses "s390", clang uses "powerz". This mapping is not handled by tools/scripts/Makefile.include, so do it in the nolibc-test Makefile. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Make

[PATCH v2 03/15] tools/nolibc: powerpc: limit stack-protector workaround to GCC

2024-08-07 Thread Thomas Weißschuh
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. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/arch-powerpc.h

[PATCH v2 11/15] selftests/nolibc: add cc-option compatible with clang cross builds

2024-08-07 Thread Thomas Weißschuh
The cc-option macro from Build.include is not compatible with clang cross builds, as it does not respect the "--target" and similar flags, set up by Mekfile.include. Provide a custom variant which works correctly. Signed-off-by: Thomas Weißschuh Reviewed-by: Shuah Khan --- too

[PATCH v2 10/15] selftests/nolibc: add support for LLVM= parameter

2024-08-07 Thread Thomas Weißschuh
set up. To avoid this incompatibility, switch the O= handling to custom logic. Signed-off-by: Thomas Weißschuh Reviewed-by: Shuah Khan --- tools/testing/selftests/nolibc/Makefile | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/nolibc

[PATCH v2 06/15] tools/nolibc: compiler: use attribute((naked)) if available

2024-08-07 Thread Thomas Weißschuh
C 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". Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/compiler.h | 9 +++-- 1 f

[PATCH v2 07/15] selftests/nolibc: report failure if no testcase passed

2024-08-07 Thread Thomas Weißschuh
When nolibc-test is so broken, it doesn't even start, don't report success. Signed-off-by: Thomas Weißschuh Reviewed-by: Shuah Khan --- tools/testing/selftests/nolibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefil

[PATCH v2 12/15] selftests/nolibc: run-tests.sh: avoid overwriting CFLAGS_EXTRA

2024-08-07 Thread Thomas Weißschuh
If the user specified their own CFLAGS_EXTRA these should not be overwritten by `-e`. Signed-off-by: Thomas Weißschuh Reviewed-by: Shuah Khan --- tools/testing/selftests/nolibc/run-tests.sh | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests

[PATCH v2 13/15] selftests/nolibc: don't use libgcc when building with clang

2024-08-07 Thread Thomas Weißschuh
The logic in clang to find the libgcc.a from a GCC toolchain for a specific ABI does not work reliably and can lead to errors. Instead disable libgcc when building with clang, as it's not needed anyways. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile

[PATCH v2 09/15] selftests/nolibc: determine $(srctree) first

2024-08-07 Thread Thomas Weißschuh
consistent, perform the setup $(srctree) as early as possible and use it for all inclusions. Signed-off-by: Thomas Weißschuh Reviewed-by: Shuah Khan --- tools/testing/selftests/nolibc/Makefile | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/testing/selfte

[PATCH v2 15/15] selftests/nolibc: run-tests.sh: allow building through LLVM

2024-08-07 Thread Thomas Weißschuh
The nolibc tests can now be properly built with LLVM. Expose this through run-tests.sh. Signed-off-by: Thomas Weißschuh Reviewed-by: Shuah Khan --- tools/testing/selftests/nolibc/run-tests.sh | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests

[PATCH v2 08/15] selftests/nolibc: avoid passing NULL to printf("%s")

2024-08-07 Thread Thomas Weißschuh
laceholder. Signed-off-by: Thomas Weißschuh Reviewed-by: Shuah Khan --- tools/testing/selftests/nolibc/nolibc-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 09

[PATCH v2 05/15] tools/nolibc: move entrypoint specifics to compiler.h

2024-08-07 Thread Thomas Weißschuh
. For clang compatibility, the epilogue will also need to be adapted, so move that one, too. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/arch-aarch64.h | 4 ++-- tools/include/nolibc/arch-arm.h | 4 ++-- tools/include/nolibc/arch-i386.h | 4 ++-- tools/include/nolibc/arch

[PATCH v2 02/15] tools/nolibc: mips: load current function to $t9

2024-08-07 Thread Thomas Weißschuh
-off-by: Thomas Weißschuh --- tools/include/nolibc/arch-mips.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/include/nolibc/arch-mips.h b/tools/include/nolibc/arch-mips.h index 62cc50ef3288..a2ee77ed2fbb 100644 --- a/tools/include/nolibc/arch-mips.h +++ b/tools

[PATCH v2 00/15] tools/nolibc: improve LLVM/clang support

2024-08-07 Thread Thomas Weißschuh
s.sh This series extends this support. Signed-off-by: Thomas Weißschuh --- Changes in v2: - Add support for all architectures - powerpc: "selftests/nolibc: don't use libgcc when building with clang" - mips: "tools/nolibc: mips: load current function to $t9" - s390: &

[PATCH v2 04/15] tools/nolibc: compiler: introduce __nolibc_has_attribute()

2024-08-07 Thread Thomas Weißschuh
nnull)) # endif #endif Introduce a new helper which makes the usage of __has_attribute() nicer and migrate the current user to it. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/compiler.h | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/in

[PATCH v2 01/15] tools/nolibc: arm: use clang-compatible asm syntax

2024-08-07 Thread Thomas Weißschuh
The clang assembler rejects the current syntax. Switch to a syntax accepted by both GCC and clang. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/arch-arm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/include/nolibc/arch-arm.h b/tools/include/nolibc

Re: [PATCH 09/12] selftests/nolibc: add support for LLVM= parameter

2024-08-04 Thread Thomas Weißschuh
On 2024-08-03 11:45:30+, Willy Tarreau wrote: > On Sun, Jul 28, 2024 at 12:10:03PM +0200, Thomas Weißschuh wrote: > > Makefile.include can modify CC and CFLAGS for usage with clang. > > Make use of it. > > > > Signed-off-by: Thomas Weißschuh > > --- &g

Re: [PATCH 07/12] selftests/nolibc: determine $(srctree) first

2024-08-04 Thread Thomas Weißschuh
On 2024-08-03 11:40:24+, Willy Tarreau wrote: > On Sun, Jul 28, 2024 at 12:10:01PM +0200, Thomas Weißschuh wrote: > > Avoid needing relative includes. > > I'm not opposed, but what's the benefit ? IMHO relative paths are > generally more flexible and robust. yo

Re: [PATCH 04/12] tools/nolibc: use attribute((naked)) if available

2024-08-03 Thread Thomas Weißschuh
Aug 3, 2024 20:33:11 Willy Tarreau : > On Sat, Aug 03, 2024 at 08:28:08PM +0200, Thomas Weißschuh  wrote: >>> I think that it can resolve to roughly this: >>> >>> #if defined(__has_attribute) && __has_attribute(naked) >>> #  define __

Re: [PATCH 06/12] selftests/nolibc: avoid passing NULL to printf("%s")

2024-08-03 Thread Thomas Weißschuh
Aug 3, 2024 11:34:03 Willy Tarreau : > On Sun, Jul 28, 2024 at 12:10:00PM +0200, Thomas Weißschuh wrote: >> Clang on higher optimization levels detects that NULL is passed to >> printf("%s") and warns about it. >> Avoid the warning. > > I don't see why

Re: [PATCH 04/12] tools/nolibc: use attribute((naked)) if available

2024-08-03 Thread Thomas Weißschuh
Aug 3, 2024 11:26:07 Willy Tarreau : > On Sun, Jul 28, 2024 at 12:09:58PM +0200, Thomas Weißschuh wrote: >> The current entrypoint attributes optimize("Os", "omit-frame-pointer") >> are intended to avoid all compiler generated code, like function >> por

Re: [PATCH 03/12] tools/nolibc: move entrypoint specifics to compiler.h

2024-08-03 Thread Thomas Weißschuh
Aug 3, 2024 11:22:23 Willy Tarreau : > Hi Thomas, > > On Sun, Jul 28, 2024 at 12:09:57PM +0200, Thomas Weißschuh wrote: >> The specific attributes for the _start entrypoint are duplicated for >> each architecture. >> Deduplicate it into a dedicated #define into compil

Re: [PATCH] tools/nolibc: pass argc, argv and envp to constructors

2024-08-03 Thread Thomas Weißschuh
Aug 3, 2024 12:03:27 Willy Tarreau : > On Sun, Jul 28, 2024 at 10:34:11PM +0200, Thomas Weißschuh wrote: >> Mirror glibc behavior for compatibility. > > Generally speaking I think you should make a bit longer sentences in > your commit messages, Thomas. One first reason is to

Re: [PATCH 1/2] tools/nolibc: add support for [v]sscanf()

2024-08-02 Thread Thomas Weißschuh
On 2024-07-31 17:01:09+, Shuah Khan wrote: > On 7/31/24 12:32, Thomas Weißschuh wrote: > > The implementation is limited and only supports numeric arguments. > > I would like to see more information in here. Why is this needed > etc. etc. Ack. > > > > S

[PATCH 1/2] tools/nolibc: add support for [v]sscanf()

2024-07-31 Thread Thomas Weißschuh
The implementation is limited and only supports numeric arguments. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/stdio.h | 93 tools/testing/selftests/nolibc/nolibc-test.c | 59 ++ 2 files changed, 152 insertions(+) diff

[PATCH 2/2] Revert "selftests: kselftest: Fix build failure with NOLIBC"

2024-07-31 Thread Thomas Weißschuh
This reverts commit 16767502aa990cca2cb7d1372b31d328c4c85b40. Nolibc gained support for uname(2) and sscanf(3) which are the dependencies of ksft_min_kernel_version(). So re-enable support for ksft_min_kernel_version() under nolibc. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests

[PATCH 0/2] tools/nolibc: add support for [v]sscanf()

2024-07-31 Thread Thomas Weißschuh
The implementation is limited and only supports numeric arguments. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (2): tools/nolibc: add support for [v]sscanf() Revert "selftests: kselftest: Fix build failure with NOLIBC" tools/include/nolibc/stdio.h

[PATCH] tools/nolibc: pass argc, argv and envp to constructors

2024-07-28 Thread Thomas Weißschuh
Mirror glibc behavior for compatibility. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/crt.h | 23 --- tools/testing/selftests/nolibc/nolibc-test.c | 5 +++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tools/include/nolibc

[PATCH 07/12] selftests/nolibc: determine $(srctree) first

2024-07-28 Thread Thomas Weißschuh
Avoid needing relative includes. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 46dfbb50fae5

[PATCH 09/12] selftests/nolibc: add support for LLVM= parameter

2024-07-28 Thread Thomas Weißschuh
Makefile.include can modify CC and CFLAGS for usage with clang. Make use of it. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile

[PATCH 12/12] selftests/nolibc: run-tests.sh: allow building through LLVM

2024-07-28 Thread Thomas Weißschuh
The nolibc tests can now be properly built with LLVM. Expose this through run-tests.sh. Not all architectures are compatible, add a list for those. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/run-tests.sh | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions

[PATCH 10/12] selftests/nolibc: add cc-option compatible with clang cross builds

2024-07-28 Thread Thomas Weißschuh
The cc-option macro from Build.include is not compatible with clang cross builds, as it does not respect the "--target" and similar flags, set up by Mekfile.include. Provide a custom variant which works correctly. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Ma

[PATCH 05/12] selftests/nolibc: report failure if no testcase passed

2024-07-28 Thread Thomas Weißschuh
When nolibc-test is so broken, it doesn't even start, don't report success. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selfte

[PATCH 11/12] selftests/nolibc: run-tests.sh: avoid overwriting CFLAGS_EXTRA

2024-07-28 Thread Thomas Weißschuh
If the user specified their own CFLAGS_EXTRA these should not be overwritten by `-e`. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/run-tests.sh | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools

[PATCH 06/12] selftests/nolibc: avoid passing NULL to printf("%s")

2024-07-28 Thread Thomas Weißschuh
Clang on higher optimization levels detects that NULL is passed to printf("%s") and warns about it. Avoid the warning. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing

[PATCH 08/12] selftests/nolibc: setup objtree without Makefile.include

2024-07-28 Thread Thomas Weißschuh
Makefile. As we want to use its llvm handling in the future, reimplement its objtree := $(O). While at it, also move "$(objtree) ?= $(srctree)" for consistency. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 de

[PATCH 01/12] tools/nolibc: use clang-compatible asm syntax in arch-arm.h

2024-07-28 Thread Thomas Weißschuh
The clang assembler rejects the current syntax. Switch to a syntax accepted by both GCC and clang. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/arch-arm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/include/nolibc/arch-arm.h b/tools/include/nolibc

[PATCH 00/12] tools/nolibc: improve LLVM/clang support

2024-07-28 Thread Thomas Weißschuh
s.sh This series extends this support. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (12): tools/nolibc: use clang-compatible asm syntax in arch-arm.h tools/nolibc: limit powerpc stack-protector workaround to GCC tools/nolibc: move entrypoint specifics to compiler.h to

[PATCH 04/12] tools/nolibc: use attribute((naked)) if available

2024-07-28 Thread Thomas Weißschuh
C 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". Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/compiler.h | 9 + 1

[PATCH 03/12] tools/nolibc: move entrypoint specifics to compiler.h

2024-07-28 Thread Thomas Weißschuh
, so move that one, too. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/arch-aarch64.h | 4 ++-- tools/include/nolibc/arch-arm.h | 4 ++-- tools/include/nolibc/arch-i386.h | 4 ++-- tools/include/nolibc/arch-loongarch.h | 4 ++-- tools/include/nolibc/arch-mips.h | 4

[PATCH 02/12] tools/nolibc: limit powerpc stack-protector workaround to GCC

2024-07-28 Thread Thomas Weißschuh
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. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/arch-powerpc.h

Re: [PATCH 3/3] selftests: kselftest: also use strerror() on nolibc

2024-05-27 Thread Thomas Weißschuh
Hi Shuah, Could you Ack the patch below to kselftest.h? Thanks, Thomas On 2024-04-26 13:08:58+, Thomas Weißschuh wrote: > nolibc gained an implementation of strerror() recently. > Use it and drop the ifdeffery. > > Signed-off-by: Thomas Weißschuh > --- > tools

Re: [PATCH v4 37/66] selftests/nolibc: Drop define _GNU_SOURCE

2024-05-09 Thread Thomas Weißschuh
Hi Edward, On 2024-05-10 00:06:54+, Edward Liaw wrote: > _GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent > redefinition warnings. The nolibc tests do not use lib.mk. This change breaks "make libc-test", please drop it. > Signed-off-by: Edward Liaw > --- > tools/testi

Re: [PATCH 0/3] tools/nolibc: implement strerror()

2024-05-02 Thread Thomas Weißschuh
Hi Shuah, On 2024-04-26 13:08:55+, Thomas Weißschuh wrote: > Adds a simple implementation of strerror() and makes use of it in > kselftests. > > Shuah, could you Ack patch 3? Friendly ping for an Ack of patch 3 of this series. After that I'd like to submit an updated nolib

[PATCH 2/3] tools/nolibc: implement strerror()

2024-04-26 Thread Thomas Weißschuh
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(). Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/stdio.h | 10

[PATCH 0/3] tools/nolibc: implement strerror()

2024-04-26 Thread Thomas Weißschuh
Adds a simple implementation of strerror() and makes use of it in kselftests. Shuah, could you Ack patch 3? Willy, this should work *without* your Ack. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (3): selftests/nolibc: introduce condition to run tests only on nolibc tools

[PATCH 1/3] selftests/nolibc: introduce condition to run tests only on nolibc

2024-04-26 Thread Thomas Weißschuh
Some tests only make sense on nolibc. To avoid gaps in the test numbers do to inline "#ifdef NOLIBC", add a condition to formally skip these tests. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 32 +--- 1 file changed, 19

[PATCH 3/3] selftests: kselftest: also use strerror() on nolibc

2024-04-26 Thread Thomas Weißschuh
nolibc gained an implementation of strerror() recently. Use it and drop the ifdeffery. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/kselftest.h | 8 1 file changed, 8 deletions(-) diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h

Re: [PATCH 0/2] tools/nolibc: implement strtol() and friends

2024-04-25 Thread Thomas Weißschuh
On 2024-04-25 18:30:39+, Willy Tarreau wrote: > Hi again Thomas, > > On Thu, Apr 25, 2024 at 06:09:25PM +0200, Thomas Weißschuh wrote: > > I wanted to implement sscanf() for ksft_min_kernel_version() and this is > > a prerequisite for it. > > > > It's

[PATCH 1/2] tools/nolibc: add limits for {u,}intmax_t, ulong and {u,}llong

2024-04-25 Thread Thomas Weißschuh
They are useful for users and necessary for strtol() and friends. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/stdint.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/tools/include/nolibc/stdint.h b/tools/include/nolibc/stdint.h index 6665e272e213

[PATCH 2/2] tools/nolibc: implement strtol() and friends

2024-04-25 Thread Thomas Weißschuh
The implementation always works on uintmax_t values. This is inefficient when only 32bit are needed. However for all functions this only happens for strtol() on 32bit platforms. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/stdlib.h| 109

[PATCH 0/2] tools/nolibc: implement strtol() and friends

2024-04-25 Thread Thomas Weißschuh
I wanted to implement sscanf() for ksft_min_kernel_version() and this is a prerequisite for it. It's also useful on its own so it gets its own submission. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (2): tools/nolibc: add limits for {u,}intmax_t, ulong and {u,}llong

[PATCH] selftests/nolibc: disable brk()/sbrk() tests on musl

2024-04-23 Thread Thomas Weißschuh
On musl calls to brk() and sbrk() always fail with ENOMEM. Detect this and skip the tests on musl. Tested on glibc 2.39 and musl 1.2.5 in addition to nolibc. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 10 +++--- 1 file changed, 7 insertions(+), 3

[PATCH] selftests/nolibc: run-tests.sh: use -Werror by default

2024-04-23 Thread Thomas Weißschuh
run-tests.sh hides the output from the compiler unless the compilation fails. To recognize newly introduced warnings use -Werror by default. Also add a switch to disable -Werror in case the warnings are expected. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile

Re: [PATCH] tools/nolibc: add support for uname(2)

2024-04-14 Thread Thomas Weißschuh
Hi Willy! On 2024-04-14 12:56:46+0200, Willy Tarreau wrote: > On Sun, Apr 14, 2024 at 09:56:23AM +0200, Thomas Weißschuh wrote: > > All supported kernels are assumed to use struct new_utsname. > > This is validated in test_uname(). > > > > uname(2)

[PATCH] tools/nolibc: add support for uname(2)

2024-04-14 Thread Thomas Weißschuh
All supported kernels are assumed to use struct new_utsname. This is validated in test_uname(). uname(2) can for example be used in ksft_min_kernel_version() from the kernels selftest framework. Link: https://lore.kernel.org/lkml/20240412123536.ga32...@redhat.com/ Signed-off-by: Thomas Weißschuh

Re: [PATCH 2/3] tools/nolibc: add support for getrlimit/setrlimit

2023-11-26 Thread Thomas Weißschuh
On 2023-11-26 10:28:28+0100, Willy Tarreau wrote: > Hi Thomas, > > > +int test_rlimit(void) > > +{ > > + struct rlimit rlim = { > > + .rlim_cur = 1 << 20, > > + .rlim_max = 1 << 20, > > + }; > > + int ret; > > + > > + ret = setrlimit(RLIMIT_CORE, &rlim); > > + if (ret

[PATCH 0/3] tools/nolibc: rlimit support

2023-11-22 Thread Thomas Weißschuh
The series adds support for setrlimit/getrlimit. Mainly to avoid spurious coredumps when running the tests under qemu-user. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (3): tools/nolibc: drop custom definition of struct rusage tools/nolibc: add support for getrlimit

[PATCH 1/3] tools/nolibc: drop custom definition of struct rusage

2023-11-22 Thread Thomas Weißschuh
A future commit will include linux/resource.h, which will conflict with the private definition of struct rusage in nolibc. Avoid the conflict by dropping the private definition and use the one from the UAPI headers. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/types.h | 21

[PATCH 2/3] tools/nolibc: add support for getrlimit/setrlimit

2023-11-22 Thread Thomas Weißschuh
The implementation uses the prlimit64 systemcall as that is available on all architectures. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/sys.h | 38 tools/testing/selftests/nolibc/nolibc-test.c | 29 + 2 files

[PATCH 3/3] selftests/nolibc: disable coredump via setrlimit

2023-11-22 Thread Thomas Weißschuh
. Link: https://lore.kernel.org/qemu-devel/20231115-qemu-user-dumpable-v1-2-edbe7f0fb...@t-8ch.de/ Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing

Re: [PATCH RFC 3/3] selftests/nolibc: migrate vfprintf tests to new harness

2023-11-16 Thread Thomas Weißschuh
On 2023-11-16 08:48:02+0100, Willy Tarreau wrote: > On Wed, Nov 15, 2023 at 10:08:21PM +0100, Thomas Weißschuh wrote: > > Migrate part of nolibc-test.c to the new test harness. > > > > Signed-off-by: Thomas Weißschuh > > --- > > tools/testing/se

Re: [PATCH RFC 2/3] selftests/nolibc: migrate startup tests to new harness

2023-11-16 Thread Thomas Weißschuh
On 2023-11-16 08:33:27+0100, Willy Tarreau wrote: > On Wed, Nov 15, 2023 at 10:08:20PM +0100, Thomas Weißschuh wrote: > > Migrate part of nolibc-test.c to the new test harness. > > > > Signed-off-by: Thomas Weißschuh > > A few points, mostly questions and food for th

Re: [PATCH RFC 1/3] selftests/nolibc: add custom test harness

2023-11-16 Thread Thomas Weißschuh
On 2023-11-16 08:16:22+0100, Willy Tarreau wrote: > Hi Thomas, > > On Wed, Nov 15, 2023 at 10:08:19PM +0100, Thomas Weißschuh wrote: > > The harness provides a framework to write unit tests for nolibc itself > > and kernel selftests using nolibc. > > > > Ad

[PATCH RFC 1/3] selftests/nolibc: add custom test harness

2023-11-15 Thread Thomas Weißschuh
in its support for test suites, the same as google test. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-harness.h | 269 1 file changed, 269 insertions(+) diff --git a/tools/testing/selftests/nolibc/nolibc-harness.h b/tools/testing

[PATCH RFC 2/3] selftests/nolibc: migrate startup tests to new harness

2023-11-15 Thread Thomas Weißschuh
Migrate part of nolibc-test.c to the new test harness. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 106 ++- 1 file changed, 56 insertions(+), 50 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools

[PATCH RFC 0/3] selftests/nolibc: introduce new test harness

2023-11-15 Thread Thomas Weißschuh
the test "mmap_munmap_good" fails. This is a bug in qemu-user and already fixed there on master. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (3): selftests/nolibc: add custom test harness selftests/nolibc: migrate startup tests to new harness selftests/nolib

[PATCH RFC 3/3] selftests/nolibc: migrate vfprintf tests to new harness

2023-11-15 Thread Thomas Weißschuh
Migrate part of nolibc-test.c to the new test harness. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 74 +++- 1 file changed, 28 insertions(+), 46 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools

Re: [PATCH 0/2] selftests/nolibc: run-user improvements

2023-11-09 Thread Thomas Weißschuh
Nov 9, 2023 17:28:45 Konstantin Ryabitsev : > On Wed, Sep 15, 2077 at 02:13:51AM +0200, Thomas Weißschuh wrote: >     > > I'm curious how this happened, especially since this was sent with b4. My system time was messed up. I blame systemd-timesyncd.

[PATCH v2] tools/nolibc: mips: add support for PIC

2023-11-08 Thread Thomas Weißschuh
ation. Signed-off-by: Thomas Weißschuh --- Changes in v2: - Preserver 8-byte alignment of stack pointer - Link to v1: https://lore.kernel.org/r/20231108-nolibc-pic-v1-1-9b7a429d5...@weissschuh.net --- tools/include/nolibc/arch-mips.h| 7 ++- tools/testing/selftests/nolibc/Makefile | 2

[PATCH] tools/nolibc: mips: add support for PIC

2023-11-08 Thread Thomas Weißschuh
ation. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/arch-mips.h| 7 ++- tools/testing/selftests/nolibc/Makefile | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/include/nolibc/arch-mips.h b/tools/include/nolibc/arch-mips.h index 3a2c76716b83..e9a0184

Re: [PATCH] selftests/nolibc: fix testcase status alignment

2023-11-05 Thread Thomas Weißschuh
On 2023-11-05 15:27:00+0100, Willy Tarreau wrote: > On Sun, Nov 05, 2023 at 03:22:30PM +0100, Thomas Weißschuh wrote: > > Center-align all possible status reports. > > Before OK and FAIL were center-aligned in relation to each other but > > SKIPPED and FAILED would be left-ali

[PATCH] selftests/nolibc: fix testcase status alignment

2023-11-05 Thread Thomas Weißschuh
[OK] Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 2f10541e6f38..e17

[PATCH v2 6/6] selftests/nolibc: add configuration for mipso32be

2023-11-05 Thread Thomas Weißschuh
Allow testing MIPS O32 big endian. Signed-off-by: Thomas Weißschuh Acked-by: Willy Tarreau --- tools/testing/selftests/nolibc/Makefile | 7 +++ tools/testing/selftests/nolibc/run-tests.sh | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests

[PATCH v2 3/6] selftests/nolibc: use XARCH for MIPS

2023-11-05 Thread Thomas Weißschuh
MIPS has many different configurations prepare the support of additional ones by moving the build of MIPS to the generic XARCH infrastructure. Signed-off-by: Thomas Weißschuh Acked-by: Willy Tarreau --- tools/testing/selftests/nolibc/Makefile | 12 +++- tools/testing/selftests

[PATCH v2 1/6] tools/nolibc: error out on unsupported architecture

2023-11-05 Thread Thomas Weißschuh
When an architecture is unsupported arch.h would silently continue. This leads to a lot of followup errors because my_syscallX() is not defined and the startup code is missing. Avoid these confusing errors and fail the build early with a clear error message and location. Signed-off-by: Thomas

[PATCH v2 0/6] tools/nolibc: MIPS bugfixes and refactoring

2023-11-05 Thread Thomas Weißschuh
Two bugfixes and some minor refactorings of the MIPS support. Signed-off-by: Thomas Weißschuh --- Changes in v2: - Use olddefconfig instead of oldconfig - mipso32{le,be} -> mips32{le,be} - Link to v1: https://lore.kernel.org/r/20231105-nolibc-mips-be-v1-0-6c2ad3e50...@weissschuh.net --- Tho

[PATCH v2 4/6] selftests/nolibc: explicitly specify ABI for MIPS

2023-11-05 Thread Thomas Weißschuh
More ABIs exist, for better clarity specify it explicitly everywhere. Signed-off-by: Thomas Weißschuh Acked-by: Willy Tarreau --- tools/testing/selftests/nolibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing

  1   2   >