public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Carlos Llamas <cmllamas@google.com>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Nicolas Schier <nsc@kernel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	kernel-team@android.com, linux-kernel@vger.kernel.org,
	"open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b"
	<llvm@lists.linux.dev>,
	linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] kbuild: prefer ${NM} in check-function-names.sh
Date: Fri, 19 Dec 2025 14:42:52 -0700	[thread overview]
Message-ID: <20251219214252.GD1407372@ax162> (raw)
In-Reply-To: <20251218175824.3122690-1-cmllamas@google.com>

On Thu, Dec 18, 2025 at 05:58:06PM +0000, Carlos Llamas wrote:
> The check-function-names.sh scripts invokes 'nm' directly and this can
> be problematic during cross-compilation when the toolchain is different
> from the system's default (e.g. LLVM=1).
> 
>   scripts/check-function-names.sh: nm: not found
> 
> Let's prefer the ${NM} variable which is already set by kbuild. However,
> still fallback to plain 'nm' to ensure the script is still usable when
> called directly.
> 
> Fixes: 93863f3f859a ("kbuild: Check for functions with ambiguous -ffunction-sections section names")

I may have caught this during review if linux-kbuild or its maintainers
were CC'd on that change.

> Signed-off-by: Carlos Llamas <cmllamas@google.com>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

If Josh or Peter want to take this through a fixes branch in -tip, that
is fine with me. Otherwise, Nicolas can apply this to kbuild-fixes since
this change was merged in 6.19-rc1.

> ---
>  scripts/check-function-names.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/check-function-names.sh b/scripts/check-function-names.sh
> index 410042591cfc..08071133e5a5 100755
> --- a/scripts/check-function-names.sh
> +++ b/scripts/check-function-names.sh
> @@ -13,7 +13,7 @@ if [ ! -f "$objfile" ]; then
>  	exit 1
>  fi
>  
> -bad_symbols=$(nm "$objfile" | awk '$2 ~ /^[TtWw]$/ {print $3}' | grep -E '^(startup|exit|split|unlikely|hot|unknown)(\.|$)')
> +bad_symbols=$(${NM:-nm} "$objfile" | awk '$2 ~ /^[TtWw]$/ {print $3}' | grep -E '^(startup|exit|split|unlikely|hot|unknown)(\.|$)')
>  
>  if [ -n "$bad_symbols" ]; then
>  	echo "$bad_symbols" | while read -r sym; do
> -- 
> 2.52.0.351.gbe84eed79e-goog
> 

  reply	other threads:[~2025-12-19 21:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18 17:58 [PATCH] kbuild: prefer ${NM} in check-function-names.sh Carlos Llamas
2025-12-19 21:42 ` Nathan Chancellor [this message]
2026-01-14 13:27 ` Nicolas Schier

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=20251219214252.GD1407372@ax162 \
    --to=nathan@kernel.org \
    --cc=cmllamas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jpoimboe@kernel.org \
    --cc=justinstitt@google.com \
    --cc=kernel-team@android.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=nsc@kernel.org \
    --cc=peterz@infradead.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