.. | .. |
---|
21 | 21 | #define LOAD_OFFSET __START_KERNEL_map |
---|
22 | 22 | #endif |
---|
23 | 23 | |
---|
| 24 | +#define RUNTIME_DISCARD_EXIT |
---|
| 25 | +#define EMITS_PT_NOTE |
---|
| 26 | +#define RO_EXCEPTION_TABLE_ALIGN 16 |
---|
| 27 | + |
---|
24 | 28 | #include <asm-generic/vmlinux.lds.h> |
---|
25 | 29 | #include <asm/asm-offsets.h> |
---|
26 | 30 | #include <asm/thread_info.h> |
---|
.. | .. |
---|
31 | 35 | |
---|
32 | 36 | #undef i386 /* in case the preprocessor is a 32bit one */ |
---|
33 | 37 | |
---|
34 | | -OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT) |
---|
| 38 | +OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT) |
---|
35 | 39 | |
---|
36 | 40 | #ifdef CONFIG_X86_32 |
---|
37 | 41 | OUTPUT_ARCH(i386) |
---|
.. | .. |
---|
130 | 134 | KPROBES_TEXT |
---|
131 | 135 | ALIGN_ENTRY_TEXT_BEGIN |
---|
132 | 136 | ENTRY_TEXT |
---|
133 | | - IRQENTRY_TEXT |
---|
134 | 137 | ALIGN_ENTRY_TEXT_END |
---|
135 | 138 | SOFTIRQENTRY_TEXT |
---|
| 139 | + STATIC_CALL_TEXT |
---|
136 | 140 | *(.fixup) |
---|
137 | 141 | *(.gnu.warning) |
---|
138 | 142 | |
---|
139 | | -#ifdef CONFIG_X86_64 |
---|
140 | | - . = ALIGN(PAGE_SIZE); |
---|
141 | | - __entry_trampoline_start = .; |
---|
142 | | - _entry_trampoline = .; |
---|
143 | | - *(.entry_trampoline) |
---|
144 | | - . = ALIGN(PAGE_SIZE); |
---|
145 | | - __entry_trampoline_end = .; |
---|
146 | | - ASSERT(. - _entry_trampoline == PAGE_SIZE, "entry trampoline is too big"); |
---|
147 | | -#endif |
---|
148 | | - |
---|
149 | 143 | #ifdef CONFIG_RETPOLINE |
---|
150 | 144 | __indirect_thunk_start = .; |
---|
151 | | - *(.text.__x86.indirect_thunk) |
---|
| 145 | + *(.text.__x86.*) |
---|
152 | 146 | __indirect_thunk_end = .; |
---|
153 | 147 | #endif |
---|
154 | | - |
---|
155 | | -#ifdef CONFIG_CFI_CLANG |
---|
156 | | - . = ALIGN(PAGE_SIZE); |
---|
157 | | - __cfi_jt_start = .; |
---|
158 | | - *(.text..L.cfi.jumptable .text..L.cfi.jumptable.*) |
---|
159 | | - __cfi_jt_end = .; |
---|
160 | | -#endif |
---|
161 | | - } :text = 0x9090 |
---|
162 | | - |
---|
163 | | - NOTES :text :note |
---|
164 | | - |
---|
165 | | - EXCEPTION_TABLE(16) :text = 0x9090 |
---|
| 148 | + } :text =0xcccc |
---|
166 | 149 | |
---|
167 | 150 | /* End of text section, which should occupy whole number of pages */ |
---|
168 | 151 | _etext = .; |
---|
.. | .. |
---|
211 | 194 | __vvar_beginning_hack = .; |
---|
212 | 195 | |
---|
213 | 196 | /* Place all vvars at the offsets in asm/vvar.h. */ |
---|
214 | | -#define EMIT_VVAR(name, offset) \ |
---|
| 197 | +#define EMIT_VVAR(name, offset) \ |
---|
215 | 198 | . = __vvar_beginning_hack + offset; \ |
---|
216 | 199 | *(.vvar_ ## name) |
---|
217 | | -#define __VVAR_KERNEL_LDS |
---|
218 | 200 | #include <asm/vvar.h> |
---|
219 | | -#undef __VVAR_KERNEL_LDS |
---|
220 | 201 | #undef EMIT_VVAR |
---|
221 | 202 | |
---|
222 | 203 | /* |
---|
.. | .. |
---|
291 | 272 | __parainstructions_end = .; |
---|
292 | 273 | } |
---|
293 | 274 | |
---|
| 275 | +#ifdef CONFIG_RETPOLINE |
---|
| 276 | + /* |
---|
| 277 | + * List of instructions that call/jmp/jcc to retpoline thunks |
---|
| 278 | + * __x86_indirect_thunk_*(). These instructions can be patched along |
---|
| 279 | + * with alternatives, after which the section can be freed. |
---|
| 280 | + */ |
---|
| 281 | + . = ALIGN(8); |
---|
| 282 | + .retpoline_sites : AT(ADDR(.retpoline_sites) - LOAD_OFFSET) { |
---|
| 283 | + __retpoline_sites = .; |
---|
| 284 | + *(.retpoline_sites) |
---|
| 285 | + __retpoline_sites_end = .; |
---|
| 286 | + } |
---|
| 287 | + |
---|
| 288 | + . = ALIGN(8); |
---|
| 289 | + .return_sites : AT(ADDR(.return_sites) - LOAD_OFFSET) { |
---|
| 290 | + __return_sites = .; |
---|
| 291 | + *(.return_sites) |
---|
| 292 | + __return_sites_end = .; |
---|
| 293 | + } |
---|
| 294 | +#endif |
---|
| 295 | + |
---|
294 | 296 | /* |
---|
295 | 297 | * struct alt_inst entries. From the header (alternative.h): |
---|
296 | 298 | * "Alternative instructions for different CPU types or capabilities" |
---|
.. | .. |
---|
333 | 335 | |
---|
334 | 336 | . = ALIGN(8); |
---|
335 | 337 | /* |
---|
336 | | - * .exit.text is discard at runtime, not link time, to deal with |
---|
337 | | - * references from .altinstructions and .eh_frame |
---|
| 338 | + * .exit.text is discarded at runtime, not link time, to deal with |
---|
| 339 | + * references from .altinstructions |
---|
338 | 340 | */ |
---|
339 | 341 | .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { |
---|
340 | 342 | EXIT_TEXT |
---|
.. | .. |
---|
385 | 387 | __bss_stop = .; |
---|
386 | 388 | } |
---|
387 | 389 | |
---|
| 390 | + /* |
---|
| 391 | + * The memory occupied from _text to here, __end_of_kernel_reserve, is |
---|
| 392 | + * automatically reserved in setup_arch(). Anything after here must be |
---|
| 393 | + * explicitly reserved using memblock_reserve() or it will be discarded |
---|
| 394 | + * and treated as available memory. |
---|
| 395 | + */ |
---|
| 396 | + __end_of_kernel_reserve = .; |
---|
| 397 | + |
---|
388 | 398 | . = ALIGN(PAGE_SIZE); |
---|
389 | 399 | .brk : AT(ADDR(.brk) - LOAD_OFFSET) { |
---|
390 | 400 | __brk_base = .; |
---|
.. | .. |
---|
396 | 406 | . = ALIGN(PAGE_SIZE); /* keep VO_INIT_SIZE page aligned */ |
---|
397 | 407 | _end = .; |
---|
398 | 408 | |
---|
| 409 | +#ifdef CONFIG_AMD_MEM_ENCRYPT |
---|
| 410 | + /* |
---|
| 411 | + * Early scratch/workarea section: Lives outside of the kernel proper |
---|
| 412 | + * (_text - _end). |
---|
| 413 | + * |
---|
| 414 | + * Resides after _end because even though the .brk section is after |
---|
| 415 | + * __end_of_kernel_reserve, the .brk section is later reserved as a |
---|
| 416 | + * part of the kernel. Since it is located after __end_of_kernel_reserve |
---|
| 417 | + * it will be discarded and become part of the available memory. As |
---|
| 418 | + * such, it can only be used by very early boot code and must not be |
---|
| 419 | + * needed afterwards. |
---|
| 420 | + * |
---|
| 421 | + * Currently used by SME for performing in-place encryption of the |
---|
| 422 | + * kernel during boot. Resides on a 2MB boundary to simplify the |
---|
| 423 | + * pagetable setup used for SME in-place encryption. |
---|
| 424 | + */ |
---|
| 425 | + . = ALIGN(HPAGE_SIZE); |
---|
| 426 | + .init.scratch : AT(ADDR(.init.scratch) - LOAD_OFFSET) { |
---|
| 427 | + __init_scratch_begin = .; |
---|
| 428 | + *(.init.scratch) |
---|
| 429 | + . = ALIGN(HPAGE_SIZE); |
---|
| 430 | + __init_scratch_end = .; |
---|
| 431 | + } |
---|
| 432 | +#endif |
---|
| 433 | + |
---|
399 | 434 | STABS_DEBUG |
---|
400 | 435 | DWARF_DEBUG |
---|
| 436 | + ELF_DETAILS |
---|
401 | 437 | |
---|
402 | | - /* Sections to be discarded */ |
---|
403 | 438 | DISCARDS |
---|
404 | | - /DISCARD/ : { |
---|
405 | | - *(.eh_frame) |
---|
406 | | - } |
---|
407 | | -} |
---|
408 | 439 | |
---|
| 440 | + /* |
---|
| 441 | + * Make sure that the .got.plt is either completely empty or it |
---|
| 442 | + * contains only the lazy dispatch entries. |
---|
| 443 | + */ |
---|
| 444 | + .got.plt (INFO) : { *(.got.plt) } |
---|
| 445 | + ASSERT(SIZEOF(.got.plt) == 0 || |
---|
| 446 | +#ifdef CONFIG_X86_64 |
---|
| 447 | + SIZEOF(.got.plt) == 0x18, |
---|
| 448 | +#else |
---|
| 449 | + SIZEOF(.got.plt) == 0xc, |
---|
| 450 | +#endif |
---|
| 451 | + "Unexpected GOT/PLT entries detected!") |
---|
| 452 | + |
---|
| 453 | + /* |
---|
| 454 | + * Sections that should stay zero sized, which is safer to |
---|
| 455 | + * explicitly check instead of blindly discarding. |
---|
| 456 | + */ |
---|
| 457 | + .got : { |
---|
| 458 | + *(.got) *(.igot.*) |
---|
| 459 | + } |
---|
| 460 | + ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!") |
---|
| 461 | + |
---|
| 462 | + .plt : { |
---|
| 463 | + *(.plt) *(.plt.*) *(.iplt) |
---|
| 464 | + } |
---|
| 465 | + ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") |
---|
| 466 | + |
---|
| 467 | + .rel.dyn : { |
---|
| 468 | + *(.rel.*) *(.rel_*) |
---|
| 469 | + } |
---|
| 470 | + ASSERT(SIZEOF(.rel.dyn) == 0, "Unexpected run-time relocations (.rel) detected!") |
---|
| 471 | + |
---|
| 472 | + .rela.dyn : { |
---|
| 473 | + *(.rela.*) *(.rela_*) |
---|
| 474 | + } |
---|
| 475 | + ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!") |
---|
| 476 | +} |
---|
409 | 477 | |
---|
410 | 478 | #ifdef CONFIG_X86_32 |
---|
411 | 479 | /* |
---|
.. | .. |
---|
420 | 488 | */ |
---|
421 | 489 | #define INIT_PER_CPU(x) init_per_cpu__##x = ABSOLUTE(x) + __per_cpu_load |
---|
422 | 490 | INIT_PER_CPU(gdt_page); |
---|
423 | | -INIT_PER_CPU(irq_stack_union); |
---|
| 491 | +INIT_PER_CPU(fixed_percpu_data); |
---|
| 492 | +INIT_PER_CPU(irq_stack_backing_store); |
---|
424 | 493 | |
---|
425 | 494 | /* |
---|
426 | 495 | * Build-time check on the image size: |
---|
.. | .. |
---|
429 | 498 | "kernel image bigger than KERNEL_IMAGE_SIZE"); |
---|
430 | 499 | |
---|
431 | 500 | #ifdef CONFIG_SMP |
---|
432 | | -. = ASSERT((irq_stack_union == 0), |
---|
433 | | - "irq_stack_union is not at start of per-cpu area"); |
---|
| 501 | +. = ASSERT((fixed_percpu_data == 0), |
---|
| 502 | + "fixed_percpu_data is not at start of per-cpu area"); |
---|
434 | 503 | #endif |
---|
435 | 504 | |
---|
436 | 505 | #endif /* CONFIG_X86_32 */ |
---|