mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Miroslav Benes <mbenes@suse.cz>
Subject: Re: [PATCH 02/18] objtool: Support data symbol printing
Date: Thu, 14 Apr 2022 18:36:51 +0200	[thread overview]
Message-ID: <YlhNo026PgjJuCIU@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20220414153854.rqkt465xn4vzndr7@treble>

On Thu, Apr 14, 2022 at 08:38:54AM -0700, Josh Poimboeuf wrote:

> > Yes, I'd not seen that yet, what's that for? The Changelog alludes to
> > something, but I don't think it actually does get used later.
> 
> Nick had asked for something like that, it's just a way to avoid doing
> math every time we look at a warning, i.e. to convert func+offset to
> sec+offset.
> 
> But it's kind of ugly and I'm not 100% happy with it.
> 
> Maybe it should be behind an option (--sec-offsets)?

Can do I suppose... Myself, I have this script:

$ cat objdump-func.sh
#!/bin/bash

OBJ=$1; shift
FUNC=$1; shift

objdump -wdr $@ $OBJ | awk "/^\$/ { P=0; } /$FUNC[^>]*>:\$/ { P=1; O=strtonum(\"0x\" \$1); } { if (P) { o=strtonum(\"0x\" \$1); printf(\"%04x \", o-O); print \$0; } }"

That prints a symbol relative offset next to the section, something
like:

$ ./objdump-func.sh defconfig-build/vmlinux.o pick_next_task_idle
0000 00000000000a9eb0 <pick_next_task_idle>:
0000    a9eb0:  41 54                   push   %r12
0002    a9eb2:  4c 8b a7 28 09 00 00    mov    0x928(%rdi),%r12
0009    a9eb9:  53                      push   %rbx
000a    a9eba:  48 89 fb                mov    %rdi,%rbx
000d    a9ebd:  66 90                   xchg   %ax,%ax
000f    a9ebf:  66 90                   xchg   %ax,%ax
0011    a9ec1:  4c 89 e0                mov    %r12,%rax
0014    a9ec4:  5b                      pop    %rbx
0015    a9ec5:  41 5c                   pop    %r12
0017    a9ec7:  c3                      ret    
0018    a9ec8:  e8 00 00 00 00          call   a9ecd <pick_next_task_idle+0x1d> a9ec9: R_X86_64_PLT32   __update_idle_core-0x4
001d    a9ecd:  eb f0                   jmp    a9ebf <pick_next_task_idle+0xf>
001f    a9ecf:  4c 89 e0                mov    %r12,%rax
0022    a9ed2:  83 83 b8 0b 00 00 01    addl   $0x1,0xbb8(%rbx)
0029    a9ed9:  5b                      pop    %rbx
002a    a9eda:  41 5c                   pop    %r12
002c    a9edc:  c3                      ret    
002d    a9edd:  0f 1f 00                nopl   (%rax)


  reply	other threads:[~2022-04-14 17:00 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13 23:19 [PATCH 00/18] objtool: Interface overhaul Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 01/18] objtool: Enable unreachable warnings for CLANG LTO Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 02/18] objtool: Support data symbol printing Josh Poimboeuf
2022-04-14  7:05   ` Peter Zijlstra
2022-04-14 15:21     ` Josh Poimboeuf
2022-04-14 15:31       ` Peter Zijlstra
2022-04-14 15:38         ` Josh Poimboeuf
2022-04-14 16:36           ` Peter Zijlstra [this message]
2022-04-14 17:01             ` Josh Poimboeuf
2022-04-14 17:21               ` Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 03/18] objtool: Add sec+offset to warnings Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 04/18] objtool: Print data address for "!ENDBR" data warnings Josh Poimboeuf
2022-04-14  7:36   ` Peter Zijlstra
2022-04-13 23:19 ` [PATCH 05/18] objtool: Use offstr() to print address of missing ENDBR Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 06/18] libsubcmd: Fix OPTION_GROUP sorting Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 07/18] objtool: Reorganize cmdline options Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 08/18] objtool: Ditch subcommands Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 09/18] objtool: Add stack validation cmdline option Josh Poimboeuf
2022-04-14  8:43   ` Peter Zijlstra
2022-04-14 15:52     ` Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 10/18] objtool: Extricate ibt from stack validation Josh Poimboeuf
2022-04-14  7:53   ` Peter Zijlstra
2022-04-14 15:44     ` Josh Poimboeuf
2022-04-14 16:38       ` Peter Zijlstra
2022-04-14 17:05         ` Josh Poimboeuf
2022-04-14 18:25           ` Josh Poimboeuf
2022-04-14 19:01             ` Peter Zijlstra
2022-04-14 19:07               ` Josh Poimboeuf
2022-04-14 18:49           ` Peter Zijlstra
2022-04-13 23:19 ` [PATCH 11/18] objtool: Add CONFIG_OBJTOOL Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 12/18] objtool: Make stack validation frame-pointer-specific Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 13/18] objtool: Add static call cmdline option Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 14/18] objtool: Add toolchain hacks " Josh Poimboeuf
2022-04-14  8:09   ` Peter Zijlstra
2022-04-14 15:49     ` Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 15/18] objtool: Rename "VMLINUX_VALIDATION" -> "NOINSTR_VALIDATION" Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 16/18] objtool: Add HAVE_NOINSTR_VALIDATION Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 17/18] objtool: Remove --lto and --vmlinux Josh Poimboeuf
2022-04-14  8:13   ` Peter Zijlstra
2022-04-15  2:18     ` Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 18/18] objtool: Update documentation Josh Poimboeuf

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=YlhNo026PgjJuCIU@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=x86@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 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®