From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Sasha Levin <sashal@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>, Willy Tarreau <w@1wt.eu>,
Wake Liu <wakel@google.com>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 5/5] selftests/size: use nolibc startup and syscall wrappers
Date: Wed, 14 Oct 2026 22:51:18 +0200 [thread overview]
Message-ID: <e37521b1-a02f-49ac-a6b9-a0df08919bbf@t-8ch.de> (raw)
In-Reply-To: <20261014200127.1363472-6-sashal@kernel.org>
On 2026-10-14 16:01:27-0400, Sasha Levin wrote:
> get_size provides its own _start and is linked statically against the C
> library with -nostartfiles. That combination assumes startup and TLS
> details that vary between architectures and C library versions: errno
> lives in thread-local storage that is never set up, and the static link
> expects symbols from the skipped startup files. CI builds have failed
> with undefined _init/_fini on ARM with clang and an undefined _DYNAMIC
> on LoongArch.
I get the _DYNAMIC failures even on my boring x86_64 distro setup.
> Build the test with the in-tree nolibc instead. nolibc provides the
> startup code, so the test returns from main(), and it provides the
> write() and syscall() wrappers without the TLS errno problem. A failing
> sysinfo() is now reported as a TAP failure instead of crashing the
> test. Keep the static link and the existing TAP output.
>
> Since the test no longer uses the system C library headers, the kernel
> UAPI headers have to be installed before it is built. Add the headers
> target as an order-only prerequisite, as nolibc-test does, so that a
> standalone build installs them. Link libgcc only when the selected
> compiler is GCC, which needs it for division helpers on ARM, and detect
> that from the compiler rather than from LLVM so that CC=clang builds do
> not try to link a libgcc that clang does not provide.
>
> nolibc does not support arc, csky, microblaze, nios2 or xtensa,
yet...
> so the
> test can no longer be built for those architectures. This conversion
> also makes the separate i386 vDSO workaround proposed for get_size
> unnecessary.
Nobody seems to build the selftests for these architectures anyways.
> Link: https://lore.kernel.org/r/20260929043637.1917707-1-wakel@google.com
> Fixes: 3ce51050fadd ("selftest: size: Add size test for Linux kernel")
> Cc: stable@vger.kernel.org # 6.18.x
I am not so excited about Fixes and Cc: stable.
But if it breaks, it will land on your plate anyways :-)
> Signed-off-by: Sasha Levin <sashal@kernel.org>
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> tools/testing/selftests/size/Makefile | 9 ++++++-
> tools/testing/selftests/size/get_size.c | 33 +++++++------------------
> 2 files changed, 17 insertions(+), 25 deletions(-)
(...)
> --- a/tools/testing/selftests/size/get_size.c
> +++ b/tools/testing/selftests/size/get_size.c
(...)
> -#include <sys/sysinfo.h>
> -#include <unistd.h>
> -#include <sys/syscall.h>
> -
> -#define STDOUT_FILENO 1
> +#include <nolibc.h>
Note:
The newfangled way to use nolibc would be to stick to the regular libc
includes:
#include <unistd.h>
#include <sys/syscall.h>
#include <linux/sysinfo.h>
But what you have also works, obviously.
> +#include <linux/sysinfo.h>
(...)
prev parent reply other threads:[~2026-10-14 20:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 20:01 [PATCH 0/5] selftests: target selection fixes for cross and LLVM builds Sasha Levin
2026-10-14 20:01 ` [PATCH 1/5] selftests/prctl: build generated tests for the target architecture Sasha Levin
2026-10-14 20:01 ` [PATCH 2/5] selftests/prctl: skip the anonymous VMA naming test when unsupported Sasha Levin
2026-10-14 20:01 ` [PATCH 3/5] selftests/thermal: allow cross builds of the Intel tests Sasha Levin
2026-10-14 20:01 ` [PATCH 4/5] selftests/kexec: select tests using the target compiler Sasha Levin
2026-10-14 20:01 ` [PATCH 5/5] selftests/size: use nolibc startup and syscall wrappers Sasha Levin
2026-10-14 20:51 ` Thomas Weißschuh [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e37521b1-a02f-49ac-a6b9-a0df08919bbf@t-8ch.de \
--to=linux@weissschuh.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=sashal@kernel.org \
--cc=shuah@kernel.org \
--cc=stable@vger.kernel.org \
--cc=w@1wt.eu \
--cc=wakel@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®