From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "Willy Tarreau" <w@1wt.eu>,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
linux-kernel@vger.kernel.org,
"Masahiro Yamada" <masahiroy@kernel.org>
Subject: Re: [RFC PATCH 3/3] tools/nolibc: add a new "install_all_archs" target
Date: Fri, 27 Jun 2025 07:11:45 +0200 [thread overview]
Message-ID: <89a2e713-edfd-4556-b321-cdccc3437a43@t-8ch.de> (raw)
In-Reply-To: <b14da196-84cc-4d13-baa2-952ba22f5a3e@app.fastmail.com>
On 2025-06-26 23:15:07+0200, Arnd Bergmann wrote:
> On Thu, Jun 26, 2025, at 22:18, Thomas Weißschuh wrote:
> > On 2025-06-20 12:37:05+0200, Willy Tarreau wrote:
> >> This installs all supported archs together, both from nolibc and kernel
> >> headers. The arch-specific asm/ subdirs are renamed to asm-arch-$arch,
> >> and asm/ is rebuilt from all these files in order to include the right
> >> one depending on the build architecture.
> >>
> >> This allows to use a single unified sysroot for all archs, and to only
> >> change the compiler or the target architecture. This way, a complete
> >> sysroot is much easier to use (a single directory is needed) and much
> >> smaller.
> >>
> >> + $(Q)rm -rf "$(OUTPUT)sysroot/include/asm"
> >> + $(Q)mkdir -p "$(OUTPUT)sysroot/include/asm"
> >> + @# Now install headers for all archs
> >> + $(Q)for arch in $(patsubst aarch64,arm64,$(nolibc_supported_archs)); do \
> >> + echo "# installing $$arch"; \
> >> + if ! [ -d $(OUTPUT)sysroot/include/asm-arch-$$arch ]; then \
> >> + $(MAKE) -C $(srctree) ARCH=$$arch mrproper; \
> >> + $(MAKE) -C $(srctree) ARCH=$$arch headers_install no-export-headers= \
> >> + INSTALL_HDR_PATH="$(OUTPUT)sysroot/include/$$arch" >/dev/null; \
>
> >
> > I'm not a fan of the loop to build the ifdeffery. It is a duplication
> > of what we have in tools/include/nolibc/arch.h and horrible to look at.
> > Can we stick this into a reusable header file?
> > Something along the lines of this:
> >
> > /* asm/foo.h */
> > #define _NOLIBC_PER_ARCH_HEADER "foo.h"
> > #include "_nolibc_include_per_arch_header.h"
> >
> >
> > /* _nolibc_include_per_arch_header.h */
> > #if defined(__i386__)
> > #include CONCAT("asm-arch-x86/", _NOLIBC_PER_ARCH_HEADER)
> > #elif
> > ...
> >
> > However, so far I couldn't get it to work.
> > Also it would be great if we can use it for the current arch.h, too.
>
> I'm not sure either of those is better than the version we
> had until commit f3c8d4c7a728 ("kbuild: remove headers_{install,check}_all").
> which simply relied on a symlink to the architecture specific
> directory to be set.
Thanks for the pointer, that probably answers the question if this could
be part of kbuild proper. It shouldn't.
With the symlink, a given generic UAPI tree can be specialized to one
specific architecture. But here we want to create a full sysroot that works
for all architectures *at the same time*. So a symlink would not be enough.
> If it's indeed possible to concatenate the path name (I couldn't
> figure that out either), that could also be done in place of the
> symlink but simpler than the #if/#elif/#elif/... block, like
>
> #include <arch.h> // defines ARCH_PREFIX
> #include CONCAT(ARCH_PREFIX, ioctl.h)
If we can't get it to work like this I would still prefer to have a
template header file which gets specialized with sed instead of the
Makefile loop.
Thomas
next prev parent reply other threads:[~2025-06-27 5:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 10:37 [RFC PATCH 0/3] tools/nolibc: install unified multi-arch headers Willy Tarreau
2025-06-20 10:37 ` [RFC PATCH 1/3] tools/nolibc: merge i386 and x86_64 into a single x86 arch Willy Tarreau
2025-06-21 8:29 ` Thomas Weißschuh
2025-06-21 8:44 ` Willy Tarreau
2025-06-20 10:37 ` [RFC PATCH 2/3] tools/nolibc: add a new target "headers_all_archs" to loop over all archs Willy Tarreau
2025-06-23 21:56 ` Thomas Weißschuh
2025-06-24 6:20 ` Willy Tarreau
2025-06-24 7:46 ` Thomas Weißschuh
2025-06-24 10:00 ` Willy Tarreau
2025-06-20 10:37 ` [RFC PATCH 3/3] tools/nolibc: add a new "install_all_archs" target Willy Tarreau
2025-06-26 20:18 ` Thomas Weißschuh
2025-06-26 21:15 ` Arnd Bergmann
2025-06-27 3:25 ` Willy Tarreau
2025-06-27 5:58 ` Arnd Bergmann
2025-06-27 6:07 ` Willy Tarreau
2025-06-27 5:11 ` Thomas Weißschuh [this message]
2025-06-27 5:46 ` Willy Tarreau
2025-06-27 5:49 ` Willy Tarreau
2025-06-27 7:27 ` Thomas Weißschuh
2025-06-27 7:29 ` Willy Tarreau
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=89a2e713-edfd-4556-b321-cdccc3437a43@t-8ch.de \
--to=linux@weissschuh.net \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=thomas.weissschuh@linutronix.de \
--cc=w@1wt.eu \
/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®