]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
LoongArch: Enable jump table for objtool
authorTiezhu Yang <yangtiezhu@loongson.cn>
Tue, 17 Dec 2024 01:09:03 +0000 (09:09 +0800)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Wed, 12 Mar 2025 22:43:39 +0000 (15:43 -0700)
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 <yangtiezhu@loongson.cn>
Link: https://lore.kernel.org/r/20241217010905.13054-8-yangtiezhu@loongson.cn
Acked-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
arch/loongarch/Kconfig
arch/loongarch/Makefile

index 2b8bd27a852fee1f4418c7b28133a85060bea26a..15aaa2e6757e7d0377f9d5ffb7596d722fe1ceb0 100644 (file)
@@ -291,6 +291,9 @@ config AS_HAS_LBT_EXTENSION
 config AS_HAS_LVZ_EXTENSION
        def_bool $(as-instr,hvcl 0)
 
+config CC_HAS_ANNOTATE_TABLEJUMP
+       def_bool $(cc-option,-mannotate-tablejump)
+
 menu "Kernel type and options"
 
 source "kernel/Kconfig.hz"
index 567bd122a9ee4769638f6a076e9284148a196e1d..0304eabbe60661570bf8f0787acec9ab1113618a 100644 (file)
@@ -101,7 +101,11 @@ KBUILD_AFLAGS                      += $(call cc-option,-mthin-add-sub) $(call cc-option,-Wa$(comma)
 KBUILD_CFLAGS                  += $(call cc-option,-mthin-add-sub) $(call cc-option,-Wa$(comma)-mthin-add-sub)
 
 ifdef CONFIG_OBJTOOL
-KBUILD_CFLAGS                  += -fno-jump-tables
+ifdef CONFIG_CC_HAS_ANNOTATE_TABLEJUMP
+KBUILD_CFLAGS                  += -mannotate-tablejump
+else
+KBUILD_CFLAGS                  += -fno-jump-tables # keep compatibility with older compilers
+endif
 endif
 
 KBUILD_RUSTFLAGS               += --target=loongarch64-unknown-none-softfloat -Ccode-model=small