Re: [PATCH] objtool: Deal with relative jump tables correctly

From: Josh Poimboeuf
Date: Thu Oct 10 2024 - 01:21:09 EST


On Wed, Oct 09, 2024 at 10:16:52PM -0700, Josh Poimboeuf wrote:
> > And has there been any movement on compiler annotations?
> > If this is worth while, it is something I could look into: Kees and I
> > work very closely with both the GCC and the Clang folks, and have
> > contributed other features that are specific to the kernel.
>
> I spoke with several people about this at GNU Cauldron last month and
> there is definitely interest in helping out. If you and Kees also want
> to help out, that would be awesome.
>
> Jan proposed an idea to apply a R_*_NONE relocation at the indirect
> branch instruction which references the jump table address. And then
> emit a sized ELF symbol for each jump table entry. That would be all we
> need.

While we're on the subject of objtool pain points, there's also the need
to have some kind of annotation for noreturn functions. One suggestion
has been a GCC plugin (which could in theory also work for jump tables).

--
Josh