[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5daj7e2fvojknehmb4phdnyg63e5oma27jlihq6b5xypgnccwt@kmc4no5gza72>
Date: Wed, 11 Jun 2025 12:25:48 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Alexandre Chartre <alexandre.chartre@...cle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, linux-kernel@...r.kernel.org,
mingo@...nel.org
Subject: Re: [RFC 03/13] objtool: Disassemble code with libopcodes instead of
running objdump
On Wed, Jun 11, 2025 at 03:35:38PM +0200, Alexandre Chartre wrote:
>
> On 6/11/25 14:23, Peter Zijlstra wrote:
> > On Fri, Jun 06, 2025 at 05:34:30PM +0200, Alexandre Chartre wrote:
> > > objtool executes the objdump command to disassemble code. Use libopcodes
> > > instead to have more control about the disassembly scope and output.
> > >
> > > Signed-off-by: Alexandre Chartre <alexandre.chartre@...cle.com>
> > > ---
> > > tools/objtool/Makefile | 2 +-
> > > tools/objtool/arch/loongarch/decode.c | 6 +
> > > tools/objtool/arch/powerpc/decode.c | 6 +
> > > tools/objtool/arch/x86/decode.c | 7 +
> > > tools/objtool/check.c | 4 +-
> > > tools/objtool/disas.c | 186 +++++++++++++++---------
> > > tools/objtool/include/objtool/arch.h | 5 +
> > > tools/objtool/include/objtool/check.h | 5 +
> > > tools/objtool/include/objtool/objtool.h | 4 +
> > > 9 files changed, 154 insertions(+), 71 deletions(-)
> > >
> > > diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
> > > index 8c20361dd100..00350fc7c662 100644
> > > --- a/tools/objtool/Makefile
> > > +++ b/tools/objtool/Makefile
> > > @@ -34,7 +34,7 @@ INCLUDES := -I$(srctree)/tools/include \
> > > # is passed here to match a legacy behavior.
> > > WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed -Wno-nested-externs
> > > OBJTOOL_CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS)
> > > -OBJTOOL_LDFLAGS := $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)
> > > +OBJTOOL_LDFLAGS := $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) -lopcodes
> >
> > Would it be possible to make this optional? Such that when people do not
> > have libopcodes installed they can still build the kernel.
> >
> > Or is libopcodes a mandatory part of any binutils installation?
>
> I guess that libopcodes is mandatory because it is used by as (and also objdump).
> But I can check if it is effectively present anyway.
libopcodes should always be present, but compiling/linking against it
shouldn't be possible unless a binutils devel pkg is installed.
So I think Peter's basically asking for what I asked for: make all this
optional depending on whether the binutils devel pkg is installed, and
print a helpful error message if somebody tries to use without.
--
Josh
Powered by blists - more mailing lists