1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define PROVIDE32(x) PROVIDE(__unused__##x)
5 #define PROVIDE32(x) PROVIDE(x)
8 #define BSS_FIRST_SECTIONS *(.bss.prominit)
10 #define RO_EXCEPTION_TABLE_ALIGN 0
11 #define RUNTIME_DISCARD_EXIT
14 #include <asm-generic/vmlinux.lds.h>
15 #include <asm/cache.h>
16 #include <asm/thread_info.h>
18 #define STRICT_ALIGN_SIZE (1 << CONFIG_DATA_SHIFT)
23 text PT_LOAD FLAGS(7); /* RWX */
24 note PT_NOTE FLAGS(0);
28 OUTPUT_ARCH(powerpc:common64)
31 OUTPUT_ARCH(powerpc:common)
32 jiffies = jiffies_64 + 4;
39 * Text, read only data and other permanent read-only sections
47 * This needs to be in its own output section to avoid ld placing
48 * branch trampoline stubs randomly throughout the fixed sections,
49 * which it will do (even if the branch comes from another section)
50 * in order to optimize stub generation.
52 .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) {
54 KEEP(*(.head.text.first_256B));
55 #ifdef CONFIG_PPC_BOOK3E
57 KEEP(*(.head.text.real_vectors));
58 *(.head.text.real_trampolines);
59 KEEP(*(.head.text.virt_vectors));
60 *(.head.text.virt_trampolines);
61 # if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
62 KEEP(*(.head.data.fwnmi_page));
65 #else /* !CONFIG_PPC64 */
74 * ALIGN(0) overrides the default output section alignment because
75 * this needs to start right after .head.text in order for fixed
76 * section placement to work.
78 .text ALIGN(0) : AT(ADDR(.text) - LOAD_OFFSET) {
79 #ifdef CONFIG_LD_HEAD_STUB_CATCH
80 KEEP(*(.linker_stub_catch));
85 .text : AT(ADDR(.text) - LOAD_OFFSET) {
88 /* careful! __ftr_alt_* sections need to be close to .text */
89 *(.text.hot .text.hot.* TEXT_MAIN .text.fixup .text.unlikely .text.unlikely.* .fixup __ftr_alt_* .ref.text);
91 *(.tramp.ftrace.text);
101 * -Os builds call FP save/restore functions. The powerpc64
102 * linker generates those on demand in the .sfpr section.
103 * .sfpr gets placed at the beginning of a group of input
104 * sections, which can break start-of-text offset if it is
105 * included with the main text sections, so put it by itself.
116 #endif /* CONFIG_PPC32 */
120 . = ALIGN(PAGE_SIZE);
122 PROVIDE32 (etext = .);
129 __stf_entry_barrier_fixup : AT(ADDR(__stf_entry_barrier_fixup) - LOAD_OFFSET) {
130 __start___stf_entry_barrier_fixup = .;
131 *(__stf_entry_barrier_fixup)
132 __stop___stf_entry_barrier_fixup = .;
136 __uaccess_flush_fixup : AT(ADDR(__uaccess_flush_fixup) - LOAD_OFFSET) {
137 __start___uaccess_flush_fixup = .;
138 *(__uaccess_flush_fixup)
139 __stop___uaccess_flush_fixup = .;
143 __entry_flush_fixup : AT(ADDR(__entry_flush_fixup) - LOAD_OFFSET) {
144 __start___entry_flush_fixup = .;
145 *(__entry_flush_fixup)
146 __stop___entry_flush_fixup = .;
150 __scv_entry_flush_fixup : AT(ADDR(__scv_entry_flush_fixup) - LOAD_OFFSET) {
151 __start___scv_entry_flush_fixup = .;
152 *(__scv_entry_flush_fixup)
153 __stop___scv_entry_flush_fixup = .;
157 __stf_exit_barrier_fixup : AT(ADDR(__stf_exit_barrier_fixup) - LOAD_OFFSET) {
158 __start___stf_exit_barrier_fixup = .;
159 *(__stf_exit_barrier_fixup)
160 __stop___stf_exit_barrier_fixup = .;
164 __rfi_flush_fixup : AT(ADDR(__rfi_flush_fixup) - LOAD_OFFSET) {
165 __start___rfi_flush_fixup = .;
167 __stop___rfi_flush_fixup = .;
169 #endif /* CONFIG_PPC64 */
171 #ifdef CONFIG_PPC_BARRIER_NOSPEC
173 __spec_barrier_fixup : AT(ADDR(__spec_barrier_fixup) - LOAD_OFFSET) {
174 __start___barrier_nospec_fixup = .;
175 *(__barrier_nospec_fixup)
176 __stop___barrier_nospec_fixup = .;
178 #endif /* CONFIG_PPC_BARRIER_NOSPEC */
180 #ifdef CONFIG_PPC_FSL_BOOK3E
182 __spec_btb_flush_fixup : AT(ADDR(__spec_btb_flush_fixup) - LOAD_OFFSET) {
183 __start__btb_flush_fixup = .;
185 __stop__btb_flush_fixup = .;
190 * Init sections discarded at runtime
192 . = ALIGN(STRICT_ALIGN_SIZE);
194 . = ALIGN(PAGE_SIZE);
195 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
200 *.init.text might be RO so we must ensure this section ends on
203 . = ALIGN(PAGE_SIZE);
206 *(.tramp.ftrace.init);
210 /* .exit.text is discarded at runtime, not link time,
211 * to deal with references from __bug_table
213 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
217 . = ALIGN(PAGE_SIZE);
219 INIT_DATA_SECTION(16)
222 __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) {
223 __start___ftr_fixup = .;
225 __stop___ftr_fixup = .;
228 __mmu_ftr_fixup : AT(ADDR(__mmu_ftr_fixup) - LOAD_OFFSET) {
229 __start___mmu_ftr_fixup = .;
230 KEEP(*(__mmu_ftr_fixup))
231 __stop___mmu_ftr_fixup = .;
234 __lwsync_fixup : AT(ADDR(__lwsync_fixup) - LOAD_OFFSET) {
235 __start___lwsync_fixup = .;
236 KEEP(*(__lwsync_fixup))
237 __stop___lwsync_fixup = .;
241 __fw_ftr_fixup : AT(ADDR(__fw_ftr_fixup) - LOAD_OFFSET) {
242 __start___fw_ftr_fixup = .;
243 KEEP(*(__fw_ftr_fixup))
244 __stop___fw_ftr_fixup = .;
248 PERCPU_SECTION(L1_CACHE_BYTES)
251 .machine.desc : AT(ADDR(.machine.desc) - LOAD_OFFSET) {
252 __machine_desc_start = . ;
253 KEEP(*(.machine.desc))
254 __machine_desc_end = . ;
256 #ifdef CONFIG_RELOCATABLE
258 .dynsym : AT(ADDR(.dynsym) - LOAD_OFFSET)
261 __dynamic_symtab = .;
265 .dynstr : AT(ADDR(.dynstr) - LOAD_OFFSET) { *(.dynstr) }
266 .dynamic : AT(ADDR(.dynamic) - LOAD_OFFSET)
271 .hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) }
272 .gnu.hash : AT(ADDR(.gnu.hash) - LOAD_OFFSET) { *(.gnu.hash) }
273 .interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) }
274 .rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET)
276 __rela_dyn_start = .;
280 /* .exit.data is discarded at runtime, not link time,
281 * to deal with references from .exit.text
283 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
287 /* freed after init ends here */
288 . = ALIGN(PAGE_SIZE);
292 * And now the various read/write data
295 . = ALIGN(PAGE_SIZE);
299 .data : AT(ADDR(.data) - LOAD_OFFSET) {
302 *(.data..Lubsan_data*)
303 *(.data..Lubsan_type*)
313 .data : AT(ADDR(.data) - LOAD_OFFSET) {
320 .opd : AT(ADDR(.opd) - LOAD_OFFSET) {
327 .got : AT(ADDR(.got) - LOAD_OFFSET) {
329 #ifndef CONFIG_RELOCATABLE
330 __prom_init_toc_start = .;
331 arch/powerpc/kernel/prom_init.o*(.toc .got)
332 __prom_init_toc_end = .;
339 /* The initial task and kernel stack */
340 INIT_TASK_DATA_SECTION(THREAD_ALIGN)
342 .data..page_aligned : AT(ADDR(.data..page_aligned) - LOAD_OFFSET) {
343 PAGE_ALIGNED_DATA(PAGE_SIZE)
346 .data..cacheline_aligned : AT(ADDR(.data..cacheline_aligned) - LOAD_OFFSET) {
347 CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
350 .data..read_mostly : AT(ADDR(.data..read_mostly) - LOAD_OFFSET) {
351 READ_MOSTLY_DATA(L1_CACHE_BYTES)
354 . = ALIGN(PAGE_SIZE);
355 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
361 . = ALIGN(PAGE_SIZE);
363 PROVIDE32 (edata = .);
366 * And finally the bss
371 . = ALIGN(PAGE_SIZE);
382 *(.glink .iplt .plt .comment)
386 #ifndef CONFIG_RELOCATABLE