^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * ld script for the x86 kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Historic 32-bit version written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Modernisation, unification and other changes and fixes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Copyright (C) 2007-2009 Sam Ravnborg <sam@ravnborg.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * Don't define absolute symbols until and unless you know that symbol
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * value is should remain constant even if kernel image is relocated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * at run time. Absolute symbols are not relocated. If symbol value should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * change if kernel is relocated, make the symbol section relative and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * put it inside the section definition.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #ifdef CONFIG_X86_32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define LOAD_OFFSET __PAGE_OFFSET
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define LOAD_OFFSET __START_KERNEL_map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define RUNTIME_DISCARD_EXIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define EMITS_PT_NOTE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define RO_EXCEPTION_TABLE_ALIGN 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <asm-generic/vmlinux.lds.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include <asm/asm-offsets.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include <asm/thread_info.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #include <asm/page_types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #include <asm/orc_lookup.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #include <asm/cache.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #include <asm/boot.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #undef i386 /* in case the preprocessor is a 32bit one */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #ifdef CONFIG_X86_32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) OUTPUT_ARCH(i386)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) ENTRY(phys_startup_32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) OUTPUT_ARCH(i386:x86-64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) ENTRY(phys_startup_64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) jiffies = jiffies_64;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #if defined(CONFIG_X86_64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) * On 64-bit, align RODATA to 2MB so we retain large page mappings for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * boundaries spanning kernel text, rodata and data sections.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * However, kernel identity mappings will have different RWX permissions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * to the pages mapping to text and to the pages padding (which are freed) the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * text section. Hence kernel identity mappings will be broken to smaller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * pages. For 64-bit, kernel text and kernel identity mappings are different,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * so we can enable protection checks as well as retain 2MB large page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) * mappings for kernel text.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #define X86_ALIGN_RODATA_BEGIN . = ALIGN(HPAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define X86_ALIGN_RODATA_END \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) . = ALIGN(HPAGE_SIZE); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) __end_rodata_hpage_align = .; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) __end_rodata_aligned = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #define ALIGN_ENTRY_TEXT_BEGIN . = ALIGN(PMD_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define ALIGN_ENTRY_TEXT_END . = ALIGN(PMD_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * This section contains data which will be mapped as decrypted. Memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * encryption operates on a page basis. Make this section PMD-aligned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) * to avoid splitting the pages while mapping the section early.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * Note: We use a separate section so that only this section gets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) * decrypted to avoid exposing more than we wish.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #define BSS_DECRYPTED \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) . = ALIGN(PMD_SIZE); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) __start_bss_decrypted = .; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) *(.bss..decrypted); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) . = ALIGN(PAGE_SIZE); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) __start_bss_decrypted_unused = .; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) . = ALIGN(PMD_SIZE); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) __end_bss_decrypted = .; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #define X86_ALIGN_RODATA_BEGIN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #define X86_ALIGN_RODATA_END \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) . = ALIGN(PAGE_SIZE); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) __end_rodata_aligned = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) #define ALIGN_ENTRY_TEXT_BEGIN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) #define ALIGN_ENTRY_TEXT_END
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) #define BSS_DECRYPTED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) PHDRS {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) text PT_LOAD FLAGS(5); /* R_E */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) data PT_LOAD FLAGS(6); /* RW_ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #ifdef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) percpu PT_LOAD FLAGS(6); /* RW_ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) init PT_LOAD FLAGS(7); /* RWE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) note PT_NOTE FLAGS(0); /* ___ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) SECTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #ifdef CONFIG_X86_32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) phys_startup_32 = ABSOLUTE(startup_32 - LOAD_OFFSET);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) . = __START_KERNEL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) phys_startup_64 = ABSOLUTE(startup_64 - LOAD_OFFSET);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) /* Text and read-only data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) .text : AT(ADDR(.text) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) _text = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) _stext = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) /* bootstrapping code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) HEAD_TEXT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) TEXT_TEXT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) SCHED_TEXT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) CPUIDLE_TEXT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) LOCK_TEXT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) KPROBES_TEXT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) ALIGN_ENTRY_TEXT_BEGIN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) ENTRY_TEXT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) ALIGN_ENTRY_TEXT_END
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) SOFTIRQENTRY_TEXT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) STATIC_CALL_TEXT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) *(.fixup)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) *(.gnu.warning)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) #ifdef CONFIG_RETPOLINE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) __indirect_thunk_start = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) *(.text.__x86.indirect_thunk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) __indirect_thunk_end = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) } :text =0xcccc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) /* End of text section, which should occupy whole number of pages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) _etext = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) . = ALIGN(PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) X86_ALIGN_RODATA_BEGIN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) RO_DATA(PAGE_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) X86_ALIGN_RODATA_END
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /* Data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) .data : AT(ADDR(.data) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) /* Start of data section */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) _sdata = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) /* init_task */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) INIT_TASK_DATA(THREAD_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) #ifdef CONFIG_X86_32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) /* 32 bit has nosave before _edata */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) NOSAVE_DATA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) PAGE_ALIGNED_DATA(PAGE_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) DATA_DATA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) CONSTRUCTORS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) /* rarely changed data like cpu maps */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) READ_MOSTLY_DATA(INTERNODE_CACHE_BYTES)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) /* End of data section */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) _edata = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) } :data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) BUG_TABLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) ORC_UNWIND_TABLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) . = ALIGN(PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) __vvar_page = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) .vvar : AT(ADDR(.vvar) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) /* work around gold bug 13023 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) __vvar_beginning_hack = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) /* Place all vvars at the offsets in asm/vvar.h. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) #define EMIT_VVAR(name, offset) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) . = __vvar_beginning_hack + offset; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) *(.vvar_ ## name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) #include <asm/vvar.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) #undef EMIT_VVAR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) * Pad the rest of the page with zeros. Otherwise the loader
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) * can leave garbage here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) . = __vvar_beginning_hack + PAGE_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) } :data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) . = ALIGN(__vvar_page + PAGE_SIZE, PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) /* Init code and data - will be freed after init */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) . = ALIGN(PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) .init.begin : AT(ADDR(.init.begin) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) __init_begin = .; /* paired with __init_end */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) #if defined(CONFIG_X86_64) && defined(CONFIG_SMP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) * percpu offsets are zero-based on SMP. PERCPU_VADDR() changes the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) * output PHDR, so the next output section - .init.text - should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) * start another segment - init.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) PERCPU_VADDR(INTERNODE_CACHE_BYTES, 0, :percpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) ASSERT(SIZEOF(.data..percpu) < CONFIG_PHYSICAL_START,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) "per-CPU data too large - increase CONFIG_PHYSICAL_START")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) INIT_TEXT_SECTION(PAGE_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) :init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) * Section for code used exclusively before alternatives are run. All
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) * references to such code must be patched out by alternatives, normally
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) * by using X86_FEATURE_ALWAYS CPU feature bit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) * See static_cpu_has() for an example.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) .altinstr_aux : AT(ADDR(.altinstr_aux) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) *(.altinstr_aux)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) INIT_DATA_SECTION(16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) .x86_cpu_dev.init : AT(ADDR(.x86_cpu_dev.init) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) __x86_cpu_dev_start = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) *(.x86_cpu_dev.init)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) __x86_cpu_dev_end = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) #ifdef CONFIG_X86_INTEL_MID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) .x86_intel_mid_dev.init : AT(ADDR(.x86_intel_mid_dev.init) - \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) __x86_intel_mid_dev_start = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) *(.x86_intel_mid_dev.init)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) __x86_intel_mid_dev_end = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) * start address and size of operations which during runtime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) * can be patched with virtualization friendly instructions or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) * baremetal native ones. Think page table operations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) * Details in paravirt_types.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) . = ALIGN(8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) __parainstructions = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) *(.parainstructions)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) __parainstructions_end = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) * struct alt_inst entries. From the header (alternative.h):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) * "Alternative instructions for different CPU types or capabilities"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) * Think locking instructions on spinlocks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) . = ALIGN(8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) __alt_instructions = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) *(.altinstructions)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) __alt_instructions_end = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) * And here are the replacement instructions. The linker sticks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) * them as binary blobs. The .altinstructions has enough data to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) * get the address and the length of them to patch the kernel safely.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) *(.altinstr_replacement)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) * struct iommu_table_entry entries are injected in this section.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) * It is an array of IOMMUs which during run time gets sorted depending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) * on its dependency order. After rootfs_initcall is complete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) * this section can be safely removed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) .iommu_table : AT(ADDR(.iommu_table) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) __iommu_table = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) *(.iommu_table)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) __iommu_table_end = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) . = ALIGN(8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) .apicdrivers : AT(ADDR(.apicdrivers) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) __apicdrivers = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) *(.apicdrivers);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) __apicdrivers_end = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) . = ALIGN(8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) * .exit.text is discarded at runtime, not link time, to deal with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) * references from .altinstructions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) EXIT_TEXT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) EXIT_DATA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) #if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) PERCPU_SECTION(INTERNODE_CACHE_BYTES)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) . = ALIGN(PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) /* freed after init ends here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) .init.end : AT(ADDR(.init.end) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) __init_end = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) * smp_locks might be freed after init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) * start/end must be page aligned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) . = ALIGN(PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) __smp_locks = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) *(.smp_locks)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) . = ALIGN(PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) __smp_locks_end = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) NOSAVE_DATA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) /* BSS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) . = ALIGN(PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) __bss_start = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) *(.bss..page_aligned)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) . = ALIGN(PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) *(BSS_MAIN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) BSS_DECRYPTED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) . = ALIGN(PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) __bss_stop = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) * The memory occupied from _text to here, __end_of_kernel_reserve, is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) * automatically reserved in setup_arch(). Anything after here must be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) * explicitly reserved using memblock_reserve() or it will be discarded
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) * and treated as available memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) __end_of_kernel_reserve = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) . = ALIGN(PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) .brk : AT(ADDR(.brk) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) __brk_base = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) . += 64 * 1024; /* 64k alignment slop space */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) *(.brk_reservation) /* areas brk users have reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) __brk_limit = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) . = ALIGN(PAGE_SIZE); /* keep VO_INIT_SIZE page aligned */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) _end = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) #ifdef CONFIG_AMD_MEM_ENCRYPT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) * Early scratch/workarea section: Lives outside of the kernel proper
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) * (_text - _end).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) * Resides after _end because even though the .brk section is after
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) * __end_of_kernel_reserve, the .brk section is later reserved as a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) * part of the kernel. Since it is located after __end_of_kernel_reserve
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) * it will be discarded and become part of the available memory. As
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) * such, it can only be used by very early boot code and must not be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) * needed afterwards.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) * Currently used by SME for performing in-place encryption of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) * kernel during boot. Resides on a 2MB boundary to simplify the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) * pagetable setup used for SME in-place encryption.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) . = ALIGN(HPAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) .init.scratch : AT(ADDR(.init.scratch) - LOAD_OFFSET) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) __init_scratch_begin = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) *(.init.scratch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) . = ALIGN(HPAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) __init_scratch_end = .;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) STABS_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) DWARF_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) ELF_DETAILS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) DISCARDS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) * Make sure that the .got.plt is either completely empty or it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) * contains only the lazy dispatch entries.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) .got.plt (INFO) : { *(.got.plt) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) ASSERT(SIZEOF(.got.plt) == 0 ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) SIZEOF(.got.plt) == 0x18,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) SIZEOF(.got.plt) == 0xc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) "Unexpected GOT/PLT entries detected!")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) * Sections that should stay zero sized, which is safer to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) * explicitly check instead of blindly discarding.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) .got : {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) *(.got) *(.igot.*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) .plt : {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) *(.plt) *(.plt.*) *(.iplt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) .rel.dyn : {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) *(.rel.*) *(.rel_*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) ASSERT(SIZEOF(.rel.dyn) == 0, "Unexpected run-time relocations (.rel) detected!")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) .rela.dyn : {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) *(.rela.*) *(.rela_*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) #ifdef CONFIG_X86_32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) * The ASSERT() sink to . is intentional, for binutils 2.14 compatibility:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) . = ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) "kernel image bigger than KERNEL_IMAGE_SIZE");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) * Per-cpu symbols which need to be offset from __per_cpu_load
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) * for the boot processor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) #define INIT_PER_CPU(x) init_per_cpu__##x = ABSOLUTE(x) + __per_cpu_load
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) INIT_PER_CPU(gdt_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) INIT_PER_CPU(fixed_percpu_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) INIT_PER_CPU(irq_stack_backing_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) * Build-time check on the image size:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) . = ASSERT((_end - _text <= KERNEL_IMAGE_SIZE),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) "kernel image bigger than KERNEL_IMAGE_SIZE");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) #ifdef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) . = ASSERT((fixed_percpu_data == 0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) "fixed_percpu_data is not at start of per-cpu area");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) #endif /* CONFIG_X86_32 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) #ifdef CONFIG_KEXEC_CORE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) #include <asm/kexec.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) . = ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) "kexec control code size is too big");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) #ifdef CONFIG_CFI_CLANG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) . = ASSERT((__cfi_jt_end - __cfi_jt_start > 0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) "CFI jump table is empty");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) #endif