summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/Makefile
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2023-04-08 12:17:52 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2023-04-20 13:21:42 +1000
commit77e69ee7ce0715c39b9a0cde68ff44fe467435ef (patch)
treea218a20a53fbc5f976dc795415cd8c7786987ded /arch/powerpc/Makefile
parent7e3a68be42e10f5fa5890e97afc0afd992355bc3 (diff)
downloadlinux-stable-77e69ee7ce0715c39b9a0cde68ff44fe467435ef.tar.gz
linux-stable-77e69ee7ce0715c39b9a0cde68ff44fe467435ef.tar.bz2
linux-stable-77e69ee7ce0715c39b9a0cde68ff44fe467435ef.zip
powerpc/64: modules support building with PCREL addresing
Build modules using PCREL addressing when CONFIG_PPC_KERNEL_PCREL=y. - The module loader must handle several new relocation types: * R_PPC64_REL24_NOTOC is a function call handled like R_PPC_REL24, but does not restore r2 upon return. The external function call stub is changed to use pcrel addressing to load the function pointer rather than based on the module TOC. * R_PPC64_GOT_PCREL34 is a reference to external data. A GOT table must be built by hand, because the linker adds this during the final link (which is not done for kernel modules). The GOT table is built similarly to the way the external function call stub table is. This section is called .mygot because .got has a special meaning for the linker and can become upset. * R_PPC64_PCREL34 is used for local data addressing, but there is a special case where the percpu section is moved at load-time to the percpu area which is out of range of this relocation. This requires the PCREL34 relocations are converted to use GOT_PCREL34 addressing. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> [mpe: Some coding style & formatting fixups] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20230408021752.862660-7-npiggin@gmail.com
Diffstat (limited to 'arch/powerpc/Makefile')
-rw-r--r--arch/powerpc/Makefile5
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 0297ad9a4ffb..5f47f2ce7cc3 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -107,9 +107,7 @@ LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) += -z notext
LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y)
ifdef CONFIG_PPC64
-ifdef CONFIG_PPC_KERNEL_PCREL
- KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-pcrel)
-endif
+ifndef CONFIG_PPC_KERNEL_PCREL
ifeq ($(call cc-option-yn,-mcmodel=medium),y)
# -mcmodel=medium breaks modules because it uses 32bit offsets from
# the TOC pointer to create pointers where possible. Pointers into the
@@ -124,6 +122,7 @@ else
export NO_MINIMAL_TOC := -mno-minimal-toc
endif
endif
+endif
CFLAGS-$(CONFIG_PPC64) := $(call cc-option,-mtraceback=no)
ifdef CONFIG_PPC64_ELF_ABI_V2