[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b14da196-84cc-4d13-baa2-952ba22f5a3e@app.fastmail.com>
Date: Thu, 26 Jun 2025 23:15:07 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: Thomas Weißschuh <linux@...ssschuh.net>,
"Willy Tarreau" <w@....eu>
Cc: Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
linux-kernel@...r.kernel.org, "Masahiro Yamada" <masahiroy@...nel.org>
Subject: Re: [RFC PATCH 3/3] tools/nolibc: add a new "install_all_archs" target
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.
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)
Arnd
Powered by blists - more mailing lists