252532bit-emul = elf32loongarch
262664bit-emul = elf64loongarch
2727
28+ ifdef CONFIG_UNWINDER_ORC
29+ orc_hash_h := arch/$(SRCARCH ) /include/generated/asm/orc_hash.h
30+ orc_hash_sh := $(srctree ) /scripts/orc_hash.sh
31+ targets += $(orc_hash_h )
32+ quiet_cmd_orc_hash = GEN $@
33+ cmd_orc_hash = mkdir -p $(dir $@ ) ; \
34+ $(CONFIG_SHELL ) $(orc_hash_sh ) < $< > $@
35+ $(orc_hash_h ) : $(srctree ) /arch/loongarch/include/asm/orc_types.h $(orc_hash_sh ) FORCE
36+ $(call if_changed,orc_hash)
37+ archprepare : $(orc_hash_h )
38+ endif
39+
2840ifdef CONFIG_DYNAMIC_FTRACE
2941KBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY
3042CC_FLAGS_FTRACE := -fpatchable-function-entry=2
@@ -68,8 +80,6 @@ LDFLAGS_vmlinux += -static -n -nostdlib
6880ifdef CONFIG_AS_HAS_EXPLICIT_RELOCS
6981cflags-y += $(call cc-option,-mexplicit-relocs)
7082KBUILD_CFLAGS_KERNEL += $(call cc-option,-mdirect-extern-access)
71- KBUILD_AFLAGS_MODULE += $(call cc-option,-mno-relax) $(call cc-option,-Wa$(comma ) -mno-relax)
72- KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax) $(call cc-option,-Wa$(comma ) -mno-relax)
7383else
7484cflags-y += $(call cc-option,-mno-explicit-relocs)
7585KBUILD_AFLAGS_KERNEL += -Wa,-mla-global-with-pcrel
@@ -78,6 +88,15 @@ KBUILD_AFLAGS_MODULE += -Wa,-mla-global-with-abs
7888KBUILD_CFLAGS_MODULE += -fplt -Wa,-mla-global-with-abs,-mla-local-with-abs
7989endif
8090
91+ KBUILD_AFLAGS += $(call cc-option,-mno-relax) $(call cc-option,-Wa$(comma ) -mno-relax)
92+ KBUILD_CFLAGS += $(call cc-option,-mno-relax) $(call cc-option,-Wa$(comma ) -mno-relax)
93+ KBUILD_AFLAGS += $(call cc-option,-mthin-add-sub) $(call cc-option,-Wa$(comma ) -mthin-add-sub)
94+ KBUILD_CFLAGS += $(call cc-option,-mthin-add-sub) $(call cc-option,-Wa$(comma ) -mthin-add-sub)
95+
96+ ifdef CONFIG_OBJTOOL
97+ KBUILD_CFLAGS += -fno-jump-tables
98+ endif
99+
81100ifeq ($(CONFIG_RELOCATABLE ) ,y)
82101KBUILD_CFLAGS_KERNEL += -fPIE
83102LDFLAGS_vmlinux += -static -pie --no-dynamic-linker -z notext $(call ld-option, --apply-dynamic-relocs)
0 commit comments