mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 09:50:04 +00:00
powerpc/build: move got, toc, plt, branch_lt sections to read-only
This moves linker-related tables from .data to read-only area. Relocations are performed at early boot time before memory is protected, after which there should be no modifications required. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> [mpe: Don't use SPECIAL as reported by lkp@intel.com] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220916040755.2398112-4-npiggin@gmail.com
This commit is contained in:
parent
1faa1235c1
commit
f21ba4499a
1 changed files with 22 additions and 10 deletions
|
@ -135,6 +135,10 @@ SECTIONS
|
|||
/* Read-only data */
|
||||
RO_DATA(PAGE_SIZE)
|
||||
|
||||
.branch_lt : AT(ADDR(.branch_lt) - LOAD_OFFSET) {
|
||||
*(.branch_lt)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PPC32
|
||||
.got1 : AT(ADDR(.got1) - LOAD_OFFSET) {
|
||||
*(.got1)
|
||||
|
@ -144,7 +148,25 @@ SECTIONS
|
|||
*(.got2)
|
||||
__got2_end = .;
|
||||
}
|
||||
.got : AT(ADDR(.got) - LOAD_OFFSET) {
|
||||
*(.got)
|
||||
*(.got.plt)
|
||||
}
|
||||
.plt : AT(ADDR(.plt) - LOAD_OFFSET) {
|
||||
/* XXX: is .plt (and .got.plt) required? */
|
||||
*(.plt)
|
||||
}
|
||||
|
||||
#else /* CONFIG_PPC32 */
|
||||
.toc1 : AT(ADDR(.toc1) - LOAD_OFFSET) {
|
||||
*(.toc1)
|
||||
}
|
||||
|
||||
.got : AT(ADDR(.got) - LOAD_OFFSET) ALIGN(256) {
|
||||
*(.got)
|
||||
*(.toc)
|
||||
}
|
||||
|
||||
SOFT_MASK_TABLE(8)
|
||||
RESTART_TABLE(8)
|
||||
|
||||
|
@ -333,21 +355,11 @@ SECTIONS
|
|||
*(.data.rel*)
|
||||
*(SDATA_MAIN)
|
||||
*(.sdata2)
|
||||
*(.got.plt) *(.got)
|
||||
*(.plt)
|
||||
*(.branch_lt)
|
||||
}
|
||||
#else
|
||||
.data : AT(ADDR(.data) - LOAD_OFFSET) {
|
||||
DATA_DATA
|
||||
*(.data.rel*)
|
||||
*(.toc1)
|
||||
*(.branch_lt)
|
||||
}
|
||||
|
||||
.got : AT(ADDR(.got) - LOAD_OFFSET) ALIGN(256) {
|
||||
*(.got)
|
||||
*(.toc)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue