Re: [PATCH 02/18] objtool: Support data symbol printing

From: Josh Poimboeuf
Date: Thu Apr 14 2022 - 13:22:10 EST


On Thu, Apr 14, 2022 at 10:01:04AM -0700, Josh Poimboeuf wrote:
> On Thu, Apr 14, 2022 at 06:36:51PM +0200, Peter Zijlstra wrote:
> > 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 is nice, just added to my ~/bin.
>
> And how am I just learning about objdump "-w" ?!?!
>
> I wrote up a new version of that patch which adds a '--sec-address'
> option (see below), but maybe I'll just drop it for now. It's not
> really relevant to this set anyway.

But now, testing the IBT code, I realize it would still be helpful for
data addresses. So maybe I'll keep it.

--
Josh