Skip to content

Commit

Permalink
LoongArch: Explicitly specify code model in Makefile
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Huacai Chen committed Nov 26, 2024
1 parent 1b9bc42 commit e67e0eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/loongarch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit e67e0eb

Please sign in to comment.