From: Nathan Chancellor <nathan@kernel.org>
To: Hamdy Abou El Anein <info@daylightlinux.ch>
Cc: nsc@kernel.org, linux-kbuild@vger.kernel.org,
linux-kernel@vger.kernel.org, hamdy.aea@protonmail.com
Subject: Re: [PATCH v3] scripts: check-function-names: propagate nm failures
Date: Wed, 4 Nov 2026 16:26:16 -0700 [thread overview]
Message-ID: <20261104232616.GB3581619@ax162> (raw)
In-Reply-To: <20261104120733.7633-1-info@daylightlinux.ch>
Hi Hamdy,
On Wed, Nov 04, 2026 at 01:07:33PM +0100, Hamdy Abou El Anein wrote:
> 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.
If nm fails because vmlinux.o is malformed, surely that means that $(LD)
is going to choke on it too? This feels like unnecessary complication
and hardening for little gain. Were you able to reproduce a situation
where $(NM) failed but the rest of the build succeeded?
> 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.
Just a work of advice for the future, avoid mentioning revisions within
the commit message, they won't make sense once the patch is applied.
Place differential notes below the '---' after your signoff and make
sure the commit message makes sense on its own.
> 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
>
--
Cheers,
Nathan
next prev parent reply other threads:[~2026-11-04 23:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 10:58 [PATCH] scripts: check-function-names: propagate nm failures Hamdy Abou El Anein
2026-11-04 10:58 ` sashiko-bot
2026-11-04 12:03 ` [PATCH v2] " Hamdy Abou El Anein
2026-11-04 12:07 ` [PATCH v3] " Hamdy Abou El Anein
2026-11-04 23:26 ` Nathan Chancellor [this message]
2026-11-05 13:02 ` Hamdy Abou El Anein
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=20261104232616.GB3581619@ax162 \
--to=nathan@kernel.org \
--cc=hamdy.aea@protonmail.com \
--cc=info@daylightlinux.ch \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nsc@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.