mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] LoongArch: Disable module from accessing external data directly
@ 2023-11-08  4:04 WANG Rui
  2023-11-08  8:30 ` Xi Ruoyao
  0 siblings, 1 reply; 7+ messages in thread
From: WANG Rui @ 2023-11-08  4:04 UTC (permalink / raw)
  To: Huacai Chen
  Cc: WANG Xuerui, Xi Ruoyao, linux-kernel, loongarch, linux-kbuild,
	llvm, loongson-kernel, WANG Rui

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>
---
 arch/loongarch/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index b86f2ff31659..9eeb0c05f3f4 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -68,6 +68,8 @@ LDFLAGS_vmlinux			+= -static -n -nostdlib
 ifdef CONFIG_AS_HAS_EXPLICIT_RELOCS
 cflags-y			+= $(call cc-option,-mexplicit-relocs)
 KBUILD_CFLAGS_KERNEL		+= $(call cc-option,-mdirect-extern-access)
+KBUILD_AFLAGS_MODULE		+= $(call cc-option,-fno-direct-access-external-data)
+KBUILD_CFLAGS_MODULE		+= $(call cc-option,-fno-direct-access-external-data)
 KBUILD_AFLAGS_MODULE		+= $(call cc-option,-mno-relax) $(call cc-option,-Wa$(comma)-mno-relax)
 KBUILD_CFLAGS_MODULE		+= $(call cc-option,-mno-relax) $(call cc-option,-Wa$(comma)-mno-relax)
 else
-- 
2.42.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-11-08  9:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-08  4:04 [PATCH] LoongArch: Disable module from accessing external data directly WANG Rui
2023-11-08  8:30 ` Xi Ruoyao
2023-11-08  9:20   ` WANG Rui
2023-11-08  9:25     ` Xi Ruoyao
2023-11-08  9:36       ` WANG Rui
2023-11-08  9:39         ` WANG Rui
2023-11-08  9:46         ` Xi Ruoyao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®