Skip to content

Commit b6adc6d

Browse files
npigginmpe
authored andcommitted
powerpc/build: move .data.rel.ro, .sdata2 to read-only
.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 <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f21ba44 commit b6adc6d

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

arch/powerpc/kernel/vmlinux.lds.S

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ SECTIONS
135135
/* Read-only data */
136136
RO_DATA(PAGE_SIZE)
137137

138+
#ifdef CONFIG_PPC32
139+
.sdata2 : AT(ADDR(.sdata2) - LOAD_OFFSET) {
140+
*(.sdata2)
141+
}
142+
#endif
143+
144+
.data.rel.ro : AT(ADDR(.data.rel.ro) - LOAD_OFFSET) {
145+
*(.data.rel.ro*)
146+
}
147+
138148
.branch_lt : AT(ADDR(.branch_lt) - LOAD_OFFSET) {
139149
*(.branch_lt)
140150
}
@@ -349,19 +359,13 @@ SECTIONS
349359
. = ALIGN(PAGE_SIZE);
350360
_sdata = .;
351361

352-
#ifdef CONFIG_PPC32
353362
.data : AT(ADDR(.data) - LOAD_OFFSET) {
354363
DATA_DATA
355364
*(.data.rel*)
365+
#ifdef CONFIG_PPC32
356366
*(SDATA_MAIN)
357-
*(.sdata2)
358-
}
359-
#else
360-
.data : AT(ADDR(.data) - LOAD_OFFSET) {
361-
DATA_DATA
362-
*(.data.rel*)
363-
}
364367
#endif
368+
}
365369

366370
/* The initial task and kernel stack */
367371
INIT_TASK_DATA_SECTION(THREAD_ALIGN)

0 commit comments

Comments
 (0)