Re: [PATCH 14/48] objtool/klp: Fix extraction of text annotations for alternatives
From: Song Liu
Date: Fri Apr 24 2026 - 17:38:12 EST
On Wed, Apr 22, 2026 at 9:04 PM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> 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@xxxxxxxxxx>
Acked-by: Song Liu <song@xxxxxxxxxx>