* [PATCH] scripts: check-function-names: propagate nm failures
@ 2026-11-03 10:58 Hamdy Abou El Anein
2026-11-04 12:03 ` [PATCH v2] " Hamdy Abou El Anein
0 siblings, 1 reply; 3+ messages in thread
From: Hamdy Abou El Anein @ 2026-11-03 10:58 UTC (permalink / raw)
To: nathan; +Cc: nsc, linux-kbuild, linux-kernel, hamdy.aea
From: Hamdy Abou El Anein <hamdy.aea@protonmail.com>
The symbol-name check pipes nm through awk and grep. If nm cannot read
an object file, its failure status is lost and the script reports
success without checking any symbols.
Capture nm output before filtering it and fail when nm fails. This
keeps the existing forbidden-name detection unchanged.
Tested with a malformed object (failure), a valid object (success),
and an object defining startup (failure).
Signed-off-by: Hamdy Abou El Anein <hamdy.aea@protonmail.com>
---
scripts/check-function-names.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/check-function-names.sh b/scripts/check-function-names.sh
index 94883e6..f07a0e1 100755
--- a/scripts/check-function-names.sh
+++ b/scripts/check-function-names.sh
@@ -13,7 +13,8 @@ if [ ! -f "$objfile" ]; then
exit 1
fi
-bad_symbols=$(${NM:-nm} -p "$objfile" | awk '$2 ~ /^[TtWw]$/ {print $3}' |
+symbols=$(${NM:-nm} -p "$objfile") || exit 1
+bad_symbols=$(printf '%s\n' "$symbols" | awk '$2 ~ /^[TtWw]$/ {print $3}' |
grep -E '^(startup|exit|split|unlikely|hot|unknown)(\.|$)')
if [ -n "$bad_symbols" ]; then
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.56.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] scripts: check-function-names: propagate nm failures
2026-11-03 10:58 [PATCH] scripts: check-function-names: propagate nm failures Hamdy Abou El Anein
@ 2026-11-04 12:03 ` Hamdy Abou El Anein
2026-11-04 12:07 ` [PATCH v3] " Hamdy Abou El Anein
0 siblings, 1 reply; 3+ messages in thread
From: Hamdy Abou El Anein @ 2026-11-04 12:03 UTC (permalink / raw)
To: nathan; +Cc: nsc, linux-kbuild, linux-kernel, hamdy.aea
From: Hamdy Abou El Anein <hamdy.aea@protonmail.com>
The symbol-name check pipes nm through awk and grep. If nm cannot read
an object file, its failure status is lost and the script reports
success without checking any symbols.
Keep nm output streaming while carrying its exit status through the
filter. This avoids buffering the full vmlinux.o symbol table in a
shell variable during the serial kernel link.
Tested with a malformed object (failure), a valid object (success), an
object defining startup (failure), and a synthetic large nm stream
(success).
AI assistance: ChatGPT/Codex identified the issue and prepared the
change, commit message and executable regression tests.
Signed-off-by: Hamdy Abou El Anein <hamdy.aea@protonmail.com>
---
scripts/check-function-names.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/check-function-names.sh b/scripts/check-function-names.sh
index 94883e690627..f07a0e1cf339 100755
--- a/scripts/check-function-names.sh
+++ b/scripts/check-function-names.sh
@@ -13,7 +13,8 @@ if [ ! -f "$objfile" ]; then
exit 1
fi
-bad_symbols=$(${NM:-nm} -p "$objfile" | awk '$2 ~ /^[TtWw]$/ {print $3}' |
+symbols=$(${NM:-nm} -p "$objfile") || exit 1
+bad_symbols=$(printf '%s\n' "$symbols" | awk '$2 ~ /^[TtWw]$/ {print $3}' |
grep -E '^(startup|exit|split|unlikely|hot|unknown)(\.|$)')
if [ -n "$bad_symbols" ]; then
--
2.56.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v3] scripts: check-function-names: propagate nm failures
2026-11-04 12:03 ` [PATCH v2] " Hamdy Abou El Anein
@ 2026-11-04 12:07 ` Hamdy Abou El Anein
0 siblings, 0 replies; 3+ messages in thread
From: Hamdy Abou El Anein @ 2026-11-04 12:07 UTC (permalink / raw)
To: nathan; +Cc: nsc, linux-kbuild, linux-kernel, hamdy.aea
From: Hamdy Abou El Anein <hamdy.aea@protonmail.com>
The symbol-name check pipes nm through awk and grep. If nm cannot read
an object file, its failure status is lost and the script reports
success without checking any symbols.
Keep nm output streaming while carrying its exit status through the
filter. This avoids buffering the full vmlinux.o symbol table in a
shell variable during the serial kernel link, as the v2 did.
Tested with a malformed object (failure), a valid object (success), an
object defining startup (failure), and a synthetic large nm stream
(success).
AI assistance: ChatGPT/Codex identified the issue and prepared the
change, commit message and executable regression tests.
Signed-off-by: Hamdy Abou El Anein <hamdy.aea@protonmail.com>
---
scripts/check-function-names.sh | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/scripts/check-function-names.sh b/scripts/check-function-names.sh
index 94883e690627..b25e630cc594 100755
--- a/scripts/check-function-names.sh
+++ b/scripts/check-function-names.sh
@@ -13,9 +13,28 @@ if [ ! -f "$objfile" ]; then
exit 1
fi
-bad_symbols=$(${NM:-nm} -p "$objfile" | awk '$2 ~ /^[TtWw]$/ {print $3}' |
- grep -E '^(startup|exit|split|unlikely|hot|unknown)(\.|$)')
-
+# Keep nm output streaming while preserving its exit status.
+bad_symbols=$(
+ {
+ ${NM:-nm} -p "$objfile"
+ nm_status=$?
+ printf '\n#nm_status %s\n' "$nm_status"
+ } |
+ awk '
+ $1 == "#nm_status" {
+ if ($2 != 0)
+ nm_failed = 1
+ next
+ }
+ $2 ~ /^[TtWw]$/ && $3 ~ /^(startup|exit|split|unlikely|hot|unknown)(\.|$)/ {
+ print $3
+ }
+ END {
+ if (nm_failed)
+ exit 1
+ }
+ '
+) || exit 1
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
--
2.56.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-04 12:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 10:58 [PATCH] scripts: check-function-names: propagate nm failures Hamdy Abou El Anein
2026-11-04 12:03 ` [PATCH v2] " Hamdy Abou El Anein
2026-11-04 12:07 ` [PATCH v3] " Hamdy Abou El Anein
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®