Skip to content

Commit e20ab7d

Browse files
seehearfeeljpoimboe
authored andcommitted
LoongArch: Enable jump table for objtool
For now, it is time to remove -fno-jump-tables to enable jump table for objtool if the compiler has -mannotate-tablejump, otherwise it is better to remain -fno-jump-tables to keep compatibility with older compilers. Signed-off-by: Tiezhu Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Huacai Chen <[email protected]> Signed-off-by: Josh Poimboeuf <[email protected]>
1 parent 88cbb46 commit e20ab7d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

arch/loongarch/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ config AS_HAS_LBT_EXTENSION
291291
config AS_HAS_LVZ_EXTENSION
292292
def_bool $(as-instr,hvcl 0)
293293

294+
config CC_HAS_ANNOTATE_TABLEJUMP
295+
def_bool $(cc-option,-mannotate-tablejump)
296+
294297
menu "Kernel type and options"
295298

296299
source "kernel/Kconfig.hz"

arch/loongarch/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ KBUILD_AFLAGS += $(call cc-option,-mthin-add-sub) $(call cc-option,-Wa$(comma)
101101
KBUILD_CFLAGS += $(call cc-option,-mthin-add-sub) $(call cc-option,-Wa$(comma)-mthin-add-sub)
102102

103103
ifdef CONFIG_OBJTOOL
104-
KBUILD_CFLAGS += -fno-jump-tables
104+
ifdef CONFIG_CC_HAS_ANNOTATE_TABLEJUMP
105+
KBUILD_CFLAGS += -mannotate-tablejump
106+
else
107+
KBUILD_CFLAGS += -fno-jump-tables # keep compatibility with older compilers
108+
endif
105109
endif
106110

107111
KBUILD_RUSTFLAGS += --target=loongarch64-unknown-none-softfloat -Ccode-model=small

0 commit comments

Comments
 (0)