vmlinux.lds.S (3ce9925823c7d6bb0e6eb951bf2db0e9e182582d) vmlinux.lds.S (8754e67ad4ac692c67ff1f99c0d07156f04ae40c)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * ld script for the x86 kernel
4 *
5 * Historic 32-bit version written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
6 *
7 * Modernisation, unification and other changes and fixes:
8 * Copyright (C) 2007-2009 Sam Ravnborg <sam@ravnborg.org>

--- 452 unchanged lines hidden (view full) ---

461
462 .rela.dyn : {
463 *(.rela.*) *(.rela_*)
464 }
465 ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!")
466}
467
468/*
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * ld script for the x86 kernel
4 *
5 * Historic 32-bit version written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
6 *
7 * Modernisation, unification and other changes and fixes:
8 * Copyright (C) 2007-2009 Sam Ravnborg <sam@ravnborg.org>

--- 452 unchanged lines hidden (view full) ---

461
462 .rela.dyn : {
463 *(.rela.*) *(.rela_*)
464 }
465 ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!")
466}
467
468/*
469 * COMPILE_TEST kernels can be large - CONFIG_KASAN, for example, can cause
470 * this. Let's assume that nobody will be running a COMPILE_TEST kernel and
471 * let's assert that fuller build coverage is more valuable than being able to
472 * run a COMPILE_TEST kernel.
469 * The ASSERT() sink to . is intentional, for binutils 2.14 compatibility:
473 */
470 */
474#ifndef CONFIG_COMPILE_TEST
475/*
476 * The ASSERT() sync to . is intentional, for binutils 2.14 compatibility:
477 */
478. = ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),
479 "kernel image bigger than KERNEL_IMAGE_SIZE");
471. = ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),
472 "kernel image bigger than KERNEL_IMAGE_SIZE");
480#endif
481
482/* needed for Clang - see arch/x86/entry/entry.S */
483PROVIDE(__ref_stack_chk_guard = __stack_chk_guard);
484
485#ifdef CONFIG_X86_64
486
487#ifdef CONFIG_MITIGATION_UNRET_ENTRY
488. = ASSERT((retbleed_return_thunk & 0x3f) == 0, "retbleed_return_thunk not cacheline-aligned");

--- 11 unchanged lines hidden (view full) ---

500 * Instead do: (A | B) - (A & B) in order to compute the XOR
501 * of the two function addresses:
502 */
503. = ASSERT(((ABSOLUTE(srso_alias_untrain_ret) | srso_alias_safe_ret) -
504 (ABSOLUTE(srso_alias_untrain_ret) & srso_alias_safe_ret)) == ((1 << 2) | (1 << 8) | (1 << 14) | (1 << 20)),
505 "SRSO function pair won't alias");
506#endif
507
473
474/* needed for Clang - see arch/x86/entry/entry.S */
475PROVIDE(__ref_stack_chk_guard = __stack_chk_guard);
476
477#ifdef CONFIG_X86_64
478
479#ifdef CONFIG_MITIGATION_UNRET_ENTRY
480. = ASSERT((retbleed_return_thunk & 0x3f) == 0, "retbleed_return_thunk not cacheline-aligned");

--- 11 unchanged lines hidden (view full) ---

492 * Instead do: (A | B) - (A & B) in order to compute the XOR
493 * of the two function addresses:
494 */
495. = ASSERT(((ABSOLUTE(srso_alias_untrain_ret) | srso_alias_safe_ret) -
496 (ABSOLUTE(srso_alias_untrain_ret) & srso_alias_safe_ret)) == ((1 << 2) | (1 << 8) | (1 << 14) | (1 << 20)),
497 "SRSO function pair won't alias");
498#endif
499
500#if defined(CONFIG_MITIGATION_ITS) && !defined(CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B)
501. = ASSERT(__x86_indirect_its_thunk_rax & 0x20, "__x86_indirect_thunk_rax not in second half of cacheline");
502. = ASSERT(((__x86_indirect_its_thunk_rcx - __x86_indirect_its_thunk_rax) % 64) == 0, "Indirect thunks are not cacheline apart");
503. = ASSERT(__x86_indirect_its_thunk_array == __x86_indirect_its_thunk_rax, "Gap in ITS thunk array");
504#endif
505
508#endif /* CONFIG_X86_64 */
509
510/*
511 * The symbols below are referenced using relative relocations in the
512 * respective ELF notes. This produces build time constants that the
513 * linker will never mark as relocatable. (Using just ABSOLUTE() is not
514 * sufficient for that).
515 */
516#ifdef CONFIG_XEN_PV
517xen_elfnote_entry_value =
518 ABSOLUTE(xen_elfnote_entry) + ABSOLUTE(startup_xen);
519#endif
520#ifdef CONFIG_PVH
521xen_elfnote_phys32_entry_value =
522 ABSOLUTE(xen_elfnote_phys32_entry) + ABSOLUTE(pvh_start_xen - LOAD_OFFSET);
523#endif
506#endif /* CONFIG_X86_64 */
507
508/*
509 * The symbols below are referenced using relative relocations in the
510 * respective ELF notes. This produces build time constants that the
511 * linker will never mark as relocatable. (Using just ABSOLUTE() is not
512 * sufficient for that).
513 */
514#ifdef CONFIG_XEN_PV
515xen_elfnote_entry_value =
516 ABSOLUTE(xen_elfnote_entry) + ABSOLUTE(startup_xen);
517#endif
518#ifdef CONFIG_PVH
519xen_elfnote_phys32_entry_value =
520 ABSOLUTE(xen_elfnote_phys32_entry) + ABSOLUTE(pvh_start_xen - LOAD_OFFSET);
521#endif