| Date | Tue, 25 Nov 2025 11:16:04 -0700 | | From | Nathan Chancellor <> | | Subject | Re: [PATCH v6 03/30] objtool: Disassemble code with libopcodes instead of running objdump |
| |
Hi Alexandre,
On Fri, Nov 21, 2025 at 10:53:13AM +0100, Alexandre Chartre wrote: > objtool executes the objdump command to disassemble code. Use libopcodes > instead to have more control about the disassembly scope and output. > If libopcodes is not present then objtool is built without disassembly > support. > > Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com> ... > diff --git a/tools/objtool/include/objtool/arch.h b/tools/objtool/include/objtool/arch.h > index d89f8b5ec14e3..18c0e69ee6170 100644 > --- a/tools/objtool/include/objtool/arch.h > +++ b/tools/objtool/include/objtool/arch.h > @@ -103,4 +103,13 @@ bool arch_absolute_reloc(struct elf *elf, struct reloc *reloc); > unsigned int arch_reloc_size(struct reloc *reloc); > unsigned long arch_jump_table_sym_offset(struct reloc *reloc, struct reloc *table); > > +#ifdef DISAS > + > +#include <bfd.h>
This include of bfd.h breaks the build for me:
$ make -skj"$(nproc)" ARCH=x86_64 CROSS_COMPILE=x86_64-linux- clean defconfig bzImage In file included from tools/objtool/include/objtool/arch.h:108, from check.c:14: /usr/include/bfd.h:35:2: error: #error config.h must be included before this header 35 | #error config.h must be included before this header | ^~~~~ ...
where my bfd.h has:
#ifndef __BFD_H_SEEN__ #define __BFD_H_SEEN__
/* PR 14072: Ensure that config.h is included first. */ #if !defined PACKAGE && !defined PACKAGE_VERSION #error config.h must be included before this header #endif
Something like this cures it for me but I am not sure if that is a proper fix or not since I see config.h in my binutils build folder has many other defines.
Cheers, Nathan
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index df793ca6fc1a..96df4a73da23 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -87,7 +87,7 @@ BUILD_DISAS := n ifeq ($(feature-libbfd),1) BUILD_DISAS := y - OBJTOOL_CFLAGS += -DDISAS + OBJTOOL_CFLAGS += -DDISAS -DPACKAGE="objtool-disas" OBJTOOL_LDFLAGS += -lopcodes endif
|