Skip to content

Commit

Permalink
powerpc/build: move .data.rel.ro, .sdata2 to read-only
Browse files Browse the repository at this point in the history
.sdata2 is a readonly small data section for ppc32, and .data.rel.ro
is data that needs relocating but is read-only after that so these
can both be moved to the read only memory region.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220916040755.2398112-5-npiggin@gmail.com
  • Loading branch information
Nicholas Piggin authored and Michael Ellerman committed Sep 26, 2022
1 parent f21ba44 commit b6adc6d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions arch/powerpc/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ SECTIONS
/* Read-only data */
RO_DATA(PAGE_SIZE)

#ifdef CONFIG_PPC32
.sdata2 : AT(ADDR(.sdata2) - LOAD_OFFSET) {
*(.sdata2)
}
#endif

.data.rel.ro : AT(ADDR(.data.rel.ro) - LOAD_OFFSET) {
*(.data.rel.ro*)
}

.branch_lt : AT(ADDR(.branch_lt) - LOAD_OFFSET) {
*(.branch_lt)
}
Expand Down Expand Up @@ -349,19 +359,13 @@ SECTIONS
. = ALIGN(PAGE_SIZE);
_sdata = .;

#ifdef CONFIG_PPC32
.data : AT(ADDR(.data) - LOAD_OFFSET) {
DATA_DATA
*(.data.rel*)
#ifdef CONFIG_PPC32
*(SDATA_MAIN)
*(.sdata2)
}
#else
.data : AT(ADDR(.data) - LOAD_OFFSET) {
DATA_DATA
*(.data.rel*)
}
#endif
}

/* The initial task and kernel stack */
INIT_TASK_DATA_SECTION(THREAD_ALIGN)
Expand Down

0 comments on commit b6adc6d

Please sign in to comment.