]> Git Repo - linux.git/commitdiff
LoongArch: Use rustc option -Zdirect-access-external-data
authorWANG Rui <[email protected]>
Sat, 20 Jul 2024 14:41:07 +0000 (22:41 +0800)
committerHuacai Chen <[email protected]>
Sat, 20 Jul 2024 14:41:07 +0000 (22:41 +0800)
-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]>
arch/loongarch/Makefile

index 8674e7e24c4a63bd33caf7f84c48b4f2ae87e370..ae3f80622f4c607a0846b1873838db4d3a506d2a 100644 (file)
@@ -105,7 +105,8 @@ KBUILD_CFLAGS                       += -fno-jump-tables
 endif
 
 KBUILD_RUSTFLAGS               += --target=loongarch64-unknown-none-softfloat
-KBUILD_RUSTFLAGS_MODULE                += -Crelocation-model=pic
+KBUILD_RUSTFLAGS_KERNEL                += -Zdirect-access-external-data=yes
+KBUILD_RUSTFLAGS_MODULE                += -Zdirect-access-external-data=no
 
 ifeq ($(CONFIG_RELOCATABLE),y)
 KBUILD_CFLAGS_KERNEL           += -fPIE
This page took 0.059914 seconds and 4 git commands to generate.