Re: [RFC PATCH 0/4] Add jump table support for objtool on LoongArch

From: Jinyang He
Date: Fri Jul 12 2024 - 06:19:48 EST


Are we always avoid our problems?

1, When text section not support "R_LARCH_32_PCREL", update compiler
   to add AS_HAS_THIN_ADD_SUB.
2, When not support jump-table, use "-fno-jump-tables" to avoid it,
   (and now update compiler to add CC_HAS_ANNOTATE_TABLEJUMP).
3, When not support relax, use "-mno-relax" to avoid it.
4, When some where in asm can be backtraced but generate warning,
   use STACK_FRAME_NON_STANDARD to avoid it.
5, When the goto-table cannot be handled (I guess the Ruoyao's
   patch cannot handle goto table), use CONFIG_BPF_JIT_ALWAYS_ON
   to avoid compile ___bpf_prog_run.
6, And other $fp warnings not be solved in clang. Do we only care gcc?

So how to do in the future if compilers have other changed? Do we
need update compilers (both gcc and clang) again and again? Why
not just update objtool codes to solves these problems? As many
RISC arch not support directly find jump table, can we support
more generic ways to find it?


On 2024-07-12 17:15, Tiezhu Yang wrote:
This RFC version is based on Linux 6.10-rc7, there are no detailed
commit messages for each patch for now and the code are relatively
clear and simple.

This series is tested with the latest upstream gcc applied with patch
"LoongArch: Add support to annotate tablejump" [1] which adds a new
section discard.tablejump_annotate to record the jump info, it makes
life much easier, special thanks to Ruoyao.

I will address all the review comments and update the commit messages
after the merge window.

[1] https://inbox.sourceware.org/gcc-patches/20240711114415.4420-1-xry111@xxxxxxxxxxx/

Tiezhu Yang (4):
objtool: Check local label in find_jump_table()
objtool: Check various types in add_jump_table()
objtool/LoongArch: Add support for jump table
LoongArch: Remove -fno-jump-tables for objtool

arch/loongarch/Kconfig | 8 +++-
arch/loongarch/Makefile | 6 +--
tools/objtool/arch/loongarch/special.c | 54 +++++++++++++++++++++++++-
tools/objtool/check.c | 36 +++++++++++++++--
4 files changed, 94 insertions(+), 10 deletions(-)