]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
kbuild: prefer ${NM} in check-function-names.sh
authorCarlos Llamas <cmllamas@google.com>
Thu, 18 Dec 2025 17:58:06 +0000 (17:58 +0000)
committerNicolas Schier <nsc@kernel.org>
Wed, 14 Jan 2026 13:13:41 +0000 (14:13 +0100)
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>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://patch.msgid.link/20251218175824.3122690-1-cmllamas@google.com
Signed-off-by: Nicolas Schier <nsc@kernel.org>
scripts/check-function-names.sh

index 410042591cfc4072613a47b4b02dfe505b3bc280..08071133e5a512b41de40621e393282d56823384 100755 (executable)
@@ -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