mirror of
https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10.git
synced 2026-09-09 00:07:04 +08:00
JIRA: https://redhat.atlassian.net/browse/RHEL-152189 commit 946d462346d2ded161cfd3dc62a61d7050d9f9ec Author: Carlos Llamas <cmllamas@google.com> Date: Thu Dec 18 17:58:06 2025 +0000 kbuild: prefer ${NM} in check-function-names.sh 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> Signed-off-by: Yannick Cote <ycote@redhat.com>
26 lines
645 B
Bash
Executable File
26 lines
645 B
Bash
Executable File
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# Certain function names are disallowed due to section name ambiguities
|
|
# introduced by -ffunction-sections.
|
|
#
|
|
# See the comment above TEXT_MAIN in include/asm-generic/vmlinux.lds.h.
|
|
|
|
objfile="$1"
|
|
|
|
if [ ! -f "$objfile" ]; then
|
|
echo "usage: $0 <file.o>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
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
|
|
echo "$objfile: error: $sym() function name creates ambiguity with -ffunction-sections" >&2
|
|
done
|
|
exit 1
|
|
fi
|
|
|
|
exit 0
|