Re: [PATCH 39/48] objtool: Replace iterator callbacks with for_each_sym_by_*()

Song Liu
2026-04-25T00:04:20Z

On Wed, Apr 22, 2026 at 9:04 PM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
>
> Convert the callback-based iterate_sym_by_name() and
> iterate_sym_by_demangled_name() callers to use new
> for_each_sym_by[_demangled]_name() macros. This eliminates the callback
> structs and functions and makes the code more compact and readable.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> ---
> tools/objtool/elf.c | 80 ++++++-----------------------
> tools/objtool/include/objtool/elf.h | 40 ++++++++++++---
> tools/objtool/klp-checksum.c | 20 +++-----
> tools/objtool/klp-diff.c | 42 +++++----------
> 4 files changed, 73 insertions(+), 109 deletions(-)

Macros are indeed cleaner. But Sashiko has a valid point on this. [1].

Thanks,
Song

[1] https://sashiko.dev/#/patchset/cover.1776916871.git.jpoimboe%40kernel.org?part=39