From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail.com>
Subject: [PATCH 3/7] powerpc/32/build: move got1/got2 sections out of text
Date: Thu, 15 Sep 2022 01:47:42 +1000 [thread overview]
Message-ID: <20220914154746.1122482-4-npiggin@gmail.com> (raw)
In-Reply-To: <20220914154746.1122482-1-npiggin@gmail.com>
Following the example from the binutils default linker script, move
.got1 and .got2 out of .text, to just after RO_DATA where they are in
read-only NX memory.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/kernel/vmlinux.lds.S | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 90ac5ff73df2..341ac79f49a9 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -122,14 +122,6 @@ SECTIONS
*(.sfpr);
MEM_KEEP(init.text)
MEM_KEEP(exit.text)
-
-#ifdef CONFIG_PPC32
- *(.got1)
- __got2_start = .;
- *(.got2)
- __got2_end = .;
-#endif /* CONFIG_PPC32 */
-
} :text
. = ALIGN(PAGE_SIZE);
@@ -139,7 +131,16 @@ SECTIONS
/* Read-only data */
RO_DATA(PAGE_SIZE)
-#ifdef CONFIG_PPC64
+#ifdef CONFIG_PPC32
+ .got1 : AT(ADDR(.got1) - LOAD_OFFSET) {
+ *(.got1)
+ }
+ .got2 : AT(ADDR(.got2) - LOAD_OFFSET) {
+ __got2_start = .;
+ *(.got2)
+ __got2_end = .;
+ }
+#else /* CONFIG_PPC32 */
SOFT_MASK_TABLE(8)
RESTART_TABLE(8)
@@ -190,7 +191,7 @@ SECTIONS
*(__rfi_flush_fixup)
__stop___rfi_flush_fixup = .;
}
-#endif /* CONFIG_PPC64 */
+#endif /* CONFIG_PPC32 */
#ifdef CONFIG_PPC_BARRIER_NOSPEC
. = ALIGN(8);
--
2.37.2
next prev parent reply other threads:[~2022-09-14 15:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-14 15:47 [PATCH 0/7] powerpc: build / linker improvements Nicholas Piggin
2022-09-14 15:47 ` [PATCH 1/7] powerpc/build: put sys_call_table in .data.rel.ro if RELOCATABLE Nicholas Piggin
2022-09-15 5:53 ` Christophe Leroy
2022-09-15 12:51 ` Michael Ellerman
2022-09-16 0:30 ` Nicholas Piggin
2022-09-14 15:47 ` [PATCH 2/7] powerpc: move __end_rodata to cover arch read-only sections Nicholas Piggin
2022-09-15 5:50 ` Christophe Leroy
2022-09-15 12:47 ` Michael Ellerman
2022-09-16 0:28 ` Nicholas Piggin
2022-09-16 6:35 ` Michael Ellerman
2022-09-14 15:47 ` Nicholas Piggin [this message]
2022-09-14 15:47 ` [PATCH 4/7] powerpc/build: move got, toc, plt, branch_lt sections to read-only Nicholas Piggin
2022-09-14 15:47 ` [PATCH 5/7] powerpc/build: move .data.rel.ro, .sdata2 " Nicholas Piggin
2022-09-14 15:47 ` [PATCH 6/7] powerpc/64/build: only include .opd with ELFv1 Nicholas Piggin
2022-09-14 15:47 ` [PATCH 7/7] powerpc/64/build: merge .got and .toc input sections Nicholas Piggin
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=20220914154746.1122482-4-npiggin@gmail.com \
--to=npiggin@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).