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

From: Josh Poimboeuf
Date: Thu Oct 10 2024 - 16:15:40 EST


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.

> + switch (text_reloc->sym->type) {
> + case STT_OBJECT:
> + sym = text_reloc->sym;
> + break;
> + case STT_SECTION:
^
extra whitespace

--
Josh