2 #define PROVIDE32(x) PROVIDE(__unused__##x)
4 #define PROVIDE32(x) PROVIDE(x)
7 #include <asm-generic/vmlinux.lds.h>
9 #include <asm/thread_info.h>
11 #ifdef CONFIG_STRICT_KERNEL_RWX
12 #define STRICT_ALIGN_SIZE (1 << 24)
14 #define STRICT_ALIGN_SIZE PAGE_SIZE
20 kernel PT_LOAD FLAGS(7); /* RWX */
21 notes PT_NOTE FLAGS(0);
22 dummy PT_NOTE FLAGS(0);
24 /* binutils < 2.18 has a bug that makes it misbehave when taking an
25 ELF file with all segments at load address 0 as input. This
26 happens when running "strip" on vmlinux, because of the AT() magic
27 in this linker script. People using GCC >= 4.2 won't run into
28 this problem, because the "build-id" support will put some data
29 into the "notes" segment (at a non-zero load address).
31 To work around this, we force some data into both the "dummy"
32 segment and the kernel segment, so the dummy segment will get a
33 non-zero load address. It's not enough to always create the
34 "notes" segment, since if nothing gets assigned to it, its load
35 address will be zero. */
39 OUTPUT_ARCH(powerpc:common64)
42 OUTPUT_ARCH(powerpc:common)
43 jiffies = jiffies_64 + 4;
50 * Text, read only data and other permanent read-only sections
58 * This needs to be in its own output section to avoid ld placing
59 * branch trampoline stubs randomly throughout the fixed sections,
60 * which it will do (even if the branch comes from another section)
61 * in order to optimize stub generation.
63 .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) {
65 KEEP(*(.head.text.first_256B));
66 #ifdef CONFIG_PPC_BOOK3E
68 KEEP(*(.head.text.real_vectors));
69 *(.head.text.real_trampolines);
70 KEEP(*(.head.text.virt_vectors));
71 *(.head.text.virt_trampolines);
72 # if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
73 KEEP(*(.head.data.fwnmi_page));
76 #else /* !CONFIG_PPC64 */
85 * BLOCK(0) overrides the default output section alignment because
86 * this needs to start right after .head.text in order for fixed
87 * section placement to work.
89 .text BLOCK(0) : AT(ADDR(.text) - LOAD_OFFSET) {
90 #ifdef CONFIG_LD_HEAD_STUB_CATCH
91 *(.linker_stub_catch);
96 .text : AT(ADDR(.text) - LOAD_OFFSET) {
99 /* careful! __ftr_alt_* sections need to be close to .text */
100 *(.text.hot .text .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
108 * -Os builds call FP save/restore functions. The powerpc64
109 * linker generates those on demand in the .sfpr section.
110 * .sfpr gets placed at the beginning of a group of input
111 * sections, which can break start-of-text offset if it is
112 * included with the main text sections, so put it by itself.
123 #endif /* CONFIG_PPC32 */
127 . = ALIGN(PAGE_SIZE);
129 PROVIDE32 (etext = .);
138 /* The dummy segment contents for the bug workaround mentioned above
140 .dummy : AT(ADDR(.dummy) - LOAD_OFFSET) {
147 * Init sections discarded at runtime
149 . = ALIGN(STRICT_ALIGN_SIZE);
151 INIT_TEXT_SECTION(PAGE_SIZE) :kernel
153 /* .exit.text is discarded at runtime, not link time,
154 * to deal with references from __bug_table
156 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
160 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
162 __vtop_table_begin = .;
164 __vtop_table_end = .;
165 __ptov_table_begin = .;
167 __ptov_table_end = .;
170 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
174 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
178 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
185 __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) {
186 __start___ftr_fixup = .;
188 __stop___ftr_fixup = .;
191 __mmu_ftr_fixup : AT(ADDR(__mmu_ftr_fixup) - LOAD_OFFSET) {
192 __start___mmu_ftr_fixup = .;
194 __stop___mmu_ftr_fixup = .;
197 __lwsync_fixup : AT(ADDR(__lwsync_fixup) - LOAD_OFFSET) {
198 __start___lwsync_fixup = .;
200 __stop___lwsync_fixup = .;
204 __fw_ftr_fixup : AT(ADDR(__fw_ftr_fixup) - LOAD_OFFSET) {
205 __start___fw_ftr_fixup = .;
207 __stop___fw_ftr_fixup = .;
210 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
214 PERCPU_SECTION(L1_CACHE_BYTES)
217 .machine.desc : AT(ADDR(.machine.desc) - LOAD_OFFSET) {
218 __machine_desc_start = . ;
220 __machine_desc_end = . ;
222 #ifdef CONFIG_RELOCATABLE
224 .dynsym : AT(ADDR(.dynsym) - LOAD_OFFSET)
227 __dynamic_symtab = .;
231 .dynstr : AT(ADDR(.dynstr) - LOAD_OFFSET) { *(.dynstr) }
232 .dynamic : AT(ADDR(.dynamic) - LOAD_OFFSET)
237 .hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) }
238 .interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) }
239 .rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET)
241 __rela_dyn_start = .;
245 /* .exit.data is discarded at runtime, not link time,
246 * to deal with references from .exit.text
248 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
252 /* freed after init ends here */
253 . = ALIGN(PAGE_SIZE);
257 * And now the various read/write data
260 . = ALIGN(PAGE_SIZE);
264 .data : AT(ADDR(.data) - LOAD_OFFSET) {
272 .data : AT(ADDR(.data) - LOAD_OFFSET) {
279 .opd : AT(ADDR(.opd) - LOAD_OFFSET) {
284 .got : AT(ADDR(.got) - LOAD_OFFSET) {
286 #ifndef CONFIG_RELOCATABLE
287 __prom_init_toc_start = .;
288 arch/powerpc/kernel/prom_init.o*(.toc .got)
289 __prom_init_toc_end = .;
296 /* The initial task and kernel stack */
297 INIT_TASK_DATA_SECTION(THREAD_SIZE)
299 .data..page_aligned : AT(ADDR(.data..page_aligned) - LOAD_OFFSET) {
300 PAGE_ALIGNED_DATA(PAGE_SIZE)
303 .data..cacheline_aligned : AT(ADDR(.data..cacheline_aligned) - LOAD_OFFSET) {
304 CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
307 .data..read_mostly : AT(ADDR(.data..read_mostly) - LOAD_OFFSET) {
308 READ_MOSTLY_DATA(L1_CACHE_BYTES)
311 . = ALIGN(PAGE_SIZE);
312 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
318 . = ALIGN(PAGE_SIZE);
320 PROVIDE32 (edata = .);
323 * And finally the bss
328 . = ALIGN(PAGE_SIZE);
339 *(.glink .iplt .plt .rela* .comment)