summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/nolibc
AgeCommit message (Collapse)AuthorLines
2026-04-09selftests/nolibc: use gcc 15Thomas Weißschuh-1/+1
Newer compilers tend to detect more problematic code. Update the testsuite to use gcc 15.2.0 by default. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://patch.msgid.link/20260408-nolibc-gcc-15-v1-3-330d0c40f894@weissschuh.net
2026-04-07selftests/nolibc: don't skip tests for unimplemented syscalls anymoreThomas Weißschuh-11/+3
The automatic skipping of tests on ENOSYS returns was introduced in commit 349afc8a52f8 ("selftests/nolibc: skip tests for unimplemented syscalls"). It handled the fact that nolibc would return ENOSYS for many syscall wrappers on riscv32. Nowadays nolibc handles all these correctly, so this logic is not used anymore. To make missing nolibc functionality more obvious fail the tests again if something is not implemented. Revert the mentioned commit again. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260406-nolibc-no-skip-enosys-v1-2-c046b1ac7d73@weissschuh.net/
2026-04-07selftests/nolibc: explicitly handle ENOSYS from ptrace()Thomas Weißschuh-1/+1
The automatic ENOSYS handling in EXPECT_SYSER() is about to be removed. ptrace() will return legitimately return ENOSYS on qemu-user, so handle it explicitly. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260406-nolibc-no-skip-enosys-v1-1-c046b1ac7d73@weissschuh.net/
2026-04-07tools/nolibc: add byteorder conversionsThomas Weißschuh-0/+13
Add some standard functions to convert between different byte orders. Conveniently the UAPI headers provide all the necessary functionality. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260405-nolibc-bswap-v1-1-f7699ca9cee0@weissschuh.net
2026-04-07tools/nolibc: add the _syscall() macroThomas Weißschuh-0/+4
The standard syscall() function or macro uses the libc return value convention. Errors returned from the kernel as negative values are stored in errno and -1 is returned. Users who want to avoid using errno don't have a way to call raw syscalls and check the returned error. Add a new macro _syscall() which works like the standard syscall() but passes through the return value from the kernel unchanged. The naming scheme and return values match the named _sys_foo() system call wrappers already part of nolibc. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260405-nolibc-syscall-v1-3-e5b12bc63211@weissschuh.net
2026-04-06selftests/nolibc: only use libgcc when really necessaryThomas Weißschuh-13/+4
nolibc should work without libgcc to be compatible with as many toolchains as possible. Currently the functionality tested by nolibc-test does not contain any dependencies, make sure it stays this way by not linking libgcc anymore. On the ppc target GCC always emits references to '_restgpr_' functions, so keep linking libgcc there. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260404-nolibc-libgcc-v1-1-eb3ecfe0e176@weissschuh.net
2026-04-06selftests/nolibc: test the memory allocatorThomas Weißschuh-0/+55
The memory allocator has not seen any testing so far. Add a simple testcase for it. Suggested-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/lkml/adDRK8D6YBZgv36H@1wt.eu/ Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260404-nolibc-asprintf-v2-2-17d2d0df9763@weissschuh.net
2026-04-06tools/nolibc: add support for asprintf()Thomas Weißschuh-0/+24
Add support for dynamically allocating formatted strings through asprintf() and vasprintf(). Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260401-nolibc-asprintf-v1-3-46292313439f@weissschuh.net
2026-04-04tools/nolibc: handle all major and minor numbers in makedev() and friendsThomas Weißschuh-0/+3
Remove the limitation of only handling small major and minor numbers. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260404-nolibc-makedev-v2-5-456a429bf60c@weissschuh.net
2026-04-04selftests/nolibc: add a test for stat().st_rdevThomas Weißschuh-0/+1
The handling of 'dev_t' values is about to be changed. Add a test to make sure they are returned correctly from stat(). Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260404-nolibc-makedev-v2-2-456a429bf60c@weissschuh.net
2026-04-04selftests/nolibc: add some tests for makedev() and friendsThomas Weißschuh-0/+3
These functions/macros are about to be changed. Add some tests to make sure they continue working. As they only handle small dev_t values, only test those for now. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260404-nolibc-makedev-v2-1-456a429bf60c@weissschuh.net
2026-04-01tools/nolibc/printf: Support negative variable width and precisionDavid Laight-2/+3
For (eg) "%*.*s" treat a negative field width as a request to left align the output (the same as the '-' flag), and a negative precision to request the default precision. Set the default precision to -1 (not INT_MAX) and add explicit checks to the string handling for negative values (makes the tet unsigned). For numeric output check for 'precision >= 0' instead of testing _NOLIBC_PF_FLAGS_CONTAIN(flags, '.'). This needs an inverted test, some extra goto and removes an indentation. The changed conditionals fix printf("%0-#o", 0) - but '0' and '-' shouldn't both be specified. Signed-off-by: David Laight <david.laight.linux@gmail.com> Link: https://patch.msgid.link/20260323112247.3196-1-david.laight.linux@gmail.com Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-22selftests/nolibc: enable -WundefThomas Weißschuh-1/+2
Users might use -Wundef, so also use it in the nolibc testsuite to ensure no warnings are triggered. The existing line with warning options is getting too long, so move all warnings to a dedicated line. Acked-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://patch.msgid.link/20260318-nolibc-wundef-v1-2-fcb7f9ac7298@weissschuh.net
2026-03-22tools/nolibc: add support for program_invocation_{,short_}nameThomas Weißschuh-0/+34
Add support for the GNU extensions 'program_invocation_name' and 'program_invocation_short_name'. These are useful to print error messages, which by convention include the program name. As these are global variables which take up memory even if not used, similar to 'errno', gate them behind NOLIBC_IGNORE_ERRNO. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260318-nolibc-err-h-v4-1-08247a694bd9@weissschuh.net
2026-03-20selftests/nolibc: validate NOLIBC_IGNORE_ERRNO compilationThomas Weißschuh-1/+7
When NOLIBC_IGNORE_ERRNO is set, various bits of nolibc are disabled. Make sure that all the ifdeffery does not result in any compilation errors by compiling a dummy source file. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260311-nolibc-err-h-v1-2-735a9de7f15d@weissschuh.net
2026-03-20selftests/nolibc: add a variable for nolibc-test source filesThomas Weißschuh-6/+8
The list of the nolibc-test source files is repeated many times. Another source file is about to be added, adding to the mess. Introduce a common variable instead. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260311-nolibc-err-h-v1-1-735a9de7f15d@weissschuh.net
2026-03-20selftests/nolibc: Use printf variable field widths and precisionsDavid Laight-21/+5
Now that printf supports '*' for field widths and precisions then can be used to simplify the test output. - aligning the "[OK]" strings. - reporting the expected sprintf() output when there is a mismatch. Signed-off-by: David Laight <david.laight.linux@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260308113742.12649-18-david.laight.linux@gmail.com Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-20tools/nolibc/printf: Add support for octal outputDavid Laight-3/+6
Octal output isn't often used, but adding it costs very little. Supporting "%#o" is mildly annoying, it has to add a leading '0' if there isn't one present. In simple cases this is the same as adding a sign of '0' - but that adds an extra '0' in a few places. So you need 3 tests, %o, # and no leading '0' (which can only be checked after the zero pad for precision). If all the test are deferred until after zero padding then too many values are 'live' across the call to _nolibc_u64toa_base() and get spilled to stack. Hence the check that ignores the 'sign' if it is the same as the first character of the output string. Add tests for octal output. Signed-off-by: David Laight <david.laight.linux@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260308113742.12649-17-david.laight.linux@gmail.com [Thomas: avoid a -Wsign-compare] Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-20tools/nolibc/printf: Add support for zero padding and field precisionDavid Laight-2/+17
Includes support for variable field widths (eg "%*.*d"). Zero padding is limited to 31 zero characters. This is wider than the largest numeric field so shouldn't be a problem. All the standard printf formats are now supported except octal and floating point. Add tests for new features Signed-off-by: David Laight <david.laight.linux@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260308113742.12649-16-david.laight.linux@gmail.com [Thomas: fixup testcases for musl libc] Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-20tools/nolibc/printf: Add support for left aligning fieldsDavid Laight-1/+3
Output the characters before or after the pad - writing the pad takes more code. Include additional/changed tests Signed-off-by: David Laight <david.laight.linux@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260308113742.12649-15-david.laight.linux@gmail.com Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-20tools/nolibc/printf: Special case 0 and add support for %#xDavid Laight-0/+3
The output for %#x is almost the same as that for %p, both output in hexadecimal with a leading "0x". However for zero %#x should just output "0" (the same as decimal and ocal). For %p match glibc and output "(nil)" rather than "0x0" or "0". Add tests for "%#x", "% d", "%+d" and passing NULL to "%p". Signed-off-by: David Laight <david.laight.linux@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260308113742.12649-14-david.laight.linux@gmail.com [Thomas: fix up testcases for musl libc] Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-20tools/nolibc/printf: Add support for length modifiers tzqL and formats iXDavid Laight-3/+11
Length modifiers t (ptrdiff_t) and z (size_t) are aliases for l (long), q and L are 64bit the same as j (intmax). Format i is an alias for d and X similar to x but upper case. Supporting them is mostly just adding the relevant bit to the bit pattern used for matching characters. Although %X is detected the output will be lower case. Change/add tests to use conversions i and X, and length modifiers L and ll. Use the correct minimum value for "%Li". Signed-off-by: David Laight <david.laight.linux@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260308113742.12649-10-david.laight.linux@gmail.com [Thomas: Fix up testcases for musl libc] Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-20tools/nolibc: Implement strerror() in terms of strerror_r()David Laight-18/+2
strerror() can be the only part of a program that has a .data section. This requires 4k in the program file. Add a simple implementation of strerror_r() and use that in strerror() so that the "errno=" string is copied at run-time. Use __builtin_memcpy() because that optimises away the input string and just writes the required constants to the target buffer. Code size change largely depends on whether the inlining decision for strerror() changes. Change the tests to use the normal EXPECT_VFPRINTF() when testing %m. Skip the tests when !is_nolibc. Signed-off-by: David Laight <david.laight.linux@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260308113742.12649-4-david.laight.linux@gmail.com Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-20selftests/nolibc: Rename w to written in expect_vfprintf()David Laight-4/+4
Single character variable names don't make code easy to read. Rename 'w' (used for the return value from snprintf()) 'written'. Signed-off-by: David Laight <david.laight.linux@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260308113742.12649-3-david.laight.linux@gmail.com Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-20selftests/nolibc: Let EXPECT_VFPRINTF() tests be skippedDavid Laight-17/+17
Tests that check explicit nolibc behavior (eg "%m") or test places where the nolibc behaviour deviates from the libc need skipping when compiled to use the host libc. Signed-off-by: David Laight <david.laight.linux@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260302101815.3043-8-david.laight.linux@gmail.com Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-20selftests/nolibc: Check that snprintf() doesn't write beyond the buffer endDavid Laight-0/+13
Fill buf[] with known data and check the vsnprintf() doesn't write beyond the specified buffer length. Would have picked up the bug in field padding. Signed-off-by: David Laight <david.laight.linux@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260302101815.3043-7-david.laight.linux@gmail.com Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-20selftests/nolibc: Use length of 'expected' string to check snprintf() outputDavid Laight-26/+41
Instead of requiring the test cases specifying both the length and expected output, take the length from the expected output. Tests that expect the output be truncated are changed to specify the un-truncated output. Change the strncmp() to a memcmp() with an extra check that the output is actually terminated. Append a '+' to the printed output (after the final ") when the output is truncated. Signed-off-by: David Laight <david.laight.linux@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260302101815.3043-6-david.laight.linux@gmail.com Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-20selftests/nolibc: check vsnprintf() output buffer before the lengthDavid Laight-7/+9
Check the string matches before checking the returned length. Only print the string once when it matches. Makes it a lot easier to diagnose any incorrect output. Signed-off-by: David Laight <david.laight.linux@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260302101815.3043-5-david.laight.linux@gmail.com Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-20selftests/nolibc: Return correct value when printf test failsDavid Laight-1/+1
Correctly return 1 (the number of errors) when strcmp() fails rather than the return value from strncmp() which is the signed difference between the mismatching characters. Signed-off-by: David Laight <david.laight.linux@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260302101815.3043-4-david.laight.linux@gmail.com Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-20selftests/nolibc: Fix build with host headers and libcDavid Laight-1/+15
Many systems don't have strlcpy() or strlcat() and readdir_r() is deprecated. This makes the tests fail to build with the host headers. Disable the 'directories' test and define strlcpy(), strlcat() and readdir_r() using #defines so that the code compiles. Fixes: 6fe8360b16acb ("selftests/nolibc: also test libc-test through regular selftest framework") Signed-off-by: David Laight <david.laight.linux@gmail.com> Link: https://patch.msgid.link/20260223101735.2922-4-david.laight.linux@gmail.com Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-03-20selftests/nolibc: fix test_file_stream() on musl libcThomas Weißschuh-1/+9
fwrite() modifying errno is non-standard. Only validate this behavior on those libc implementations which implement it. Fixes: a5f00be9b3b0 ("tools/nolibc: Add a simple test for writing to a FILE and reading it back") Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-01-11tools/nolibc: Add a simple test for writing to a FILE and reading it backDaniel Palmer-0/+53
Add a test that exercises create->write->seek->read to check that using the stream functions (fwrite() etc) is not totally broken. The only edge cases this is testing for are: - Reading the file after writing but without rewinding reads nothing. - Trying to read more items than the file contains returns the count of fully read items. Signed-off-by: Daniel Palmer <daniel@thingy.jp> Link: https://patch.msgid.link/20260105023629.1502801-4-daniel@thingy.jp Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-01-11selftests/nolibc: also test libc-test through regular selftest frameworkThomas Weißschuh-1/+5
Hook up libc-test to the regular selftest build to make sure nolibc-test.c stays compatible with a normal libc. As the pattern rule from lib.mk does not handle compiling a target from a differently named source file, add an explicit rule definition. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260106-nolibc-selftests-v1-3-f82101c2c505@weissschuh.net
2026-01-11selftests/nolibc: scope custom flags to the nolibc-test targetThomas Weißschuh-6/+2
A new target for 'libc-test' is going to be added which should not be affected by these options. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260106-nolibc-selftests-v1-2-f82101c2c505@weissschuh.net
2026-01-11selftests/nolibc: try to read from stdin in readv_zero testThomas Weißschuh-1/+1
When stdout is redirected to a file this test fails. This happens when running through the kselftest runner since commit d9e6269e3303 ("selftests/run_kselftest.sh: exit with error if tests fail"). For consistency with other tests that read from a file descriptor, switch to stdin over stdout. The tests are still brittle against a redirected stdin, but at least they are now consistently so. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260106-nolibc-selftests-v1-1-f82101c2c505@weissschuh.net
2026-01-06selftests/nolibc: always build sparc32 tests with -mcpu=v8Thomas Weißschuh-1/+1
Since LLVM commit 39e30508a7f6 ("[Driver][Sparc] Default to -mcpu=v9 for 32-bit Linux/sparc64 (#109278)"), clang defaults to -mcpu=v9 for 32-bit SPARC builds. -mcpu=v9 generates instructions which are not recognized by qemu-sparc and qemu-system-sparc. Explicitly enforce -mcpu=v8 to generate compatible code. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260106-nolibc-sparc32-fix-v2-1-7c5cd6b175c2@weissschuh.net
2026-01-06selftests/nolibc: drop NOLIBC_SYSROOT=0 logicThomas Weißschuh-6/+0
This logic was added in commit 850fad7de827 ("selftests/nolibc: allow test -include /path/to/nolibc.h") to allow the testing of -include /path/to/nolibc.h. As it requires as special variable to activate, this code is nearly never used. Furthermore it complicates the logic a bit. Since commit a6a054c8ad32 ("tools/nolibc: add target to check header usability") and commit 443c6467fcd6 ("selftests/nolibc: always run nolibc header check") the usability of -include /path/to/nolibc.h is always checked anyways, making NOLIBC_SYSROOT=0 pointless. Drop the special logic. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260104-nolibc-nolibc_sysroot-v1-1-98025ad99add@weissschuh.net
2026-01-06selftests/nolibc: test compatibility of nolibc and kernel time typesThomas Weißschuh-0/+29
Keeping 'struct timespec' and 'struct __kernel_timespec' compatible allows the source code to stay simple. Validate that the types stay compatible. The test is specific to nolibc and does not compile on other libcs, so skip it there. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Link: https://patch.msgid.link/20251220-nolibc-uapi-types-v3-10-c662992f75d7@weissschuh.net
2026-01-04tools/nolibc: add ptrace supportBenjamin Berg-0/+2
Add ptrace support, as it will be useful in UML. Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> [Thomas: drop va_args usage and linux/uio.h inclusion] Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-12-03Merge tag 'nolibc-20251130-for-6.19-1' of ↵Linus Torvalds-1/+15
git://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc Pull nolibc updates from Thomas Weißschuh: - Preparations to the use of nolibc in UML: - Cleanup of sparse warnings - Library mode without _start() - More consistency when disabling errno - Unconditional installation of all architecture support files - Always 64-bit wide ino_t and off_t - Various cleanups and bug fixes * tag 'nolibc-20251130-for-6.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc: (25 commits) selftests/nolibc: error out on linker warnings selftests/nolibc: use lld to link loongarch binaries tools/nolibc: remove more __nolibc_enosys() fallbacks tools/nolibc: remove now superfluous overflow check in llseek tools/nolibc: use 64-bit off_t tools/nolibc: prefer the llseek syscall tools/nolibc: handle 64-bit off_t for llseek tools/nolibc: use 64-bit ino_t tools/nolibc: avoid using plain integer as NULL pointer tools/nolibc: add support for fchdir() tools/nolibc: clean up outdated comments in generic arch.h tools/nolibc: make the "headers" target install all supported archs tools/nolibc: add the more portable inttypes.h tools/nolibc: provide the portable sys/select.h tools/nolibc: add missing memchr() to string.h tools/nolibc: fix misleading help message regarding installation path tools/nolibc: add uio.h with readv and writev tools/nolibc: add option to disable runtime tools/nolibc: use __fallthrough__ rather than fallthrough tools/nolibc: implement %m if errno is not defined ...
2025-11-22selftests/nolibc: error out on linker warningsThomas Weißschuh-1/+1
If the linker emits warnings these should abort the build. Otherwise they will be swallowed by run-tests.sh and not shown. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu>
2025-11-22selftests/nolibc: use lld to link loongarch binariesThomas Weißschuh-0/+1
LLVM 21 switched to -mcmodel=medium for LoongArch64 compilations. This code model uses R_LARCH_ECALL36 relocations which might not be supported by GNU ld which to nolibc testsuite uses by default. ld will not resolve the relocation and all function calls will end up as busy loops. Use lld instead. We can not switch to lld for all LLVM builds, as it does not support all necessary architectures. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu>
2025-11-17tools: Remove s390 compat supportHeiko Carstens-10/+1
Remove s390 compat support from everything within tools, since s390 compat support will be removed from the kernel. Reviewed-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Thomas Weißschuh <linux@weissschuh.net> # tools/nolibc selftests/nolibc Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> # selftests/vDSO Acked-by: Alexei Starovoitov <ast@kernel.org> # bpf bits Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
2025-11-08tools/nolibc: add support for fchdir()Thomas Weißschuh-0/+2
Add support for the file descriptor based variant of chdir(). Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Acked-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-11-02tools/nolibc: add missing memchr() to string.hWilly Tarreau-0/+2
Surprisingly we forgot to add this common one. It was added with a per-arch guard allowing to later implement it in arch-specific asm code like was done for a few other ones. The test verifies that we don't search past the indicated length. Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-10-29tools/nolibc: add uio.h with readv and writevBenjamin Berg-0/+9
This is generally useful and struct iovec is also needed for other purposes such as ptrace. Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-09-01selftests/nolibc: remove outdated comment about construct orderBenjamin Berg-1/+0
The constructor order is not (and should not) be tested. Remove the comment. Fixes: a782d45c867c ("selftests/nolibc: stop testing constructor order") Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Link: https://lore.kernel.org/r/20250731201225.323254-3-benjamin@sipsolutions.net Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-09-01selftests/nolibc: fix EXPECT_NZ macroBenjamin Berg-2/+2
The expect non-zero macro was incorrect and never used. Fix its definition. Fixes: 362aecb2d8cfa ("selftests/nolibc: add basic infrastructure to ease creation of nolibc tests") Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Link: https://lore.kernel.org/r/20250731201225.323254-2-benjamin@sipsolutions.net Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2025-08-18selftests/nolibc: always compile the kernel with GCCThomas Weißschuh-3/+3
LLVM/clang can not build the kernel for all architectures supported by nolibc. The current setup uses the same compiler to build the kernel as is used for nolibc-test. This prevents using the full qemu-system tests for LLVM builds. Instead always build the kernel with GCC. For the nolibc testsuite the kernel does not need to be built with LLVM. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20250719-nolibc-llvm-system-v1-3-1730216ce171@weissschuh.net
2025-08-18selftests/nolibc: don't pass CC to toplevel MakefileThomas Weißschuh-1/+1
The toplevel Makefile is capable of calculating CC from CROSS_COMPILE and/or ARCH. Stop passing the unnecessary variable. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20250719-nolibc-llvm-system-v1-2-1730216ce171@weissschuh.net