1#ifdef CONFIG_PPC64 2#define PROVIDE32(x) PROVIDE(__unused__##x) 3#else 4#define PROVIDE32(x) PROVIDE(x) 5#endif 6#include <asm/page.h> 7#include <asm-generic/vmlinux.lds.h> 8#include <asm/cache.h> 9 10ENTRY(_stext) 11 12PHDRS { 13 kernel PT_LOAD FLAGS(7); /* RWX */ 14 notes PT_NOTE FLAGS(0); 15 dummy PT_NOTE FLAGS(0); 16 17 /* binutils < 2.18 has a bug that makes it misbehave when taking an 18 ELF file with all segments at load address 0 as input. This 19 happens when running "strip" on vmlinux, because of the AT() magic 20 in this linker script. People using GCC >= 4.2 won't run into 21 this problem, because the "build-id" support will put some data 22 into the "notes" segment (at a non-zero load address). 23 24 To work around this, we force some data into both the "dummy" 25 segment and the kernel segment, so the dummy segment will get a 26 non-zero load address. It's not enough to always create the 27 "notes" segment, since if nothing gets assigned to it, its load 28 address will be zero. */ 29} 30 31#ifdef CONFIG_PPC64 32OUTPUT_ARCH(powerpc:common64) 33jiffies = jiffies_64; 34#else 35OUTPUT_ARCH(powerpc:common) 36jiffies = jiffies_64 + 4; 37#endif 38SECTIONS 39{ 40 /* Sections to be discarded. */ 41 /DISCARD/ : { 42 *(.exitcall.exit) 43 EXIT_DATA 44 } 45 46 . = KERNELBASE; 47 48/* 49 * Text, read only data and other permanent read-only sections 50 */ 51 52 /* Text and gots */ 53 .text : AT(ADDR(.text) - LOAD_OFFSET) { 54 ALIGN_FUNCTION(); 55 *(.text.head) 56 _text = .; 57 *(.text .fixup .text.init.refok .exit.text.refok __ftr_alt_*) 58 SCHED_TEXT 59 LOCK_TEXT 60 KPROBES_TEXT 61 62#ifdef CONFIG_PPC32 63 *(.got1) 64 __got2_start = .; 65 *(.got2) 66 __got2_end = .; 67#endif /* CONFIG_PPC32 */ 68 69 } :kernel 70 71 . = ALIGN(PAGE_SIZE); 72 _etext = .; 73 PROVIDE32 (etext = .); 74 75 /* Read-only data */ 76 RODATA 77 78 /* Exception & bug tables */ 79 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { 80 __start___ex_table = .; 81 *(__ex_table) 82 __stop___ex_table = .; 83 } 84 85 NOTES :kernel :notes 86 87 /* The dummy segment contents for the bug workaround mentioned above 88 near PHDRS. */ 89 .dummy : AT(ADDR(.dummy) - LOAD_OFFSET) { 90 LONG(0) 91 LONG(0) 92 LONG(0) 93 } :kernel :dummy 94 95/* 96 * Init sections discarded at runtime 97 */ 98 . = ALIGN(PAGE_SIZE); 99 __init_begin = .; 100 101 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { 102 _sinittext = .; 103 INIT_TEXT 104 _einittext = .; 105 } :kernel 106 107 /* .exit.text is discarded at runtime, not link time, 108 * to deal with references from __bug_table 109 */ 110 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { 111 EXIT_TEXT 112 } 113 114 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { 115 INIT_DATA 116 __vtop_table_begin = .; 117 *(.vtop_fixup); 118 __vtop_table_end = .; 119 __ptov_table_begin = .; 120 *(.ptov_fixup); 121 __ptov_table_end = .; 122#ifdef CONFIG_PPC_ISERIES 123 __dt_strings_start = .; 124 *(.dt_strings); 125 __dt_strings_end = .; 126#endif 127 } 128 129 . = ALIGN(16); 130 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { 131 __setup_start = .; 132 *(.init.setup) 133 __setup_end = .; 134 } 135 136 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { 137 __initcall_start = .; 138 INITCALLS 139 __initcall_end = .; 140 } 141 142 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { 143 __con_initcall_start = .; 144 *(.con_initcall.init) 145 __con_initcall_end = .; 146 } 147 148 SECURITY_INIT 149 150 . = ALIGN(8); 151 __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) { 152 __start___ftr_fixup = .; 153 *(__ftr_fixup) 154 __stop___ftr_fixup = .; 155 } 156 . = ALIGN(8); 157 __mmu_ftr_fixup : AT(ADDR(__mmu_ftr_fixup) - LOAD_OFFSET) { 158 __start___mmu_ftr_fixup = .; 159 *(__mmu_ftr_fixup) 160 __stop___mmu_ftr_fixup = .; 161 } 162 . = ALIGN(8); 163 __lwsync_fixup : AT(ADDR(__lwsync_fixup) - LOAD_OFFSET) { 164 __start___lwsync_fixup = .; 165 *(__lwsync_fixup) 166 __stop___lwsync_fixup = .; 167 } 168#ifdef CONFIG_PPC64 169 . = ALIGN(8); 170 __fw_ftr_fixup : AT(ADDR(__fw_ftr_fixup) - LOAD_OFFSET) { 171 __start___fw_ftr_fixup = .; 172 *(__fw_ftr_fixup) 173 __stop___fw_ftr_fixup = .; 174 } 175#endif 176#ifdef CONFIG_BLK_DEV_INITRD 177 . = ALIGN(PAGE_SIZE); 178 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { 179 __initramfs_start = .; 180 *(.init.ramfs) 181 __initramfs_end = .; 182 } 183#endif 184 . = ALIGN(PAGE_SIZE); 185 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { 186 __per_cpu_start = .; 187 *(.data.percpu) 188 *(.data.percpu.shared_aligned) 189 __per_cpu_end = .; 190 } 191 192 . = ALIGN(8); 193 .machine.desc : AT(ADDR(.machine.desc) - LOAD_OFFSET) { 194 __machine_desc_start = . ; 195 *(.machine.desc) 196 __machine_desc_end = . ; 197 } 198#ifdef CONFIG_RELOCATABLE 199 . = ALIGN(8); 200 .dynsym : AT(ADDR(.dynsym) - LOAD_OFFSET) { *(.dynsym) } 201 .dynstr : AT(ADDR(.dynstr) - LOAD_OFFSET) { *(.dynstr) } 202 .dynamic : AT(ADDR(.dynamic) - LOAD_OFFSET) 203 { 204 __dynamic_start = .; 205 *(.dynamic) 206 } 207 .hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) } 208 .interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) } 209 .rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET) 210 { 211 __rela_dyn_start = .; 212 *(.rela*) 213 } 214#endif 215 216 /* freed after init ends here */ 217 . = ALIGN(PAGE_SIZE); 218 __init_end = .; 219 220/* 221 * And now the various read/write data 222 */ 223 224 . = ALIGN(PAGE_SIZE); 225 _sdata = .; 226 227#ifdef CONFIG_PPC32 228 .data : AT(ADDR(.data) - LOAD_OFFSET) { 229 DATA_DATA 230 *(.sdata) 231 *(.got.plt) *(.got) 232 } 233#else 234 .data : AT(ADDR(.data) - LOAD_OFFSET) { 235 DATA_DATA 236 *(.data.rel*) 237 *(.toc1) 238 *(.branch_lt) 239 } 240 241 .opd : AT(ADDR(.opd) - LOAD_OFFSET) { 242 *(.opd) 243 } 244 245 .got : AT(ADDR(.got) - LOAD_OFFSET) { 246 __toc_start = .; 247 *(.got) 248 *(.toc) 249 } 250#endif 251 252 . = ALIGN(PAGE_SIZE); 253 _edata = .; 254 PROVIDE32 (edata = .); 255 256 /* The initial task and kernel stack */ 257#ifdef CONFIG_PPC32 258 . = ALIGN(8192); 259#else 260 . = ALIGN(16384); 261#endif 262 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { 263 *(.data.init_task) 264 } 265 266 . = ALIGN(PAGE_SIZE); 267 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { 268 *(.data.page_aligned) 269 } 270 271 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { 272 *(.data.cacheline_aligned) 273 } 274 275 . = ALIGN(L1_CACHE_BYTES); 276 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { 277 *(.data.read_mostly) 278 } 279 280 . = ALIGN(PAGE_SIZE); 281 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { 282 __nosave_begin = .; 283 *(.data.nosave) 284 . = ALIGN(PAGE_SIZE); 285 __nosave_end = .; 286 } 287 288/* 289 * And finally the bss 290 */ 291 292 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { 293 __bss_start = .; 294 *(.sbss) *(.scommon) 295 *(.dynbss) 296 *(.bss) 297 *(COMMON) 298 __bss_stop = .; 299 } 300 301 . = ALIGN(PAGE_SIZE); 302 _end = . ; 303 PROVIDE32 (end = .); 304} 305