Messages in this thread | | | From | Alexei Starovoitov <> | Date | Wed, 26 Jun 2019 19:54:08 -0700 | Subject | Re: [PATCH v3 2/4] objtool: Add support for C jump tables |
| |
On Wed, Jun 26, 2019 at 7:47 PM Josh Poimboeuf <jpoimboe@redhat.com> wrote: > > On Wed, Jun 26, 2019 at 06:42:40PM -0700, Alexei Starovoitov wrote: > > > @@ -1035,9 +1038,18 @@ static struct rela *find_switch_table(struct objtool_file *file, > > > > > > /* > > > * Make sure the .rodata address isn't associated with a > > > - * symbol. gcc jump tables are anonymous data. > > > + * symbol. GCC jump tables are anonymous data. > > > + * > > > + * Also support C jump tables which are in the same format as > > > + * switch jump tables. Each jump table should be a static > > > + * local const array named "jump_table" for objtool to > > > + * recognize it. > > > > Nacked-by: Alexei Starovoitov <ast@kernel.org> > > > > It's not acceptable for objtool to dictate kernel naming convention. > > Abrasive nack notwithstanding, I agree it's not ideal. > > How about the following approach instead? This is the only other way I > can think of to annotate a jump table so that objtool can distinguish > it: > > #define __annotate_jump_table __section(".jump_table.rodata") > > Then bpf would just need the following: > > - static const void *jumptable[256] = { > + static const void __annotate_jump_table *jumptable[256] = { > > This would be less magical and fragile than my original approach. > > I think the jump table would still be placed with all the other rodata, > like before, because the vmlinux linker script recognizes the section > ".rodata" suffix and bundles them all together.
I like it if that works :) Definitely cleaner. May be a bit more linker script magic would be necessary, but hopefully not. And no need to rely on gcc style of mangling static vars.
| |