Re: [PATCH v2 5/7] objtool/klp: Fix cross-module klp relocation section naming
From: Song Liu
Date: Wed Aug 05 2026 - 18:24:13 EST
On Wed, Aug 5, 2026 at 7:30 AM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> A klp relocation section is .klp.rela.<objname>.<secname>, where objname
> is the object being patched.
>
> klp-build wrongly derives objname from where the referenced symbol
> lives, not where it's referenced. For a cross-module reference like
> patched can_isotp code calling can.ko's can_rx_unregister(), that gives
> .klp.rela.can..text rather than .klp.rela.can_isotp..text. Unless the
> patch happens to patch can.ko as well, the relocation never gets applied
> and the call goes off into the weeds.
>
> Name the intermediate section __klp_relocs.<objname> so post-link can
> read the patched object's name from there.
>
> Fixes: dd590d4d57eb ("objtool/klp: Introduce klp diff subcommand for diffing object files")
> Reported-by: Joe Lawrence <joe.lawrence@xxxxxxxxxx>
> Link: https://lore.kernel.org/20260720145658.1103243-2-joe.lawrence@xxxxxxxxxx
> Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
Acked-by: Song Liu <song@xxxxxxxxxx>