mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scripts/checkstack.pl: support llvm-objdump disassembly for x86
@ 2026-09-02 21:01 Nick Desaulniers
  2026-09-03  0:51 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Desaulniers @ 2026-09-02 21:01 UTC (permalink / raw)
  To: Andrew Morton, Nathan Chancellor
  Cc: Bill Wendling, Justin Stitt, linux-kernel, llvm, Nick Desaulniers

When running `make LLVM=1 checkstack`, OBJDUMP is set to llvm-objdump.
llvm-objdump outputs disassembly with instruction size suffixes (such as
subq/addq/subl/addl), tabs/whitespace differences, spaces after commas,
and trailing comments (e.g. `# imm = 0x...`).

Because scripts/checkstack.pl used rigid regular expressions specifically
tuned to GNU objdump format (e.g. requiring exactly four spaces, no
suffix, and no space after comma), checkstack.pl failed to match any
stack adjustment instructions and yielded no output when using
llvm-objdump on x86.

Update the regular expressions for x86 to match optional suffixes,
variable whitespace, and trailing comments.

Assisted-by: LLM Gemini
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 scripts/checkstack.pl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index 14ce31f732ee..f8011e789a9b 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -66,8 +66,10 @@ my (@stack, $re, $dre, $sub, $x, $xs, $funcre, $min_stack);
 		#c0105234:       81 ec ac 05 00 00       sub    $0x5ac,%esp
 		# or
 		#    2f60:    48 81 ec e8 05 00 00       sub    $0x5e8,%rsp
-		$re = qr/^.*[as][du][db]    \$(0x$x{1,8}),\%(e|r)sp$/o;
-		$dre = qr/^.*[as][du][db]    (%.*),\%(e|r)sp$/o;
+		# or
+		#       0: 48 81 ec e8 05 00 00          subq   $0x5e8, %rsp
+		$re = qr/^.*[as][du][db][ql]?\s+\$(0x$x{1,8}),\s*\%(e|r)sp/o;
+		$dre = qr/^.*[as][du][db][ql]?\s+(%.*),\s*\%(e|r)sp/o;
 	} elsif ($arch eq 'm68k') {
 		#    2b6c:       4e56 fb70       linkw %fp,#-1168
 		#  1df770:       defc ffe4       addaw #-28,%sp

---
base-commit: 502d45774af09f1c681c754c4b7cdfb5d7f72fd9
change-id: 20260826-checkstack_llvm_objdump-40653e1d7a6d

Best regards,
-- 
Nick Desaulniers <ndesaulniers@google.com>


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

* Re: [PATCH] scripts/checkstack.pl: support llvm-objdump disassembly for x86
  2026-09-02 21:01 [PATCH] scripts/checkstack.pl: support llvm-objdump disassembly for x86 Nick Desaulniers
@ 2026-09-03  0:51 ` Andrew Morton
  2026-09-03 16:17   ` Nick Desaulniers
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2026-09-03  0:51 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Nathan Chancellor, Bill Wendling, Justin Stitt, linux-kernel, llvm

On Wed, 02 Sep 2026 14:01:53 -0700 Nick Desaulniers <ndesaulniers@google.com> wrote:

> When running `make LLVM=1 checkstack`, OBJDUMP is set to llvm-objdump.
> llvm-objdump outputs disassembly with instruction size suffixes (such as
> subq/addq/subl/addl), tabs/whitespace differences, spaces after commas,
> and trailing comments (e.g. `# imm = 0x...`).
> 
> Because scripts/checkstack.pl used rigid regular expressions specifically
> tuned to GNU objdump format (e.g. requiring exactly four spaces, no
> suffix, and no space after comma), checkstack.pl failed to match any
> stack adjustment instructions and yielded no output when using
> llvm-objdump on x86.
> 
> Update the regular expressions for x86 to match optional suffixes,
> variable whitespace, and trailing comments.

OK, so checkstack is broken with LLVM.

Users of checkstack/LLVM in earlier kernels won't like that, so
should we backport this with cc:stable?


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

* Re: [PATCH] scripts/checkstack.pl: support llvm-objdump disassembly for x86
  2026-09-03  0:51 ` Andrew Morton
@ 2026-09-03 16:17   ` Nick Desaulniers
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Desaulniers @ 2026-09-03 16:17 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Nathan Chancellor, Bill Wendling, Justin Stitt, linux-kernel, llvm

On Wed, Sep 2, 2026 at 5:51 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Wed, 02 Sep 2026 14:01:53 -0700 Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> > When running `make LLVM=1 checkstack`, OBJDUMP is set to llvm-objdump.
> > llvm-objdump outputs disassembly with instruction size suffixes (such as
> > subq/addq/subl/addl), tabs/whitespace differences, spaces after commas,
> > and trailing comments (e.g. `# imm = 0x...`).
> >
> > Because scripts/checkstack.pl used rigid regular expressions specifically
> > tuned to GNU objdump format (e.g. requiring exactly four spaces, no
> > suffix, and no space after comma), checkstack.pl failed to match any
> > stack adjustment instructions and yielded no output when using
> > llvm-objdump on x86.
> >
> > Update the regular expressions for x86 to match optional suffixes,
> > variable whitespace, and trailing comments.
>
> OK, so checkstack is broken with LLVM.
>
> Users of checkstack/LLVM in earlier kernels won't like that, so
> should we backport this with cc:stable?
>

/me looks around

yeah, all...one of us!

I'm kidding, thanks for picking up the patch.

-- 
Thanks,
~Nick Desaulniers

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

end of thread, other threads:[~2026-09-03 16:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-02 21:01 [PATCH] scripts/checkstack.pl: support llvm-objdump disassembly for x86 Nick Desaulniers
2026-09-03  0:51 ` Andrew Morton
2026-09-03 16:17   ` Nick Desaulniers

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®