| .. | .. |
|---|
| 4 | 4 | #else |
|---|
| 5 | 5 | #define PROVIDE32(x) PROVIDE(x) |
|---|
| 6 | 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 | + |
|---|
| 7 | 13 | #include <asm/page.h> |
|---|
| 8 | 14 | #include <asm-generic/vmlinux.lds.h> |
|---|
| 9 | 15 | #include <asm/cache.h> |
|---|
| 10 | 16 | #include <asm/thread_info.h> |
|---|
| 11 | 17 | |
|---|
| 12 | | -#if defined(CONFIG_STRICT_KERNEL_RWX) && !defined(CONFIG_PPC32) |
|---|
| 13 | | -#define STRICT_ALIGN_SIZE (1 << 24) |
|---|
| 14 | | -#else |
|---|
| 15 | | -#define STRICT_ALIGN_SIZE PAGE_SIZE |
|---|
| 16 | | -#endif |
|---|
| 18 | +#define STRICT_ALIGN_SIZE (1 << CONFIG_DATA_SHIFT) |
|---|
| 17 | 19 | |
|---|
| 18 | 20 | ENTRY(_stext) |
|---|
| 19 | 21 | |
|---|
| 20 | 22 | PHDRS { |
|---|
| 21 | | - kernel PT_LOAD FLAGS(7); /* RWX */ |
|---|
| 22 | | - notes PT_NOTE FLAGS(0); |
|---|
| 23 | | - dummy PT_NOTE FLAGS(0); |
|---|
| 24 | | - |
|---|
| 25 | | - /* binutils < 2.18 has a bug that makes it misbehave when taking an |
|---|
| 26 | | - ELF file with all segments at load address 0 as input. This |
|---|
| 27 | | - happens when running "strip" on vmlinux, because of the AT() magic |
|---|
| 28 | | - in this linker script. People using GCC >= 4.2 won't run into |
|---|
| 29 | | - this problem, because the "build-id" support will put some data |
|---|
| 30 | | - into the "notes" segment (at a non-zero load address). |
|---|
| 31 | | - |
|---|
| 32 | | - To work around this, we force some data into both the "dummy" |
|---|
| 33 | | - segment and the kernel segment, so the dummy segment will get a |
|---|
| 34 | | - non-zero load address. It's not enough to always create the |
|---|
| 35 | | - "notes" segment, since if nothing gets assigned to it, its load |
|---|
| 36 | | - address will be zero. */ |
|---|
| 23 | + text PT_LOAD FLAGS(7); /* RWX */ |
|---|
| 24 | + note PT_NOTE FLAGS(0); |
|---|
| 37 | 25 | } |
|---|
| 38 | 26 | |
|---|
| 39 | 27 | #ifdef CONFIG_PPC64 |
|---|
| .. | .. |
|---|
| 77 | 65 | #else /* !CONFIG_PPC64 */ |
|---|
| 78 | 66 | HEAD_TEXT |
|---|
| 79 | 67 | #endif |
|---|
| 80 | | - } :kernel |
|---|
| 68 | + } :text |
|---|
| 81 | 69 | |
|---|
| 82 | 70 | __head_end = .; |
|---|
| 83 | 71 | |
|---|
| 84 | 72 | #ifdef CONFIG_PPC64 |
|---|
| 85 | 73 | /* |
|---|
| 86 | | - * BLOCK(0) overrides the default output section alignment because |
|---|
| 74 | + * ALIGN(0) overrides the default output section alignment because |
|---|
| 87 | 75 | * this needs to start right after .head.text in order for fixed |
|---|
| 88 | 76 | * section placement to work. |
|---|
| 89 | 77 | */ |
|---|
| 90 | | - .text BLOCK(0) : AT(ADDR(.text) - LOAD_OFFSET) { |
|---|
| 78 | + .text ALIGN(0) : AT(ADDR(.text) - LOAD_OFFSET) { |
|---|
| 91 | 79 | #ifdef CONFIG_LD_HEAD_STUB_CATCH |
|---|
| 92 | 80 | KEEP(*(.linker_stub_catch)); |
|---|
| 93 | 81 | . = . ; |
|---|
| .. | .. |
|---|
| 98 | 86 | ALIGN_FUNCTION(); |
|---|
| 99 | 87 | #endif |
|---|
| 100 | 88 | /* careful! __ftr_alt_* sections need to be close to .text */ |
|---|
| 101 | | - *(.text.hot TEXT_MAIN .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text); |
|---|
| 89 | + *(.text.hot .text.hot.* TEXT_MAIN .text.fixup .text.unlikely .text.unlikely.* .fixup __ftr_alt_* .ref.text); |
|---|
| 90 | +#ifdef CONFIG_PPC64 |
|---|
| 91 | + *(.tramp.ftrace.text); |
|---|
| 92 | +#endif |
|---|
| 102 | 93 | NOINSTR_TEXT |
|---|
| 103 | 94 | SCHED_TEXT |
|---|
| 104 | 95 | CPUIDLE_TEXT |
|---|
| .. | .. |
|---|
| 124 | 115 | __got2_end = .; |
|---|
| 125 | 116 | #endif /* CONFIG_PPC32 */ |
|---|
| 126 | 117 | |
|---|
| 127 | | - } :kernel |
|---|
| 118 | + } :text |
|---|
| 128 | 119 | |
|---|
| 129 | 120 | . = ALIGN(PAGE_SIZE); |
|---|
| 130 | 121 | _etext = .; |
|---|
| .. | .. |
|---|
| 153 | 144 | __start___entry_flush_fixup = .; |
|---|
| 154 | 145 | *(__entry_flush_fixup) |
|---|
| 155 | 146 | __stop___entry_flush_fixup = .; |
|---|
| 147 | + } |
|---|
| 148 | + |
|---|
| 149 | + . = ALIGN(8); |
|---|
| 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 = .; |
|---|
| 156 | 154 | } |
|---|
| 157 | 155 | |
|---|
| 158 | 156 | . = ALIGN(8); |
|---|
| .. | .. |
|---|
| 187 | 185 | __stop__btb_flush_fixup = .; |
|---|
| 188 | 186 | } |
|---|
| 189 | 187 | #endif |
|---|
| 190 | | - EXCEPTION_TABLE(0) |
|---|
| 191 | | - |
|---|
| 192 | | - NOTES :kernel :notes |
|---|
| 193 | | - |
|---|
| 194 | | - /* The dummy segment contents for the bug workaround mentioned above |
|---|
| 195 | | - near PHDRS. */ |
|---|
| 196 | | - .dummy : AT(ADDR(.dummy) - LOAD_OFFSET) { |
|---|
| 197 | | - LONG(0) |
|---|
| 198 | | - LONG(0) |
|---|
| 199 | | - LONG(0) |
|---|
| 200 | | - } :kernel :dummy |
|---|
| 201 | 188 | |
|---|
| 202 | 189 | /* |
|---|
| 203 | 190 | * Init sections discarded at runtime |
|---|
| 204 | 191 | */ |
|---|
| 205 | 192 | . = ALIGN(STRICT_ALIGN_SIZE); |
|---|
| 206 | 193 | __init_begin = .; |
|---|
| 207 | | - INIT_TEXT_SECTION(PAGE_SIZE) :kernel |
|---|
| 194 | + . = ALIGN(PAGE_SIZE); |
|---|
| 195 | + .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { |
|---|
| 196 | + _sinittext = .; |
|---|
| 197 | + INIT_TEXT |
|---|
| 198 | + |
|---|
| 199 | + /* |
|---|
| 200 | + *.init.text might be RO so we must ensure this section ends on |
|---|
| 201 | + * a page boundary. |
|---|
| 202 | + */ |
|---|
| 203 | + . = ALIGN(PAGE_SIZE); |
|---|
| 204 | + _einittext = .; |
|---|
| 205 | +#ifdef CONFIG_PPC64 |
|---|
| 206 | + *(.tramp.ftrace.init); |
|---|
| 207 | +#endif |
|---|
| 208 | + } :text |
|---|
| 208 | 209 | |
|---|
| 209 | 210 | /* .exit.text is discarded at runtime, not link time, |
|---|
| 210 | 211 | * to deal with references from __bug_table |
|---|
| .. | .. |
|---|
| 213 | 214 | EXIT_TEXT |
|---|
| 214 | 215 | } |
|---|
| 215 | 216 | |
|---|
| 216 | | - .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { |
|---|
| 217 | | - INIT_DATA |
|---|
| 218 | | - __vtop_table_begin = .; |
|---|
| 219 | | - KEEP(*(.vtop_fixup)); |
|---|
| 220 | | - __vtop_table_end = .; |
|---|
| 221 | | - __ptov_table_begin = .; |
|---|
| 222 | | - KEEP(*(.ptov_fixup)); |
|---|
| 223 | | - __ptov_table_end = .; |
|---|
| 224 | | - } |
|---|
| 217 | + . = ALIGN(PAGE_SIZE); |
|---|
| 225 | 218 | |
|---|
| 226 | | - .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { |
|---|
| 227 | | - INIT_SETUP(16) |
|---|
| 228 | | - } |
|---|
| 229 | | - |
|---|
| 230 | | - .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { |
|---|
| 231 | | - INIT_CALLS |
|---|
| 232 | | - } |
|---|
| 233 | | - |
|---|
| 234 | | - .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { |
|---|
| 235 | | - CON_INITCALL |
|---|
| 236 | | - } |
|---|
| 237 | | - |
|---|
| 238 | | - SECURITY_INIT |
|---|
| 219 | + INIT_DATA_SECTION(16) |
|---|
| 239 | 220 | |
|---|
| 240 | 221 | . = ALIGN(8); |
|---|
| 241 | 222 | __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) { |
|---|
| .. | .. |
|---|
| 263 | 244 | __stop___fw_ftr_fixup = .; |
|---|
| 264 | 245 | } |
|---|
| 265 | 246 | #endif |
|---|
| 266 | | - .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { |
|---|
| 267 | | - INIT_RAM_FS |
|---|
| 268 | | - } |
|---|
| 269 | 247 | |
|---|
| 270 | 248 | PERCPU_SECTION(L1_CACHE_BYTES) |
|---|
| 271 | 249 | |
|---|
| .. | .. |
|---|
| 291 | 269 | *(.dynamic) |
|---|
| 292 | 270 | } |
|---|
| 293 | 271 | .hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) } |
|---|
| 272 | + .gnu.hash : AT(ADDR(.gnu.hash) - LOAD_OFFSET) { *(.gnu.hash) } |
|---|
| 294 | 273 | .interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) } |
|---|
| 295 | 274 | .rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET) |
|---|
| 296 | 275 | { |
|---|
| .. | .. |
|---|
| 328 | 307 | *(.sdata2) |
|---|
| 329 | 308 | *(.got.plt) *(.got) |
|---|
| 330 | 309 | *(.plt) |
|---|
| 310 | + *(.branch_lt) |
|---|
| 331 | 311 | } |
|---|
| 332 | 312 | #else |
|---|
| 333 | 313 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |
|---|
| 334 | 314 | DATA_DATA |
|---|
| 315 | +#ifdef CONFIG_UBSAN |
|---|
| 316 | + *(.data..Lubsan_data*) |
|---|
| 317 | + *(.data..Lubsan_type*) |
|---|
| 318 | +#endif |
|---|
| 335 | 319 | *(.data.rel*) |
|---|
| 336 | 320 | *(.toc1) |
|---|
| 337 | 321 | *(.branch_lt) |
|---|
| 338 | 322 | } |
|---|
| 339 | | - |
|---|
| 340 | | -#ifdef CONFIG_DEBUG_INFO_BTF |
|---|
| 341 | | - .BTF : AT(ADDR(.BTF) - LOAD_OFFSET) { |
|---|
| 342 | | - *(.BTF) |
|---|
| 343 | | - } |
|---|
| 344 | | -#endif |
|---|
| 345 | 323 | |
|---|
| 346 | 324 | .opd : AT(ADDR(.opd) - LOAD_OFFSET) { |
|---|
| 347 | 325 | __start_opd = .; |
|---|
| .. | .. |
|---|
| 363 | 341 | #endif |
|---|
| 364 | 342 | |
|---|
| 365 | 343 | /* The initial task and kernel stack */ |
|---|
| 366 | | - INIT_TASK_DATA_SECTION(THREAD_SIZE) |
|---|
| 344 | + INIT_TASK_DATA_SECTION(THREAD_ALIGN) |
|---|
| 367 | 345 | |
|---|
| 368 | 346 | .data..page_aligned : AT(ADDR(.data..page_aligned) - LOAD_OFFSET) { |
|---|
| 369 | 347 | PAGE_ALIGNED_DATA(PAGE_SIZE) |
|---|
| .. | .. |
|---|
| 399 | 377 | PROVIDE32 (end = .); |
|---|
| 400 | 378 | |
|---|
| 401 | 379 | STABS_DEBUG |
|---|
| 402 | | - |
|---|
| 403 | 380 | DWARF_DEBUG |
|---|
| 381 | + ELF_DETAILS |
|---|
| 404 | 382 | |
|---|
| 405 | 383 | DISCARDS |
|---|
| 406 | 384 | /DISCARD/ : { |
|---|
| 407 | 385 | *(*.EMB.apuinfo) |
|---|
| 408 | | - *(.glink .iplt .plt .rela* .comment) |
|---|
| 386 | + *(.glink .iplt .plt .comment) |
|---|
| 409 | 387 | *(.gnu.version*) |
|---|
| 410 | 388 | *(.gnu.attributes) |
|---|
| 411 | 389 | *(.eh_frame) |
|---|
| 390 | +#ifndef CONFIG_RELOCATABLE |
|---|
| 391 | + *(.rela*) |
|---|
| 392 | +#endif |
|---|
| 412 | 393 | } |
|---|
| 413 | 394 | } |
|---|