Re: [PATCH v2 3/5] objtool: Add support for annotated jump tables

From: Ard Biesheuvel
Date: Fri Oct 11 2024 - 02:30:08 EST


On Thu, 10 Oct 2024 at 22:15, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> On Thu, Oct 10, 2024 at 02:28:05PM +0200, Ard Biesheuvel wrote:
> > +++ b/tools/objtool/arch/x86/special.c
> > @@ -115,30 +115,51 @@ struct reloc *arch_find_switch_table(struct objtool_file *file,
> > struct reloc *text_reloc, *rodata_reloc;
> > struct section *table_sec;
> > unsigned long table_offset;
> > + struct symbol *sym;
> >
> > /* look for a relocation which references .rodata */
> > text_reloc = find_reloc_by_dest_range(file->elf, insn->sec,
> > insn->offset, insn->len);
>
> Hm, we can probably put insn_reloc() in check.h and use that here to
> take advantage of its caching for the no_reloc case.
>

insn_reloc() filters out R_*_NONE relocations, for the reasons pointed
out in the commit log.