Skip to content

Commit 0d3a632

Browse files
heiherchenhuacai
authored andcommitted
LoongArch: Use rustc option -Zdirect-access-external-data
-Zdirect-access-external-data is a new Rust compiler option added in Rust 1.78, which we use to optimize the access of external data in the Linux kernel's Rust code. This patch modifies the Rust code in vmlinux to directly access externa data, using PC-REL instead of GOT. However, Rust code whithin modules is constrained by the PC-REL addressing range and is explicitly set to use an indirect method. Acked-by: Miguel Ojeda <[email protected]> Signed-off-by: WANG Rui <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent e05d4cd commit 0d3a632

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/loongarch/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ KBUILD_CFLAGS += -fno-jump-tables
105105
endif
106106

107107
KBUILD_RUSTFLAGS += --target=loongarch64-unknown-none-softfloat
108-
KBUILD_RUSTFLAGS_MODULE += -Crelocation-model=pic
108+
KBUILD_RUSTFLAGS_KERNEL += -Zdirect-access-external-data=yes
109+
KBUILD_RUSTFLAGS_MODULE += -Zdirect-access-external-data=no
109110

110111
ifeq ($(CONFIG_RELOCATABLE),y)
111112
KBUILD_CFLAGS_KERNEL += -fPIE

0 commit comments

Comments
 (0)