Skip to content

Commit 59bfa64

Browse files
achartrePeter Zijlstra
authored andcommitted
objtool: Build with disassembly can fail when including bdf.h
Building objtool with disassembly support can fail when including the bdf.h file: 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 | ^~~~~ This check is present in the bfd.h file generated from the binutils source code, but it is not necessarily present in the bfd.h file provided in a binutil package (for example, it is not present in the binutil RPM). The solution to this issue is to define the PACKAGE macro before including bfd.h. This is the solution suggested by the binutil developer in bug 14243, and it is used by other kernel tools which also use bfd.h (perf and bpf). Fixes: 5995330 ("objtool: Disassemble code with libopcodes instead of running objdump") Closes: https://lore.kernel.org/all/3fa261fd-3b46-4cbe-b48d-7503aabc96cb@oracle.com/ Reported-by: Nathan Chancellor <nathan@kernel.org> Suggested-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://sourceware.org/bugzilla/show_bug.cgi?id=14243 Link: https://patch.msgid.link/20251126134519.1760889-1-alexandre.chartre@oracle.com
1 parent c0a6790 commit 59bfa64

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools/objtool/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ BUILD_DISAS := n
8787

8888
ifeq ($(feature-libbfd),1)
8989
BUILD_DISAS := y
90-
OBJTOOL_CFLAGS += -DDISAS
90+
OBJTOOL_CFLAGS += -DDISAS -DPACKAGE="objtool"
9191
OBJTOOL_LDFLAGS += -lopcodes
9292
endif
9393

0 commit comments

Comments
 (0)