]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
objtool: Fix libopcodes linking with static libraries
authorSasha Levin <sashal@kernel.org>
Wed, 21 Jan 2026 16:25:32 +0000 (11:25 -0500)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 21 Jan 2026 19:25:14 +0000 (20:25 +0100)
commit3f2de814c0597c97d5abe09a1635d8c4e2fddaf2
tree7cf6d34da96ea3e20e3fc9ea733e1356402ebd60
parent24d479d26b25bce5faea3ddd9fa8f3a6c3129ea7
objtool: Fix libopcodes linking with static libraries

Commit 436326bc525d ("objtool: fix build failure due to missing libopcodes
check") tests for libopcodes using an empty main(), which passes even when
static libraries lack their dependencies. This causes undefined reference
errors (xmalloc, bfd_get_bits, etc.) when linking against static libopcodes
without its required libbfd and libiberty.

Fix by testing with an actual libopcodes symbol and trying increasingly
complete library combinations until one succeeds.

Fixes: 436326bc525d ("objtool: fix build failure due to missing libopcodes check")
Reported-by: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
Link: https://patch.msgid.link/20260121162532.1596238-1-sashal@kernel.org
tools/objtool/Makefile