From: Willy Tarreau <w@1wt.eu>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: linux-kernel@vger.kernel.org, Danish Khateeb <danishkhateeb03@gmail.com>
Subject: Re: [PATCH v2 1/4] tools/nolibc: derive clang target flags from ARCH if CROSS_COMPILE is not set
Date: Sat, 5 Dec 2026 15:33:33 +0100 [thread overview]
Message-ID: <axQgvQWIio0ptiL-@1wt.eu> (raw)
In-Reply-To: <20261202-nolibc-fcntl-v2-1-651ff5781baa@weissschuh.net>
On Wed, Dec 02, 2026 at 08:29:46AM +0100, Thomas Weißschuh wrote:
> The clang --target= flags are important to make sure that the UAPI
> headers match the clang's architecture. If they don't match the
> header test compilation may fail spuriously.
>
> Currently the --target= flags are only derived from the CROSS_COMPILE
> variable. This variable may not be set for native builds or for native
> LLVM builds. Currently this works by chance.
>
> Fall back to ARCH to determine the --target= flags if CROSS_COMPILE
> was not set. ARCH is always set.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> tools/include/nolibc/Makefile | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
> index 0880be0f6ef5..20160f3f9547 100644
> --- a/tools/include/nolibc/Makefile
> +++ b/tools/include/nolibc/Makefile
> @@ -122,6 +122,14 @@ headers_standalone: headers
> CFLAGS_s390 := -m64
> CFLAGS := $(CFLAGS_$(ARCH))
>
> +ifneq ($(LLVM),)
> +ifeq ($(CLANG_CROSS_FLAGS),)
> +SRCARCH := $(ARCH)
> +include $(srctree)/scripts/Makefile.clang
> +CLANG_CROSS_FLAGS := --target=$(CLANG_TARGET_FLAGS)
> +endif
> +endif
> +
> headers_check: headers_standalone
> $(Q)for header in $(filter-out crt.h std.h,$(all_files)); do \
> $(CC) $(CFLAGS) $(CLANG_CROSS_FLAGS) -Wall -Werror -nostdinc -fsyntax-only -x c /dev/null \
OK!
Reviewed-by: Willy Tarreau <w@1wt.eu>
Thanks,
Willy
next prev parent reply other threads:[~2026-12-05 14:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 7:29 [PATCH v2 0/4] tools/nolibc: add support for fcntl() Thomas Weißschuh
2026-12-02 7:29 ` [PATCH v2 1/4] tools/nolibc: derive clang target flags from ARCH if CROSS_COMPILE is not set Thomas Weißschuh
2026-12-05 14:33 ` Willy Tarreau [this message]
2026-12-02 7:29 ` [PATCH v2 2/4] selftests/nolibc: split out the structure member compatibility checks Thomas Weißschuh
2026-12-02 11:29 ` David Laight
2026-12-05 14:31 ` Willy Tarreau
2026-12-02 7:29 ` [PATCH v2 3/4] tools/nolibc: add support for fcntl() Thomas Weißschuh
2026-12-05 14:25 ` Willy Tarreau
2026-12-05 14:56 ` Thomas Weißschuh
2026-12-05 16:08 ` Willy Tarreau
2026-12-02 7:29 ` [PATCH v2 4/4] tools/nolibc: remove the open-coded fcntl() in dup2() Thomas Weißschuh
2026-12-05 14:26 ` 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=axQgvQWIio0ptiL-@1wt.eu \
--to=w@1wt.eu \
--cc=danishkhateeb03@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
/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