public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: prefer ${NM} in check-function-names.sh
@ 2025-12-18 17:58 Carlos Llamas
  2025-12-19 21:42 ` Nathan Chancellor
  2026-01-14 13:27 ` Nicolas Schier
  0 siblings, 2 replies; 3+ messages in thread
From: Carlos Llamas @ 2025-12-18 17:58 UTC (permalink / raw)
  To: Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Josh Poimboeuf, Carlos Llamas, Peter Zijlstra (Intel),
	Greg Kroah-Hartman
  Cc: kernel-team, linux-kernel,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b

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")
Signed-off-by: Carlos Llamas <cmllamas@google.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: prefer ${NM} in check-function-names.sh
  2025-12-18 17:58 [PATCH] kbuild: prefer ${NM} in check-function-names.sh Carlos Llamas
@ 2025-12-19 21:42 ` Nathan Chancellor
  2026-01-14 13:27 ` Nicolas Schier
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2025-12-19 21:42 UTC (permalink / raw)
  To: Carlos Llamas, Josh Poimboeuf, Peter Zijlstra, Nicolas Schier
  Cc: Nick Desaulniers, Bill Wendling, Justin Stitt, Greg Kroah-Hartman,
	kernel-team, linux-kernel,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b,
	linux-kbuild

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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: prefer ${NM} in check-function-names.sh
  2025-12-18 17:58 [PATCH] kbuild: prefer ${NM} in check-function-names.sh Carlos Llamas
  2025-12-19 21:42 ` Nathan Chancellor
@ 2026-01-14 13:27 ` Nicolas Schier
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Schier @ 2026-01-14 13:27 UTC (permalink / raw)
  To: Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Josh Poimboeuf, Peter Zijlstra (Intel), Greg Kroah-Hartman,
	Carlos Llamas
  Cc: Nicolas Schier, kernel-team, linux-kernel,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b


On Thu, 18 Dec 2025 17:58:06 +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.
> 
> [...]

Applied, thanks!

[1/1] kbuild: prefer ${NM} in check-function-names.sh
      https://git.kernel.org/kbuild/c/946d4623

Best regards,
-- 
Nicolas


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-14 13:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-18 17:58 [PATCH] kbuild: prefer ${NM} in check-function-names.sh Carlos Llamas
2025-12-19 21:42 ` Nathan Chancellor
2026-01-14 13:27 ` Nicolas Schier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox