summaryrefslogtreecommitdiff
path: root/arch/loongarch/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'arch/loongarch/Makefile')
-rw-r--r--arch/loongarch/Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index b0703a4e02a2..a3a9759414f4 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -102,7 +102,13 @@ KBUILD_CFLAGS += $(call cc-option,-mthin-add-sub) $(call cc-option,-Wa$(comma)
ifdef CONFIG_OBJTOOL
ifdef CONFIG_CC_HAS_ANNOTATE_TABLEJUMP
+# The annotate-tablejump option can not be passed to LLVM backend when LTO is enabled.
+# Ensure it is aware of linker with LTO, '--loongarch-annotate-tablejump' also needs to
+# be passed via '-mllvm' to ld.lld.
KBUILD_CFLAGS += -mannotate-tablejump
+ifdef CONFIG_LTO_CLANG
+KBUILD_LDFLAGS += -mllvm --loongarch-annotate-tablejump
+endif
else
KBUILD_CFLAGS += -fno-jump-tables # keep compatibility with older compilers
endif