Messages in this thread | | | Date | Thu, 22 Aug 2019 15:04:15 -0500 | From | Josh Poimboeuf <> | Subject | Re: [RFC v4 08/18] objtool: Refactor switch-tables code to support other architectures |
| |
On Fri, Aug 16, 2019 at 01:23:53PM +0100, Raphael Gault wrote: > The way to identify switch-tables and retrieves all the data necessary > to handle the different execution branches is not the same on all > architecture. In order to be able to add other architecture support, > this patch defines arch-dependent functions to process jump-tables. > > Signed-off-by: Raphael Gault <raphael.gault@arm.com> > --- > tools/objtool/arch/arm64/arch_special.c | 15 ++++ > tools/objtool/arch/arm64/decode.c | 4 +- > tools/objtool/arch/x86/arch_special.c | 79 ++++++++++++++++++++ > tools/objtool/check.c | 95 +------------------------ > tools/objtool/check.h | 7 ++ > tools/objtool/special.h | 10 ++- > 6 files changed, 114 insertions(+), 96 deletions(-) > > diff --git a/tools/objtool/arch/arm64/arch_special.c b/tools/objtool/arch/arm64/arch_special.c > index a21d28876317..17a8a06aac2a 100644 > --- a/tools/objtool/arch/arm64/arch_special.c > +++ b/tools/objtool/arch/arm64/arch_special.c > @@ -20,3 +20,18 @@ void arch_force_alt_path(unsigned short feature, > struct special_alt *alt) > { > } > + > +int arch_add_jump_table(struct objtool_file *file, struct instruction *insn, > + struct rela *table, struct rela *next_table) > +{ > + return 0; > +} > + > +struct rela *arch_find_switch_table(struct objtool_file *file, > + struct rela *text_rela, > + struct section *rodata_sec, > + unsigned long table_offset) > +{ > + file->ignore_unreachables = true; > + return NULL; > +}
If this refactoring is done before adding arm64 support then you won't need intermediate hacks like this.
-- Josh
| |