Re: [PATCH 14/48] objtool/klp: Fix extraction of text annotations for alternatives

Song Liu
2026-04-24T21:38:05Z

On Wed, Apr 22, 2026 at 9:04 PM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
>
> Objtool is failing to extract text annotations which reference
> .altinstr_replacement instructions:
>
> 1) Alternative replacement fake symbols are NOTYPE rather than FUNC,
> and they don't have sym->included set, thus they aren't recognized
> by should_keep_special_sym().
>
> 2) .discard.annotate_insn gets processed before .altinstr_replacement,
> so the referenced (fake) symbols don't have clones yet.
>
> Fix the first issue by checking for a valid clone instead of
> sym->included and by accepting NOTYPE symbols when processing
> .discard.annotate_insn.
>
> Fix the second issue by deferring text annotation processing until after
> the other special sections have been cloned.
>
> Fixes: dd590d4d57eb ("objtool/klp: Introduce klp diff subcommand for diffing object files")
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

Acked-by: Song Liu <song@kernel.org>