diff options
author | WANG Rui <wangrui@loongson.cn> | 2023-11-08 14:12:07 +0800 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2023-11-08 14:12:07 +0800 |
commit | 21eb2bfe2748b238f06983e4308cb30611371605 (patch) | |
tree | e9fa23ddd343ac50788360d9b53c29ba454ad120 /arch | |
parent | 80c7889de7a8246e44a9632a2b7d15b41ab3fe41 (diff) | |
download | lwn-21eb2bfe2748b238f06983e4308cb30611371605.tar.gz lwn-21eb2bfe2748b238f06983e4308cb30611371605.zip |
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/loongarch/Makefile | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index fb0fada43197..c31a62521e6b 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 |