From: sashiko-bot@kernel.org
To: "Nathan Chancellor" <nathan@kernel.org>,
"Thomas Gleixner" <tglx@kernel.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
"Nicolas Schier" <nsc@kernel.org>
Cc: x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
"Nick Desaulniers" <ndesaulniers@google.com>,
"Bill Wendling" <morbo@google.com>,
"Justin Stitt" <justinstitt@google.com>,
"Julian Braha" <julianbraha@gmail.com>,
linux-kbuild@vger.kernel.org,
"Linus Torvalds" <torvalds@linux-foundation.org>
Subject: Re: [PATCH v3 1/2] kbuild: Introduce CONFIG_CROSS_COMPILING
Date: Thu, 26 Nov 2026 06:43:41 +0000 [thread overview]
Message-ID: <sashiko-outbox-234889@kernel.org> (raw)
In-Reply-To: <20261124-x86-no-march-native-on-non-x86_64-v3-1-268354149c5f@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] kbuild: missing LC_ALL=C in check-cross-compiling.sh breaks
get_target()
--
commit 9280272f16cf67d3e6acabda19014fda4538151a
Author: Nathan Chancellor <nathan@kernel.org>
kbuild: Introduce CONFIG_CROSS_COMPILING
This commit introduces CONFIG_CROSS_COMPILING and a helper script,
scripts/check-cross-compiling.sh, to detect cross-compilation by comparing
the first component of the target triples reported by $(HOSTCC) -v and
$(CC) -v.
Link: https://lore.kernel.org/CAHk-=wgmkoWHWwaQ6nsGoCiBp0hrpJuiwmoVbQ=Efun8JyUNKw@mail.gmail.com/
> diff --git a/scripts/check-cross-compiling.sh b/scripts/check-cross-compiling.sh
> new file mode 100755
> index 0000000000000..4c1e6a061b3b1
> --- /dev/null
> +++ b/scripts/check-cross-compiling.sh
> @@ -0,0 +1,26 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +
> +HOSTCC="$1"
> +CC="$2"
> +
> +get_target() {
> + "$@" -v 2>&1 | grep -o 'Target: \([^-]\+\)'
> +}
> +
> +if ! hostcc_target=$(get_target $HOSTCC); then
> + echo >&2 "$0: Could not get target for HOSTCC!"
> + exit 1
> +fi
[Severity: Medium]
Can get_target() fail to match "Target: " when building under a non-English
locale?
The top-level Makefile runs "unexport LC_ALL" and only forces LC_COLLATE=C
and LC_NUMERIC=C, leaving LANG and LC_MESSAGES intact in the environment.
When GCC has localized message catalogs installed, "gcc -v" translates the
"Target: %s" line (for example, "Ziel: " in de_DE or "Cible : " in fr_FR).
Because CROSS_COMPILING invokes this script via $(success,...), the
resulting exit 1 is silently treated as a native build, leaving
CONFIG_CROSS_COMPILING=n during cross-compilation. Prefixing the compiler
invocation with LC_ALL=C avoids the locale dependency.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-x86-no-march-native-on-non-x86_64-v3-0-268354149c5f@kernel.org?part=1
next prev parent reply other threads:[~2026-11-26 6:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 6:43 [PATCH v3 0/2] x86: Avoid CONFIG_X86_NATIVE_CPU=y when cross compiling Nathan Chancellor
2026-11-25 6:43 ` [PATCH v3 1/2] kbuild: Introduce CONFIG_CROSS_COMPILING Nathan Chancellor
2026-11-25 10:27 ` Thomas Weißschuh
2026-11-25 20:28 ` Nathan Chancellor
2026-11-26 6:43 ` sashiko-bot [this message]
2026-11-25 6:43 ` [PATCH v3 2/2] x86/build: Do not allow X86_NATIVE_CPU to be enabled when cross compiling Nathan Chancellor
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=sashiko-outbox-234889@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=julianbraha@gmail.com \
--cc=justinstitt@google.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nsc@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tglx@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/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