]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
LoongArch: Explicitly specify code model in Makefile
authorHuacai Chen <chenhuacai@loongson.cn>
Fri, 22 Nov 2024 07:47:47 +0000 (15:47 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Tue, 26 Nov 2024 10:06:03 +0000 (18:06 +0800)
LoongArch's toolchain may change the default code model from normal to
medium. This is unnecessary for kernel, and generates some relocations
which cannot be handled by the module loader. So explicitly specify the
code model to normal in Makefile (for Rust 'normal' is 'small').

Cc: stable@vger.kernel.org
Tested-by: Haiyong Sun <sunhaiyong@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/Makefile

index ae3f80622f4c607a0846b1873838db4d3a506d2a..567bd122a9ee4769638f6a076e9284148a196e1d 100644 (file)
@@ -59,7 +59,7 @@ endif
 
 ifdef CONFIG_64BIT
 ld-emul                        = $(64bit-emul)
-cflags-y               += -mabi=lp64s
+cflags-y               += -mabi=lp64s -mcmodel=normal
 endif
 
 cflags-y                       += -pipe $(CC_FLAGS_NO_FPU)
@@ -104,7 +104,7 @@ ifdef CONFIG_OBJTOOL
 KBUILD_CFLAGS                  += -fno-jump-tables
 endif
 
-KBUILD_RUSTFLAGS               += --target=loongarch64-unknown-none-softfloat
+KBUILD_RUSTFLAGS               += --target=loongarch64-unknown-none-softfloat -Ccode-model=small
 KBUILD_RUSTFLAGS_KERNEL                += -Zdirect-access-external-data=yes
 KBUILD_RUSTFLAGS_MODULE                += -Zdirect-access-external-data=no