1 /* SPDX-License-Identifier: GPL-2.0 */ !! 1 /* ld script to make i386 Linux kernel 2 #ifdef CONFIG_PPC64 !! 2 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>; 3 #define PROVIDE32(x) PROVIDE(__unused__##x) !! 3 */ 4 #else << 5 #define PROVIDE32(x) PROVIDE(x) << 6 #endif << 7 << 8 #define BSS_FIRST_SECTIONS *(.bss.prominit) << 9 #define EMITS_PT_NOTE << 10 #define RO_EXCEPTION_TABLE_ALIGN 0 << 11 #define RUNTIME_DISCARD_EXIT << 12 << 13 #define SOFT_MASK_TABLE(align) << 14 . = ALIGN(align); << 15 __soft_mask_table : AT(ADDR(__soft_mas << 16 __start___soft_mask_table = .; << 17 KEEP(*(__soft_mask_table)) << 18 __stop___soft_mask_table = .; << 19 } << 20 << 21 #define RESTART_TABLE(align) << 22 . = ALIGN(align); << 23 __restart_table : AT(ADDR(__restart_ta << 24 __start___restart_table = .; << 25 KEEP(*(__restart_table)) << 26 __stop___restart_table = .; << 27 } << 28 4 29 #include <asm/page.h> << 30 #include <asm-generic/vmlinux.lds.h> 5 #include <asm-generic/vmlinux.lds.h> 31 #include <asm/cache.h> !! 6 32 #include <asm/thread_info.h> !! 7 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") 33 !! 8 OUTPUT_ARCH(i386) 34 #define STRICT_ALIGN_SIZE (1 << CONFIG_D !! 9 ENTRY(startup_32) 35 << 36 #if STRICT_ALIGN_SIZE < PAGE_SIZE << 37 #error "CONFIG_DATA_SHIFT must be >= PAGE_SHIF << 38 #endif << 39 << 40 ENTRY(_stext) << 41 << 42 PHDRS { << 43 text PT_LOAD FLAGS(7); /* RWX */ << 44 note PT_NOTE FLAGS(0); << 45 } << 46 << 47 #ifdef CONFIG_PPC64 << 48 OUTPUT_ARCH(powerpc:common64) << 49 jiffies = jiffies_64; 10 jiffies = jiffies_64; 50 #else << 51 OUTPUT_ARCH(powerpc:common) << 52 jiffies = jiffies_64 + 4; << 53 #endif << 54 SECTIONS 11 SECTIONS 55 { 12 { 56 . = KERNELBASE; !! 13 . = 0xC0000000 + 0x100000; 57 !! 14 /* read-only */ 58 /* !! 15 _text = .; /* Text and read-only data */ 59 * Text, read only data and other permanent re !! 16 .text : { 60 */ !! 17 *(.text) 61 !! 18 *(.fixup) 62 _text = .; !! 19 *(.gnu.warning) 63 _stext = .; !! 20 } = 0x9090 64 !! 21 65 /* !! 22 _etext = .; /* End of text section */ 66 * Head text. !! 23 67 * This needs to be in its own output !! 24 . = ALIGN(16); /* Exception table */ 68 * branch trampoline stubs randomly th !! 25 __start___ex_table = .; 69 * which it will do (even if the branc !! 26 __ex_table : { *(__ex_table) } 70 * in order to optimize stub generatio !! 27 __stop___ex_table = .; 71 */ !! 28 72 .head.text : AT(ADDR(.head.text) - LOA !! 29 RODATA 73 #ifdef CONFIG_PPC64 !! 30 74 KEEP(*(.head.text.first_256B)) !! 31 /* writeable */ 75 #ifdef CONFIG_PPC_BOOK3E_64 !! 32 .data : { /* Data */ 76 #else !! 33 *(.data) 77 KEEP(*(.head.text.real_vectors !! 34 CONSTRUCTORS 78 *(.head.text.real_trampolines) !! 35 } 79 KEEP(*(.head.text.virt_vectors !! 36 80 *(.head.text.virt_trampolines) !! 37 . = ALIGN(4096); 81 # if defined(CONFIG_PPC_PSERIES) || defined(CO !! 38 __nosave_begin = .; 82 KEEP(*(.head.data.fwnmi_page)) !! 39 .data_nosave : { *(.data.nosave) } 83 # endif !! 40 . = ALIGN(4096); 84 #endif !! 41 __nosave_end = .; 85 #else /* !CONFIG_PPC64 */ !! 42 86 HEAD_TEXT !! 43 . = ALIGN(4096); 87 #endif !! 44 .data.page_aligned : { *(.data.idt) } 88 } :text !! 45 89 !! 46 . = ALIGN(32); 90 __head_end = .; !! 47 .data.cacheline_aligned : { *(.data.cacheline_aligned) } 91 !! 48 92 #ifdef CONFIG_PPC64 !! 49 _edata = .; /* End of data section */ 93 /* !! 50 94 * ALIGN(0) overrides the default outp !! 51 . = ALIGN(8192); /* init_task */ 95 * this needs to start right after .he !! 52 .data.init_task : { *(.data.init_task) } 96 * section placement to work. !! 53 97 */ !! 54 /* will be freed after init */ 98 .text ALIGN(0) : AT(ADDR(.text) - LOAD !! 55 . = ALIGN(4096); /* Init code and data */ 99 #ifdef CONFIG_LD_HEAD_STUB_CATCH !! 56 __init_begin = .; 100 KEEP(*(.linker_stub_catch)); !! 57 .init.text : { 101 . = . ; !! 58 _sinittext = .; 102 #endif !! 59 *(.init.text) 103 !! 60 _einittext = .; 104 #else !! 61 } 105 .text : AT(ADDR(.text) - LOAD_OFFSET) !! 62 .init.data : { *(.init.data) } 106 ALIGN_FUNCTION(); !! 63 . = ALIGN(16); 107 #endif !! 64 __setup_start = .; 108 /* careful! __ftr_alt_* sectio !! 65 .init.setup : { *(.init.setup) } 109 *(.text.hot .text.hot.* TEXT_M !! 66 __setup_end = .; 110 *(.tramp.ftrace.text); !! 67 __start___param = .; 111 NOINSTR_TEXT !! 68 __param : { *(__param) } 112 SCHED_TEXT !! 69 __stop___param = .; 113 LOCK_TEXT !! 70 __initcall_start = .; 114 KPROBES_TEXT !! 71 .initcall.init : { 115 IRQENTRY_TEXT !! 72 *(.initcall1.init) 116 SOFTIRQENTRY_TEXT !! 73 *(.initcall2.init) 117 /* !! 74 *(.initcall3.init) 118 * -Os builds call FP save/res !! 75 *(.initcall4.init) 119 * linker generates those on d !! 76 *(.initcall5.init) 120 * .sfpr gets placed at the be !! 77 *(.initcall6.init) 121 * sections, which can break s !! 78 *(.initcall7.init) 122 * included with the main text !! 79 } 123 */ !! 80 __initcall_end = .; 124 *(.sfpr); !! 81 __con_initcall_start = .; 125 *(.text.asan.* .text.tsan.*) !! 82 .con_initcall.init : { *(.con_initcall.init) } 126 } :text !! 83 __con_initcall_end = .; 127 !! 84 SECURITY_INIT 128 . = ALIGN(PAGE_SIZE); !! 85 . = ALIGN(4); 129 _etext = .; !! 86 __alt_instructions = .; 130 PROVIDE32 (etext = .); !! 87 .altinstructions : { *(.altinstructions) } 131 !! 88 __alt_instructions_end = .; 132 /* Read-only data */ !! 89 .altinstr_replacement : { *(.altinstr_replacement) } 133 RO_DATA(PAGE_SIZE) !! 90 /* .exit.text is discard at runtime, not link time, to deal with references 134 !! 91 from .altinstructions and .eh_frame */ 135 #ifdef CONFIG_PPC32 !! 92 .exit.text : { *(.exit.text) } 136 .sdata2 : AT(ADDR(.sdata2) - LOAD_OFFS !! 93 .exit.data : { *(.exit.data) } 137 *(.sdata2) !! 94 . = ALIGN(4096); 138 } !! 95 __initramfs_start = .; 139 #endif !! 96 .init.ramfs : { *(.init.ramfs) } 140 !! 97 __initramfs_end = .; 141 .data.rel.ro : AT(ADDR(.data.rel.ro) - !! 98 . = ALIGN(32); 142 *(.data.rel.ro .data.rel.ro.*) !! 99 __per_cpu_start = .; 143 } !! 100 .data.percpu : { *(.data.percpu) } 144 !! 101 __per_cpu_end = .; 145 .branch_lt : AT(ADDR(.branch_lt) - LOA !! 102 . = ALIGN(4096); 146 *(.branch_lt) !! 103 __init_end = .; 147 } !! 104 /* freed after init ends here */ 148 !! 105 149 #ifdef CONFIG_PPC32 !! 106 __bss_start = .; /* BSS */ 150 .got1 : AT(ADDR(.got1) - LOAD_OFFSET) !! 107 .bss : { *(.bss) } 151 *(.got1) !! 108 __bss_stop = .; 152 } !! 109 153 .got2 : AT(ADDR(.got2) - LOAD_OFFSET) !! 110 _end = . ; 154 __got2_start = .; !! 111 155 *(.got2) !! 112 /* Sections to be discarded */ 156 __got2_end = .; !! 113 /DISCARD/ : { 157 } !! 114 *(.exitcall.exit) 158 .got : AT(ADDR(.got) - LOAD_OFFSET) { !! 115 } 159 *(.got) !! 116 160 *(.got.plt) !! 117 /* Stabs debugging sections. */ 161 } !! 118 .stab 0 : { *(.stab) } 162 .plt : AT(ADDR(.plt) - LOAD_OFFSET) { !! 119 .stabstr 0 : { *(.stabstr) } 163 /* XXX: is .plt (and .got.plt) !! 120 .stab.excl 0 : { *(.stab.excl) } 164 *(.plt) !! 121 .stab.exclstr 0 : { *(.stab.exclstr) } 165 } !! 122 .stab.index 0 : { *(.stab.index) } 166 !! 123 .stab.indexstr 0 : { *(.stab.indexstr) } 167 #else /* CONFIG_PPC32 */ !! 124 .comment 0 : { *(.comment) } 168 #ifndef CONFIG_PPC_KERNEL_PCREL << 169 .toc1 : AT(ADDR(.toc1) - LOAD_OFFSET) << 170 *(.toc1) << 171 } << 172 #endif << 173 << 174 .got : AT(ADDR(.got) - LOAD_OFFSET) AL << 175 #ifdef CONFIG_PPC_KERNEL_PCREL << 176 *(.got) << 177 #else << 178 *(.got .toc) << 179 #endif << 180 } << 181 << 182 SOFT_MASK_TABLE(8) << 183 RESTART_TABLE(8) << 184 << 185 #ifdef CONFIG_PPC64_ELF_ABI_V1 << 186 .opd : AT(ADDR(.opd) - LOAD_OFFSET) { << 187 __start_opd = .; << 188 KEEP(*(.opd)) << 189 __end_opd = .; << 190 } << 191 #endif << 192 << 193 . = ALIGN(8); << 194 __stf_entry_barrier_fixup : AT(ADDR(__ << 195 __start___stf_entry_barrier_fi << 196 *(__stf_entry_barrier_fixup) << 197 __stop___stf_entry_barrier_fix << 198 } << 199 << 200 . = ALIGN(8); << 201 __uaccess_flush_fixup : AT(ADDR(__uacc << 202 __start___uaccess_flush_fixup << 203 *(__uaccess_flush_fixup) << 204 __stop___uaccess_flush_fixup = << 205 } << 206 << 207 . = ALIGN(8); << 208 __entry_flush_fixup : AT(ADDR(__entry_ << 209 __start___entry_flush_fixup = << 210 *(__entry_flush_fixup) << 211 __stop___entry_flush_fixup = . << 212 } << 213 << 214 . = ALIGN(8); << 215 __scv_entry_flush_fixup : AT(ADDR(__sc << 216 __start___scv_entry_flush_fixu << 217 *(__scv_entry_flush_fixup) << 218 __stop___scv_entry_flush_fixup << 219 } << 220 << 221 . = ALIGN(8); << 222 __stf_exit_barrier_fixup : AT(ADDR(__s << 223 __start___stf_exit_barrier_fix << 224 *(__stf_exit_barrier_fixup) << 225 __stop___stf_exit_barrier_fixu << 226 } << 227 << 228 . = ALIGN(8); << 229 __rfi_flush_fixup : AT(ADDR(__rfi_flus << 230 __start___rfi_flush_fixup = .; << 231 *(__rfi_flush_fixup) << 232 __stop___rfi_flush_fixup = .; << 233 } << 234 #endif /* CONFIG_PPC32 */ << 235 << 236 #ifdef CONFIG_PPC_BARRIER_NOSPEC << 237 . = ALIGN(8); << 238 __spec_barrier_fixup : AT(ADDR(__spec_ << 239 __start___barrier_nospec_fixup << 240 *(__barrier_nospec_fixup) << 241 __stop___barrier_nospec_fixup << 242 } << 243 #endif /* CONFIG_PPC_BARRIER_NOSPEC */ << 244 << 245 #ifdef CONFIG_PPC_E500 << 246 . = ALIGN(8); << 247 __spec_btb_flush_fixup : AT(ADDR(__spe << 248 __start__btb_flush_fixup = .; << 249 *(__btb_flush_fixup) << 250 __stop__btb_flush_fixup = .; << 251 } << 252 #endif << 253 << 254 /* << 255 * Various code relies on __init_begin << 256 */ << 257 . = ALIGN(STRICT_ALIGN_SIZE); << 258 __srwx_boundary = .; << 259 __end_rodata = .; << 260 __init_begin = .; << 261 << 262 /* << 263 * Init sections discarded at runtime << 264 */ << 265 .init.text : AT(ADDR(.init.text) - LOA << 266 _sinittext = .; << 267 INIT_TEXT << 268 << 269 /* << 270 *.init.text might be RO so we << 271 * a page boundary. << 272 */ << 273 . = ALIGN(PAGE_SIZE); << 274 _einittext = .; << 275 *(.tramp.ftrace.init); << 276 } :text << 277 << 278 /* .exit.text is discarded at runtime, << 279 * to deal with references from __bug_ << 280 */ << 281 .exit.text : AT(ADDR(.exit.text) - LOA << 282 __exittext_begin = .; << 283 EXIT_TEXT << 284 __exittext_end = .; << 285 } << 286 << 287 . = ALIGN(PAGE_SIZE); << 288 << 289 INIT_DATA_SECTION(16) << 290 << 291 . = ALIGN(8); << 292 __ftr_fixup : AT(ADDR(__ftr_fixup) - L << 293 __start___ftr_fixup = .; << 294 KEEP(*(__ftr_fixup)) << 295 __stop___ftr_fixup = .; << 296 } << 297 . = ALIGN(8); << 298 __mmu_ftr_fixup : AT(ADDR(__mmu_ftr_fi << 299 __start___mmu_ftr_fixup = .; << 300 KEEP(*(__mmu_ftr_fixup)) << 301 __stop___mmu_ftr_fixup = .; << 302 } << 303 . = ALIGN(8); << 304 __lwsync_fixup : AT(ADDR(__lwsync_fixu << 305 __start___lwsync_fixup = .; << 306 KEEP(*(__lwsync_fixup)) << 307 __stop___lwsync_fixup = .; << 308 } << 309 #ifdef CONFIG_PPC64 << 310 . = ALIGN(8); << 311 __fw_ftr_fixup : AT(ADDR(__fw_ftr_fixu << 312 __start___fw_ftr_fixup = .; << 313 KEEP(*(__fw_ftr_fixup)) << 314 __stop___fw_ftr_fixup = .; << 315 } << 316 #endif << 317 << 318 PERCPU_SECTION(L1_CACHE_BYTES) << 319 << 320 . = ALIGN(8); << 321 .machine.desc : AT(ADDR(.machine.desc) << 322 __machine_desc_start = . ; << 323 KEEP(*(.machine.desc)) << 324 __machine_desc_end = . ; << 325 } << 326 #ifdef CONFIG_RELOCATABLE << 327 . = ALIGN(8); << 328 .dynsym : AT(ADDR(.dynsym) - LOAD_OFFS << 329 { << 330 __dynamic_symtab = .; << 331 *(.dynsym) << 332 } << 333 .dynstr : AT(ADDR(.dynstr) - LOAD_OFFS << 334 .dynamic : AT(ADDR(.dynamic) - LOAD_OF << 335 { << 336 __dynamic_start = .; << 337 *(.dynamic) << 338 } << 339 .hash : AT(ADDR(.hash) - LOAD_OFFSET) << 340 .gnu.hash : AT(ADDR(.gnu.hash) - LOAD_ << 341 .interp : AT(ADDR(.interp) - LOAD_OFFS << 342 .rela.dyn : AT(ADDR(.rela.dyn) - LOAD_ << 343 { << 344 __rela_dyn_start = .; << 345 *(.rela*) << 346 } << 347 #endif << 348 /* .exit.data is discarded at runtime, << 349 * to deal with references from .exit. << 350 */ << 351 .exit.data : AT(ADDR(.exit.data) - LOA << 352 EXIT_DATA << 353 } << 354 << 355 /* freed after init ends here */ << 356 . = ALIGN(PAGE_SIZE); << 357 __init_end = .; << 358 << 359 /* << 360 * And now the various read/write data << 361 */ << 362 << 363 . = ALIGN(PAGE_SIZE); << 364 _sdata = .; << 365 << 366 .data : AT(ADDR(.data) - LOAD_OFFSET) << 367 DATA_DATA << 368 *(.data.rel*) << 369 #ifdef CONFIG_PPC32 << 370 *(SDATA_MAIN) << 371 #endif << 372 } << 373 << 374 /* The initial task and kernel stack * << 375 INIT_TASK_DATA_SECTION(THREAD_ALIGN) << 376 << 377 .data..page_aligned : AT(ADDR(.data..p << 378 PAGE_ALIGNED_DATA(PAGE_SIZE) << 379 } << 380 << 381 .data..cacheline_aligned : AT(ADDR(.da << 382 CACHELINE_ALIGNED_DATA(L1_CACH << 383 } << 384 << 385 .data..read_mostly : AT(ADDR(.data..re << 386 READ_MOSTLY_DATA(L1_CACHE_BYTE << 387 } << 388 << 389 . = ALIGN(PAGE_SIZE); << 390 .data_nosave : AT(ADDR(.data_nosave) - << 391 NOSAVE_DATA << 392 } << 393 << 394 BUG_TABLE << 395 << 396 . = ALIGN(PAGE_SIZE); << 397 _edata = .; << 398 PROVIDE32 (edata = .); << 399 << 400 /* << 401 * And finally the bss << 402 */ << 403 << 404 BSS_SECTION(0, 0, 0) << 405 << 406 . = ALIGN(PAGE_SIZE); << 407 _end = . ; << 408 PROVIDE32 (end = .); << 409 << 410 DWARF_DEBUG << 411 ELF_DETAILS << 412 << 413 DISCARDS << 414 /DISCARD/ : { << 415 *(*.EMB.apuinfo) << 416 *(.glink .iplt .plt) << 417 *(.gnu.version*) << 418 *(.gnu.attributes) << 419 *(.eh_frame) << 420 #ifndef CONFIG_RELOCATABLE << 421 *(.rela*) << 422 #endif << 423 } << 424 } 125 }
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.