Re: [PATCH v2 1/5] objtool: Deal with relative jump tables correctly
From: Josh Poimboeuf
Date: Thu Oct 10 2024 - 11:33:54 EST
On Thu, Oct 10, 2024 at 04:07:45PM +0200, Peter Zijlstra wrote:
> On Thu, Oct 10, 2024 at 03:59:43PM +0200, Ard Biesheuvel wrote:
> > On Thu, 10 Oct 2024 at 15:26, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> > >
> > > On Thu, Oct 10, 2024 at 02:28:03PM +0200, Ard Biesheuvel wrote:
> > > > diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> > > > index 3cb3e9b5ad0b..7f7981a93535 100644
> > > > --- a/tools/objtool/check.c
> > > > +++ b/tools/objtool/check.c
> > > > @@ -2101,6 +2101,8 @@ static int add_jump_table(struct objtool_file *file, struct instruction *insn,
> > > > {
> > > > struct symbol *pfunc = insn_func(insn)->pfunc;
> > > > struct reloc *table = insn_jump_table(insn);
> > > > + unsigned int rtype = reloc_type(table);
> > > > + bool pcrel = rtype == R_X86_64_PC32;
> > >
> > > R_DATA32 or R_TEXT32 please, the budding cross arch stuff has their own
> > > names for all that.
> > >
> >
> > #define R_DATA32 R_X86_64_PC32
> > #define R_DATA64 R_X86_64_PC32
> > #define R_TEXT32 R_X86_64_PC32
> > #define R_TEXT64 R_X86_64_PC32
> >
> > Clear as mud.
Yep... :-/
> >
> > I'd guess we need the '64' variant here, but I'm not sure which one to
> > use for a .rodata relocation pointing to .text. Any hints?
This should be R_TEXT64.
> Josh? do R_{DATA,TEXT}64 want to be _PC64 ?
Actually, R_{DATA,TEXT}32 should be R_386_PC32.
--
Josh