linux/tools/objtool
Ulises Mendez Martinez 7e61560628 objtool: Validate disassembler headers in libopcodes probe
commit 3f2de814c0 ("objtool: Fix libopcodes linking with static libraries")
tested for libopcodes availability by linking a test snippet with a forward
declaration of disassemble_init_for_target().

However, testing symbol linkage with an extern declaration only verifies
the presence of the library (.so/.a) and bypasses checking for development
headers (binutils-dev). On systems where libopcodes is present without
development headers installed, the probe succeeds, enabling BUILD_DISAS.
Subsequent compilation of objtool then fails:

  fatal error: 'bfd.h' file not found
    113 | #include <bfd.h>

Additionally, the probe invokes $(HOSTCC) without $(HOSTCFLAGS), ignoring
any sysroot or include flags specified for the host compiler.

Fix this by including <bfd.h> and <dis-asm.h> directly in the test snippet,
passing $(HOSTCFLAGS) so host compiler options are respected, and defining
PACKAGE="objtool" to satisfy the configuration check in <bfd.h>.

Fixes: 3f2de814c0 ("objtool: Fix libopcodes linking with static libraries")
Fixes: 436326bc52 ("objtool: fix build failure due to missing libopcodes check")
Reported-by: Alice Ryhl <aliceryhl@google.com>
Assisted-by: Antigravity:Gemini-Next
Signed-off-by: Ulises Mendez Martinez <umendez@google.com>
Link: https://patch.msgid.link/20260904150710.2997558-1-umendez@google.com
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
2026-09-13 18:15:43 -07:00
..
arch objtool/klp: Ignore replacement offset of empty x86 alternatives 2026-08-11 15:04:57 -07:00
Documentation Revert "objtool: Warn on functions with ambiguous -ffunction-sections section names" 2025-11-21 10:04:10 +01:00
include/objtool objtool/klp: Fix vmlinux klp relocations for EXPORT_SYMBOL_FOR_MODULES() 2026-08-17 10:53:55 +02:00
.gitignore objtool: Add Function to get the name of a CPU feature 2025-11-24 20:39:47 +01:00
Build objtool/klp: Fix symbol resolution for duplicate data symbols 2026-08-03 07:12:39 +02:00
builtin-check.c objtool/klp: Add .klp.symid for sympos disambiguation 2026-08-03 07:12:39 +02:00
builtin-klp.c objtool/klp: Add "objtool klp checksum" subcommand 2026-05-04 21:16:05 -07:00
check.c Rust fixes for v7.3 2026-08-30 09:47:39 -07:00
disas.c objtool: Add insn_sym() helper 2026-05-04 21:16:06 -07:00
elf.c objtool/klp: Fix false module dependencies caused by dead relocs 2026-08-03 07:12:38 +02:00
klp-checksum.c objtool/klp: Fix checksums for constant pool references 2026-08-31 17:50:16 -07:00
klp-diff.c - Remove the smp_locks alternatives machinery which was used to patch out lock 2026-08-18 18:11:25 -07:00
klp-post-link.c objtool/klp: Fix cross-module klp relocation section naming 2026-08-11 16:10:51 -07:00
klp-symid.c objtool/klp: Fix vmlinux .klp.symid link error for .exitcall.exit symbols 2026-08-12 13:33:32 -07:00
klp-sympos.c objtool/klp: Explicitly disallow patching or referencing init code/data 2026-08-11 16:10:38 -07:00
Makefile objtool: Validate disassembler headers in libopcodes probe 2026-09-13 18:15:43 -07:00
noreturns.h efi/runtime-wrappers: factor out efi_rts_park_worker() 2026-08-20 14:45:04 +03:00
objtool.c objtool/klp: Add correlation debugging output 2026-05-04 21:16:06 -07:00
orc_dump.c objtool: Add annotype() helper 2025-10-14 14:46:49 -07:00
orc_gen.c objtool: Add annotype() helper 2025-10-14 14:46:49 -07:00
signal.c objtool: Add more robust signal error handling, detect and warn about stack overflows 2025-12-03 19:42:37 +01:00
special.c objtool: Provide access to feature and flags of group alternatives 2025-11-21 15:30:14 +01:00
sync-check.sh objtool/klp: Introduce klp diff subcommand for diffing object files 2025-10-14 14:50:18 -07:00
trace.c objtool: Add insn_sym() helper 2026-05-04 21:16:06 -07:00
weak.c objtool/klp: Introduce klp diff subcommand for diffing object files 2025-10-14 14:50:18 -07:00