Re: [PATCH v6 03/30] objtool: Disassemble code with libopcodes instead of running objdump
From: Alexandre Chartre
Date: Tue Dec 09 2025 - 02:54:21 EST
On 12/9/25 07:58, Guenter Roeck wrote:
Hi,
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@xxxxxxxxxx>
With this patch in mainline, I get the following build error when trying
to build x86_64:defconfig (and other configurations).
Bisect log is attached. I see the problem with gcc 11.4.0, 13.3.0, and
14.3.0. I tried with both Ubuntu 22.04 and 24.04.
This sounds like a configuration issue depending on the binutils version; in
particular the setting of DISASM_INIT_STYLED (although that's supposed to be
automatically configured by tools/objtool/Makefile).
Which binutils-devel version are you using?
Thanks,
alex.
Building x86_64:defconfig ... failed
--------------
Error log:
In file included from disas.c:17:
tools/include/tools/dis-asm-compat.h:19:39: error: ‘enum disassembler_style’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
19 | enum disassembler_style style,
| ^~~~~~~~~~~~~~~~~~
tools/include/tools/dis-asm-compat.h:19:58: error: parameter 2 (‘style’) has incomplete type
19 | enum disassembler_style style,
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
tools/include/tools/dis-asm-compat.h:42:49: error: unknown type name ‘fprintf_styled_ftype’; did you mean ‘fprintf_ftype’?
42 | fprintf_styled_ftype styled_func)
| ^~~~~~~~~~~~~~~~~~~~
| fprintf_ftype
disas.c:152:38: error: ‘enum disassembler_style’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
152 | enum disassembler_style style,
| ^~~~~~~~~~~~~~~~~~
disas.c:152:57: error: parameter 2 (‘style’) has incomplete type
152 | enum disassembler_style style,
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
disas.c: In function ‘disas_context_create’:
disas.c:367:9: error: implicit declaration of function ‘init_disassemble_info_compat’; did you mean ‘init_disassemble_info’? [-Werror=implicit-function-declaration]
367 | init_disassemble_info_compat(dinfo, dctx,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| init_disassemble_info
In file included from tools/include/linux/kernel.h:5,
from tools/include/linux/list.h:7,
from tools/objtool/include/objtool/arch.h:10,
from disas.c:9:
disas.c: In function ‘disas_fprintf_styled’:
disas.c:158:9: error: ‘va_start’ used in function with fixed arguments
158 | va_start(arg, fmt);
| ^~~~~~~~
cc1: all warnings being treated as errors
---
Bisect:
# bad: [cb015814f8b6eebcbb8e46e111d108892c5e6821] Merge tag 'f2fs-for-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs
# good: [7d0a66e4bb9081d75c82ec4957c50034cb0ea449] Linux 6.18
git bisect start 'HEAD' 'v6.18'
# bad: [6dfafbd0299a60bfb5d5e277fdf100037c7ded07] Merge tag 'drm-next-2025-12-03' of https://gitlab.freedesktop.org/drm/kernel
git bisect bad 6dfafbd0299a60bfb5d5e277fdf100037c7ded07
# bad: [8f7aa3d3c7323f4ca2768a9e74ebbe359c4f8f88] Merge tag 'net-next-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
git bisect bad 8f7aa3d3c7323f4ca2768a9e74ebbe359c4f8f88
# bad: [4a4e0199378f309fa7259132e1443efe56c1e276] Merge tag 'lkmm.2025.12.01a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu
git bisect bad 4a4e0199378f309fa7259132e1443efe56c1e276
# bad: [a61288200e8b6f42bff116508dc72ebcc206f10a] Merge tag 'ras_core_for_v6.19_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect bad a61288200e8b6f42bff116508dc72ebcc206f10a
# good: [1b5dd29869b1e63f7e5c37d7552e2dcf22de3c26] Merge tag 'vfs-6.19-rc1.fd_prepare.fs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
git bisect good 1b5dd29869b1e63f7e5c37d7552e2dcf22de3c26
# bad: [dcd8637edb873bd940e6aa82417dfb33ae980778] Merge tag 'x86-core-2025-12-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect bad dcd8637edb873bd940e6aa82417dfb33ae980778
# bad: [7e017720aae87dc2ca2471ac295e34e2b240e5f5] objtool: Disassemble jump table alternatives
git bisect bad 7e017720aae87dc2ca2471ac295e34e2b240e5f5
# good: [164c9201e1dad8d5c0c38f583dba81e4b6da9cc7] objtool: Add base objtool support for livepatch modules
git bisect good 164c9201e1dad8d5c0c38f583dba81e4b6da9cc7
# good: [9205a322cf96f16a49e412dfa3f09431f3e02fc5] objtool: Return canonical symbol when aliases exist in symbol finding helpers
git bisect good 9205a322cf96f16a49e412dfa3f09431f3e02fc5
# bad: [0bb080ba6469a573bc85122153d931334d10a173] objtool: Disassemble instruction on warning or backtrace
git bisect bad 0bb080ba6469a573bc85122153d931334d10a173
# good: [93863f3f859a626347ce2ec18947b11357b4ca14] kbuild: Check for functions with ambiguous -ffunction-sections section names
git bisect good 93863f3f859a626347ce2ec18947b11357b4ca14
# bad: [59953303827eceb06d486ba66cc0d71f55ded8ec] objtool: Disassemble code with libopcodes instead of running objdump
git bisect bad 59953303827eceb06d486ba66cc0d71f55ded8ec
# good: [55d2a473f317ab028d78a5c5ca69473643657c3d] objtool: Move disassembly functions to a separated file
git bisect good 55d2a473f317ab028d78a5c5ca69473643657c3d
# good: [1013f2e37bec39b1df5679e1c1e2572ece87c088] objtool: Create disassembly context
git bisect good 1013f2e37bec39b1df5679e1c1e2572ece87c088
# first bad commit: [59953303827eceb06d486ba66cc0d71f55ded8ec] objtool: Disassemble code with libopcodes instead of running objdump