linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail.com>, Alan Modra <amodra@gmail.com>
Subject: [PATCH v2 3/5] powerpc/64: switch asm helpers from GOT to TOC relative addressing
Date: Mon, 26 Sep 2022 13:40:55 +1000	[thread overview]
Message-ID: <20220926034057.2360083-4-npiggin@gmail.com> (raw)
In-Reply-To: <20220926034057.2360083-1-npiggin@gmail.com>

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

Signed-off-by: Nicholas Piggin <npiggin@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@got(r2)
+	addis	reg,r2,name@toc@ha;		\
+	addi	reg,reg,name@toc@l
 #else
 #define LOAD_REG_ADDR(reg,name)			\
 	lis	reg,name@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@got(r2)
+	addis	reg,r2,name@toc@ha;		\
+	addi	reg,reg,name@toc@l
 
 #define LOAD_REG_ADDRBASE(reg,name)	LOAD_REG_ADDR(reg,name)
 #define ADDROFF(name)			0
-- 
2.37.2


  parent reply	other threads:[~2022-09-26  3:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26  3:40 [PATCH v2 0/5] powerpc/64: avoid GOT addressing, don't put data in TOC Nicholas Piggin
2022-09-26  3:40 ` [PATCH v2 1/5] powerpc/64: use 32-bit immediate for STACK_FRAME_REGS_MARKER Nicholas Piggin
2022-09-26  6:00   ` Christophe Leroy
2022-09-27 14:21     ` Michael Ellerman
2022-09-26  3:40 ` [PATCH v2 2/5] powerpc/64: asm use consistent global variable declaration and access Nicholas Piggin
2022-09-26  3:40 ` Nicholas Piggin [this message]
2022-09-26  3:40 ` [PATCH v2 4/5] powerpc/64: provide a helper macro to load r2 with the kernel TOC Nicholas Piggin
2022-09-26  3:40 ` [PATCH v2 5/5] powerpc/64e: provide an addressing macro for use with TOC in alternate register Nicholas Piggin
2022-10-04 13:25 ` [PATCH v2 0/5] powerpc/64: avoid GOT addressing, don't put data in TOC Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220926034057.2360083-4-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=amodra@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).