Commit graph

244 commits

Author SHA1 Message Date
Thomas Weißschuh
b9e5036317 selftests/nolibc: add x32 test configuration
Nolibc supports the x32 ABI on x86.
Add a testcase to make sure the support stays functional.

QEMU user does not have support for x32, so skip the test there.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250712-nolibc-x32-v1-2-6d81cb798710@weissschuh.net
2025-07-13 16:58:41 +02:00
Benjamin Berg
750aef513c selftests/nolibc: show failed run if test process crashes
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.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Link: https://lore.kernel.org/r/20250709155512.971080-2-benjamin@sipsolutions.net
[Thomas: fix patch prefix]
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-07-09 18:28:36 +02:00
Thomas Weißschuh
f6f6be0c4f tools/nolibc: drop s390 clang target override
tools/scripts/Makefile.include now has the same override,
removing the need for the one in the nolibc Makefile.

Drop the superfluous custom override.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Link: https://lore.kernel.org/r/20250620-tools-cross-s390-v2-2-ecda886e00e5@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-07-08 09:24:00 +02:00
Thomas Weißschuh
4a40129087 selftests/nolibc: correctly report errors from printf() and friends
When an error is encountered by printf() it needs to be reported.
errno() is already set by the callback.

sprintf() is different, but that keeps working and is already tested.

Also add a new test.

Fixes: 7e4346f4a3 ("tools/nolibc/stdio: add a minimal [vf]printf() implementation")
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250704-nolibc-printf-error-v1-2-74b7a092433b@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-07-06 11:02:40 +02:00
Thomas Weißschuh
2b1ed5f7f8 selftests/nolibc: create /dev/full when running as PID 1
An upcoming testcase will use /dev/full.

Make sure it is always present.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250704-nolibc-printf-error-v1-1-74b7a092433b@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-07-06 11:02:39 +02:00
Thomas Weißschuh
7c02bc4088 tools/nolibc: add support for clock_nanosleep() and nanosleep()
Also add some tests.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250704-nolibc-nanosleep-v1-1-d79c19701952@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-07-06 11:02:38 +02:00
Mark Brown
696bf15792 selftests/nolibc: Add coverage of vfork()
Generalise the existing fork() test to also cover the newly added vfork()
implementation.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20250703-arm64-gcs-vfork-exit-v3-4-1e9a9d2ddbbe@kernel.org
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-07-04 13:26:13 +02:00
Thomas Weißschuh
02217ad447 tools/nolibc: add support for SuperH
Add support for SuperH/"sh" to nolibc.
Only sh4 is tested for now.

The startup code is special:

__nolibc_entrypoint_epilogue() calls __builtin_unreachable() which emits
a call to abort(). To make this work a function prologue is generated to
set up a GOT pointer which corrupts "sp".
__builtin_unreachable() is necessary for __attribute__((noreturn)).
Also depending on compiler flags (for example -fPIC) even more prologue
is generated.

Work around this by defining a nested function in asm.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70216
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Acked-by: Rob Landley <rob@landley.net>
Acked-by: D. Jeff Dionne <jeff@coresemi.io>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Link: https://lore.kernel.org/r/20250623-nolibc-sh-v2-3-0f5b4b303025@weissschuh.net
2025-07-04 13:26:07 +02:00
Thomas Weißschuh
358b2511d7 selftests/nolibc: use file driver for QEMU serial
For the test implementation of the SuperH architecture a second serial
serial port needs to be used. Unfortunately the currently used 'stdio'
driver does not support multiple serial ports at the same time.

Switch to the 'file' driver which does support multiple ports and is
sufficient for the nolibc-test usecase.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Link: https://lore.kernel.org/r/20250623-nolibc-sh-v2-2-0f5b4b303025@weissschuh.net
2025-07-03 22:32:32 +02:00
Thomas Weißschuh
439fa8756a selftests/nolibc: fix EXTRACONFIG variables ordering
The variable block got disordered at some point.

Use the correct ordering.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Link: https://lore.kernel.org/r/20250623-nolibc-sh-v2-1-0f5b4b303025@weissschuh.net
2025-07-03 22:32:07 +02:00
Thomas Weißschuh
a6a2a8a429 tools/nolibc: MIPS: add support for N64 and N32 ABIs
Add support for the MIPS 64bit N64 and ILP32 N32 ABIs.

In addition to different byte orders and ABIs there are also different
releases of the MIPS architecture. To avoid blowing up the test matrix,
only add a subset of all possible test combinations.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Tested-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Link: https://lore.kernel.org/r/20250623-nolibc-mips-n32-v3-4-6ae2d89f4259@weissschuh.net
2025-06-28 22:23:33 +02:00
Thomas Weißschuh
fb1cacdbac selftests/nolibc: avoid GCC 15 -Wunterminated-string-initialization
On GCC 15 the following warnings is emitted:

nolibc-test.c: In function ‘run_stdlib’:
nolibc-test.c:1416:32: warning: initializer-string for array of ‘char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (11 chars into 10 available) [-Wunterminated-string-initialization]
 1416 |                 char buf[10] = "test123456";
      |                                ^~~~~~~~~~~~

Increase the size of buf to avoid the warning.

It would also be possible to use __attribute__((nonstring)) but that
would require some ifdeffery to work with older compilers.

Fixes: 1063649cf5 ("selftests/nolibc: Add tests for strlcat() and strlcpy()")
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250623-nolibc-nonstring-v1-1-11282204766a@weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-06-23 23:49:07 +02:00
Thomas Weißschuh
eb13531108 selftests/nolibc: integrate with kselftests
Hook up nolibc-test with the kselftests framework.
This enables CI systems and developers to easily execute the tests.

While nolibc-test does not emit KTAP output itself that is not a problem,
as the kselftest executor will wrap the output in KTAP.

Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250620-nolibc-selftests-v1-4-f6b2ce7c5071@weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-06-23 22:56:21 +02:00
Thomas Weißschuh
3adf4f90c9 selftests/nolibc: rename Makefile
The nolibc tests are not real kselftests, they work differently and
provide a different interface. Users trying to use them like real
selftests may be confused and the tests are not executed by CI systems.

To make space for an integration with the kselftest framework, move the
custom tests out of the way.
The custom tests are still useful to keep as they provide functionality
not provided by kselftests.

Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250620-nolibc-selftests-v1-3-f6b2ce7c5071@weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-06-23 22:52:02 +02:00
Thomas Weißschuh
a09db6afe2 selftests/nolibc: split out CFLAGS logic
Some upcoming changes will reuse the CFLAGS.

Split the computation into a reusable Makefile.

Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250620-nolibc-selftests-v1-2-f6b2ce7c5071@weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-06-23 22:51:58 +02:00
Thomas Weißschuh
54c18a8f07 selftests/nolibc: drop implicit defconfig executions
Commit d7d271ec30 ("selftests/nolibc: execute defconfig before other targets")
accidentally introduced implicit executions of the defconfig target.
These executions were unintentional and come from a misunderstanding of
ordering dependencies.

Drop the dependencies again.

Reported-by: Mark Brown <broonie@kernel.org>
Closes: https://lore.kernel.org/all/3d5128b9-b4b6-4a8e-94ce-ea5ff4ea655b@sirena.org.uk/
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250620-nolibc-selftests-v1-1-f6b2ce7c5071@weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-06-23 22:51:51 +02:00
Thomas Weißschuh
b2c765778a selftests/nolibc: make stackprotector probing more robust
nolibc only supports symbol-based stackprotectors, based on the global
variable __stack_chk_guard. Support for this differs between
architectures and toolchains. Some use the symbol mode by default, some
require a flag to enable it and some don't support it at all.

Before the nolibc test Makefile required the availability of
"-mstack-protector-guard=global" to enable stackprotectors.
While this flag makes sure that the correct mode is available it doesn't
work where the correct mode is the only supported one and therefore the
flag is not implemented.

Switch to a more dynamic probing mechanism.
This correctly enables stack protectors for mips, loongarch and m68k.

Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250609-nolibc-stackprotector-robust-v1-1-a1cfc92a568a@weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-06-10 17:55:34 +02:00
Thomas Weißschuh
2011097c17 selftests/nolibc: drop include guards around standard headers
Nolibc now provides all the headers required by nolibc-test.c.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20250515-nolibc-sys-v1-9-74f82eea3b59@weissschuh.net
Acked-by: Willy Tarreau <w@1wt.eu>
2025-05-21 15:32:27 +02:00
Thomas Weißschuh
a009a0c6fa tools/nolibc: add fopen()
This is used in various selftests and will be handy when integrating
those with nolibc.

Only the standard POSIX modes are supported.
No extensions nor the (noop) "b" from ISO C are accepted.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-13-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-05-21 15:32:14 +02:00
Thomas Weißschuh
256dc7339d tools/nolibc: add namespace functionality
This is used in various selftests and will be handy when integrating
those with nolibc.

Not all configurations support namespaces, so skip the tests where
necessary.  Also if the tests are running without privileges.
Enable the namespace configuration for those architectures where it is not
enabled by default.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-12-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-05-21 15:32:12 +02:00
Thomas Weißschuh
7ff3c71a47 tools/nolibc: add difftime()
This is used in various selftests and will be handy when integrating
those with nolibc.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-11-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-05-21 15:32:12 +02:00
Thomas Weißschuh
da69cfb17b tools/nolibc: add timerfd functionality
This is used in various selftests and will be handy when integrating
those with nolibc.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-10-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-05-21 15:32:10 +02:00
Thomas Weißschuh
fa7bf84486 tools/nolibc: add timer functions
This is used in various selftests and will be handy when integrating
those with nolibc.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-9-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-05-21 15:32:09 +02:00
Thomas Weißschuh
50647213e1 tools/nolibc: add clock_getres(), clock_gettime() and clock_settime()
This is used in various selftests and will be handy when integrating
those with nolibc.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-8-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-05-21 15:32:07 +02:00
Thomas Weißschuh
1e10b8534f tools/nolibc: add support for access() and faccessat()
This is used in various selftests and will be handy when integrating
those with nolibc.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-7-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-05-21 15:32:06 +02:00
Thomas Weißschuh
bf5e8a78be tools/nolibc: add abs() and friends
This is used in various selftests and will be handy when integrating
those with nolibc.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-6-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-05-21 15:32:05 +02:00
Thomas Weißschuh
801f020b5f tools/nolibc: add getrandom()
This is used in various selftests and will be handy when integrating
those with nolibc.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-5-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-05-21 15:32:04 +02:00
Thomas Weißschuh
55175d8659 tools/nolibc: add mremap()
This is used in various selftests and will be handy when integrating
those with nolibc.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-4-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-05-21 15:32:03 +02:00
Thomas Weißschuh
7a7cd445d9 tools/nolibc: add %m printf format
The %m format can be used to format the current errno.
It is non-standard but supported by other commonly used libcs like glibc and
musl, so applications do rely on them.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-2-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-05-21 15:32:01 +02:00
Thomas Weißschuh
05b6b2a9ef tools/nolibc: add strstr()
This is used in various selftests and will be handy when integrating
those with nolibc.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-1-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-05-21 15:32:00 +02:00
Daniel Palmer
66a4f9bb1e tools/nolibc: Add m68k support
Add nolibc support for m68k. Should be helpful for nommu where
linking libc can bloat even hello world to the point where you get
an OOM just trying to load it.

Signed-off-by: Daniel Palmer <daniel@thingy.jp>
Link: https://lore.kernel.org/r/20250426224738.284874-1-daniel@0x0f.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-05-21 15:31:54 +02:00
Thomas Weißschuh
443c6467fc selftests/nolibc: always run nolibc header check
Prevent regressions of issues validates by the header check by always
running it together with the nolibc selftests.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250424-nolibc-header-check-v1-3-011576b6ed6f@linutronix.de
2025-05-21 15:31:53 +02:00
Thomas Weißschuh
e90ce42e81 tools/nolibc: implement width padding in printf()
printf can pad each argument to a certain width.
Implement this for compatibility with the kselftest harness.
Currently only padding with spaces is supported.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
2025-04-22 10:59:06 +02:00
Thomas Weißschuh
b0bd7760df selftests/nolibc: add test for snprintf() truncation
Now that we have a proper snprintf() implementation,
make sure truncation is handled properly.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
2025-04-22 10:59:06 +02:00
Thomas Weißschuh
6311e4893a selftests/nolibc: rename vfprintf test suite
With the addition of snprintf() and its usage in nolibc-test, the name of
the "vfprintf" test suite is not accurate anymore.

Rename the suite to be more generic.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
2025-04-22 10:59:05 +02:00
Thomas Weißschuh
c685cd6db5 selftests/nolibc: use snprintf() for printf tests
With a proper snprintf() implementation in place, the ugly pipe usage is
not necessary anymore.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
2025-04-22 10:59:04 +02:00
Thomas Weißschuh
4175b55845 Revert "selftests/nolibc: use waitid() over waitpid()"
nolibc's waitpid() now uses the waitid() syscall internally.
This removes the original reasoning for the reverted commit as
waitpid() is now available on all platforms and has an easier interface.

Switch back to waitpid().

This reverts commit a0bc8947ac.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
2025-04-22 10:58:22 +02:00
Thomas Weißschuh
9b070d97d9 tools/nolibc: add tolower() and toupper()
The kselftest harness uses these functions.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
2025-04-22 10:56:26 +02:00
Thomas Weißschuh
4c99fbc6a0 tools/nolibc: handle intmax_t/uintmax_t in printf
In nolibc intmax_t and uintmax_t are always the same as
(unsigned) long long/uint64_t as 128bit numbers are not supported.
Even libcs that do support 128bit numbers often fix intmax_t to 64bit
as it is used in ABIs and any change would break those.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
2025-04-22 10:56:23 +02:00
Thomas Weißschuh
8509b5c9fa selftests/nolibc: enable UBSAN if available
UBSAN detects undefined behaviour at runtime.
To avoid introduction of new UB, enable UBSAN for nolibc-test.

By signalling detected errors through traps no runtime dependency
is necessary.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250419-nolibc-ubsan-v2-7-060b8a016917@weissschuh.net
2025-04-19 14:18:16 +02:00
Thomas Weißschuh
6478251f95 selftests/nolibc: disable ubsan for smash_stack()
smash_stack() intentionally crashes.

Prevent UBSAN from tripping over it.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250419-nolibc-ubsan-v2-6-060b8a016917@weissschuh.net
2025-04-19 14:18:11 +02:00
Thomas Weißschuh
8e1930296f tools/nolibc: Add support for SPARC
Add support for 32bit and 64bit SPARC to nolibc.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Tested-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> # UltraSparc T4 (Niagara4)
Link: https://lore.kernel.org/lkml/20250322-nolibc-sparc-v2-1-89af018c6296@weissschuh.net/
2025-04-11 20:00:20 +02:00
Thomas Weißschuh
fd293cb81a selftests/nolibc: only consider XARCH for CFLAGS when requested
If no explicit XARCH is specified, use the toolchains default.

Suggested-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Link: https://lore.kernel.org/lkml/20250326205434.bPx_kVUx@breakpoint.cc/
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250402-nolibc-nolibc-test-native-v1-2-62f2f8585220@weissschuh.net
2025-04-11 20:00:19 +02:00
Thomas Weißschuh
cdbf0f199e selftests/nolibc: drop dependency from sysroot to defconfig
The creation of the sysroot does not require a kernel configuration.

Drop the dependency.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250402-nolibc-nolibc-test-native-v1-1-62f2f8585220@weissschuh.net
2025-04-11 20:00:19 +02:00
Thomas Weißschuh
5f40eef1c7 selftests/nolibc: drop unnecessary sys/io.h include
The include of sys/io.h is not necessary anymore since
commit 67eb617a8e ("selftests/nolibc: simplify call to ioperm").
It's existence is also problematic as the header does not exist on all
architectures.

Reported-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250324-nolibc-ioperm-v1-1-8a7cfb2876ae@weissschuh.net
2025-04-10 22:02:30 +02:00
Thomas Weißschuh
a782d45c86 selftests/nolibc: stop testing constructor order
The execution order of constructors in undefined and depends on the
toolchain.  While recent toolchains seems to have a stable order, it
doesn't work for older ones and may also change at any time.

Stop validating the order and instead only validate that all
constructors are executed.

Reported-by: Willy Tarreau <w@1wt.eu>
Closes: https://lore.kernel.org/lkml/20250301110735.GA18621@1wt.eu/
Link: https://lore.kernel.org/r/20250306-nolibc-constructor-order-v1-1-68fd161cc5ec@weissschuh.net
Acked-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-03-07 07:34:12 +01:00
Louis Taylor
6e406202a4 selftests/nolibc: use O_RDONLY flag instead of 0
This doesn't matter much, but is what the standard says.

Signed-off-by: Louis Taylor <louis@kragniz.eu>
Link: https://lore.kernel.org/r/20250306184147.208723-5-louis@kragniz.eu
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-03-06 22:30:21 +01:00
Louis Taylor
b2edaad7f5 tools/nolibc: add support for openat(2)
openat is useful to avoid needing to construct relative paths, so expose
a wrapper for using it directly.

Signed-off-by: Louis Taylor <louis@kragniz.eu>
Link: https://lore.kernel.org/r/20250306184147.208723-1-louis@kragniz.eu
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-03-06 22:30:20 +01:00
Thomas Weißschuh
cb839e0cc8 selftests/nolibc: add armthumb configuration
While nolibc does support ARM Thumb instructions,
that support was not tested specifically.

Add a new test configuration for it.

Tested-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250301-nolibc-armthumb-v1-2-d1f04abb5f6d@weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-03-02 13:25:20 +01:00
Thomas Weißschuh
f8bedb30d6 selftests/nolibc: explicitly enable ARM mode
The default could also be -mthumb.

Explicitly use -marm to keep everything predictable.

Tested-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250301-nolibc-armthumb-v1-1-d1f04abb5f6d@weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-03-02 13:25:20 +01:00