Skip to content

Commit 21eb2bf

Browse files
heiherchenhuacai
authored andcommitted
LoongArch: Disable module from accessing external data directly
The distance between vmlinux and the module is too far so that PC-REL cannot be accessed directly, only GOT. When compiling module with GCC, the option `-mdirect-extern-access` is disabled by default. The Clang option `-fdirect-access-external-data` is enabled by default, so it needs to be explicitly disabled. Signed-off-by: WANG Rui <wangrui@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 80c7889 commit 21eb2bf

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/loongarch/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ LDFLAGS_vmlinux += -static -n -nostdlib
6868
ifdef CONFIG_AS_HAS_EXPLICIT_RELOCS
6969
cflags-y += $(call cc-option,-mexplicit-relocs)
7070
KBUILD_CFLAGS_KERNEL += $(call cc-option,-mdirect-extern-access)
71+
KBUILD_AFLAGS_MODULE += $(call cc-option,-fno-direct-access-external-data)
72+
KBUILD_CFLAGS_MODULE += $(call cc-option,-fno-direct-access-external-data)
7173
KBUILD_AFLAGS_MODULE += $(call cc-option,-mno-relax) $(call cc-option,-Wa$(comma)-mno-relax)
7274
KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax) $(call cc-option,-Wa$(comma)-mno-relax)
7375
else

0 commit comments

Comments
 (0)