Re: [PATCH v2 3/5] objtool: Add support for annotated jump tables
From: Josh Poimboeuf
Date: Fri Oct 11 2024 - 11:57:07 EST
On Fri, Oct 11, 2024 at 08:29:48AM +0200, Ard Biesheuvel wrote:
> 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.
True, unless this becomes the fallback code for the generic "no
annotations" case as I suggested elsewhere.
Regardless we should be sure to write and read insn->no_reloc where we
can to minimize duplicate reloc lookups.
--
Josh