[PATCH v2 3/5] powerpc/64: switch asm helpers from GOT to TOC relative addressing

Nicholas Piggin npiggin at gmail.com
Mon Sep 26 13:40:55 AEST 2022


There is no need to use GOT addressing within the kernel.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 arch/powerpc/boot/ppc_asm.h        | 3 ++-
 arch/powerpc/include/asm/ppc_asm.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/ppc_asm.h b/arch/powerpc/boot/ppc_asm.h
index 2824a3e32aab..a66cfd76fa4d 100644
--- a/arch/powerpc/boot/ppc_asm.h
+++ b/arch/powerpc/boot/ppc_asm.h
@@ -86,7 +86,8 @@
 
 #ifdef CONFIG_PPC64_BOOT_WRAPPER
 #define LOAD_REG_ADDR(reg,name)			\
-	ld	reg,name at got(r2)
+	addis	reg,r2,name at toc@ha;		\
+	addi	reg,reg,name at toc@l
 #else
 #define LOAD_REG_ADDR(reg,name)			\
 	lis	reg,name at ha;			\
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index 83c02f5a7f2a..da570b197e82 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -315,7 +315,8 @@ GLUE(.,name):
 	rldimi	reg, tmp, 32, 0
 
 #define LOAD_REG_ADDR(reg,name)			\
-	ld	reg,name at got(r2)
+	addis	reg,r2,name at toc@ha;		\
+	addi	reg,reg,name at toc@l
 
 #define LOAD_REG_ADDRBASE(reg,name)	LOAD_REG_ADDR(reg,name)
 #define ADDROFF(name)			0
-- 
2.37.2



More information about the Linuxppc-dev mailing list