On Wed, Apr 22, 2026 at 9:05 PM Josh Poimboeuf <[email protected]> wrote:
>
> When a section is empty (e.g. only zero-length alternative
> replacements), there are no symbols to convert a section symbol
> reference to.  Skip the reloc instead of erroring out.
>
> Fixes: dd590d4d57eb ("objtool/klp: Introduce klp diff subcommand for diffing 
> object files")
> Signed-off-by: Josh Poimboeuf <[email protected]>

Acked-by: Song Liu <[email protected]>

With a nitpick below:

[...]

> @@ -1293,12 +1301,15 @@ static int clone_sym_relocs(struct elfs *e, struct 
> symbol *patched_sym)
>                     !strcmp(patched_reloc->sym->sec->name, ".altinstr_aux"))
>                         continue;
>
> -               if (convert_reloc_sym(e->patched, patched_reloc)) {
> +               ret = convert_reloc_sym(e->patched, patched_reloc);
> +               if (ret < 0) {
>                         ERROR_FUNC(patched_rsec->base, 
> reloc_offset(patched_reloc),
>                                    "failed to convert reloc sym '%s' to its 
> proper format",
>                                    patched_reloc->sym->name);
>                         return -1;
>                 }
> +               if (ret > 0)
> +                       continue;

Functions that return -1, 0, 1 are usually more confusing. Shall we add more
comments for convert_reloc_sym()?

Thanks,
Song

Reply via email to