1 /* SPDX-License-Identifier: GPL-2.0 */ !! 1 /* ld script to make i386 Linux kernel 2 /* ld script to make s390 Linux kernel !! 2 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>; 3 * Written by Martin Schwidefsky (schwidefsky@ << 4 */ 3 */ 5 4 6 #include <asm/thread_info.h> << 7 #include <asm/page.h> << 8 #include <asm/ftrace.lds.h> << 9 << 10 /* << 11 * Put .bss..swapper_pg_dir as the first thing << 12 * make sure it has 16k alignment. << 13 */ << 14 #define BSS_FIRST_SECTIONS *(.bss..swapper_pg_ << 15 *(.bss..invalid_pg_ << 16 << 17 #define RO_EXCEPTION_TABLE_ALIGN 16 << 18 << 19 /* Handle ro_after_init data on our own. */ << 20 #define RO_AFTER_INIT_DATA << 21 << 22 #define RUNTIME_DISCARD_EXIT << 23 << 24 #define EMITS_PT_NOTE << 25 << 26 #include <asm-generic/vmlinux.lds.h> 5 #include <asm-generic/vmlinux.lds.h> 27 #include <asm/vmlinux.lds.h> !! 6 28 !! 7 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") 29 OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf !! 8 OUTPUT_ARCH(i386) 30 OUTPUT_ARCH(s390:64-bit) !! 9 ENTRY(startup_32) 31 ENTRY(startup_continue) << 32 jiffies = jiffies_64; 10 jiffies = jiffies_64; 33 << 34 PHDRS { << 35 text PT_LOAD FLAGS(5); /* R_E */ << 36 data PT_LOAD FLAGS(7); /* RWE */ << 37 note PT_NOTE FLAGS(0); /* ___ */ << 38 } << 39 << 40 SECTIONS 11 SECTIONS 41 { 12 { 42 . = TEXT_OFFSET; !! 13 . = 0xC0000000 + 0x100000; 43 .text : { !! 14 /* read-only */ 44 _stext = .; /* Sta !! 15 _text = .; /* Text and read-only data */ 45 _text = .; /* Tex !! 16 .text : { 46 HEAD_TEXT !! 17 *(.text) 47 TEXT_TEXT !! 18 *(.fixup) 48 SCHED_TEXT !! 19 *(.gnu.warning) 49 LOCK_TEXT !! 20 } = 0x9090 50 KPROBES_TEXT !! 21 51 IRQENTRY_TEXT !! 22 _etext = .; /* End of text section */ 52 SOFTIRQENTRY_TEXT !! 23 53 FTRACE_HOTPATCH_TRAMPOLINES_TE !! 24 . = ALIGN(16); /* Exception table */ 54 *(.text.*_indirect_*) !! 25 __start___ex_table = .; 55 *(.fixup) !! 26 __ex_table : { *(__ex_table) } 56 *(.gnu.warning) !! 27 __stop___ex_table = .; 57 . = ALIGN(PAGE_SIZE); !! 28 58 _etext = .; /* End !! 29 RODATA 59 } :text = 0x0700 !! 30 60 !! 31 /* writeable */ 61 RO_DATA(PAGE_SIZE) !! 32 .data : { /* Data */ 62 !! 33 *(.data) 63 . = ALIGN(PAGE_SIZE); !! 34 CONSTRUCTORS 64 _sdata = .; /* Start of da !! 35 } 65 !! 36 66 . = ALIGN(PAGE_SIZE); !! 37 . = ALIGN(4096); 67 __start_ro_after_init = .; !! 38 __nosave_begin = .; 68 .data..ro_after_init : { !! 39 .data_nosave : { *(.data.nosave) } 69 *(.data..ro_after_init) !! 40 . = ALIGN(4096); 70 JUMP_TABLE_DATA !! 41 __nosave_end = .; 71 } :data !! 42 72 . = ALIGN(PAGE_SIZE); !! 43 . = ALIGN(4096); 73 __end_ro_after_init = .; !! 44 .data.page_aligned : { *(.data.idt) } 74 !! 45 75 .data.rel.ro : { !! 46 . = ALIGN(32); 76 *(.data.rel.ro .data.rel.ro.*) !! 47 .data.cacheline_aligned : { *(.data.cacheline_aligned) } 77 } !! 48 78 .got : { !! 49 _edata = .; /* End of data section */ 79 __got_start = .; !! 50 80 *(.got) !! 51 . = ALIGN(8192); /* init_task */ 81 __got_end = .; !! 52 .data.init_task : { *(.data.init_task) } 82 } !! 53 83 !! 54 /* will be freed after init */ 84 RW_DATA(0x100, PAGE_SIZE, THREAD_SIZE) !! 55 . = ALIGN(4096); /* Init code and data */ 85 .data.rel : { !! 56 __init_begin = .; 86 *(.data.rel*) !! 57 .init.text : { 87 } !! 58 _sinittext = .; 88 BOOT_DATA_PRESERVED !! 59 *(.init.text) 89 !! 60 _einittext = .; 90 . = ALIGN(8); !! 61 } 91 .amode31.refs : { !! 62 .init.data : { *(.init.data) } 92 _start_amode31_refs = .; !! 63 . = ALIGN(16); 93 *(.amode31.refs) !! 64 __setup_start = .; 94 _end_amode31_refs = .; !! 65 .init.setup : { *(.init.setup) } 95 } !! 66 __setup_end = .; 96 !! 67 __start___param = .; 97 . = ALIGN(PAGE_SIZE); !! 68 __param : { *(__param) } 98 _edata = .; /* End of data !! 69 __stop___param = .; 99 !! 70 __initcall_start = .; 100 /* will be freed after init */ !! 71 .initcall.init : { 101 . = ALIGN(PAGE_SIZE); /* Init code a !! 72 *(.initcall1.init) 102 __init_begin = .; !! 73 *(.initcall2.init) 103 !! 74 *(.initcall3.init) 104 . = ALIGN(PAGE_SIZE); !! 75 *(.initcall4.init) 105 .init.text : AT(ADDR(.init.text) - LOA !! 76 *(.initcall5.init) 106 _sinittext = .; !! 77 *(.initcall6.init) 107 INIT_TEXT !! 78 *(.initcall7.init) 108 . = ALIGN(PAGE_SIZE); !! 79 } 109 _einittext = .; !! 80 __initcall_end = .; 110 } !! 81 __con_initcall_start = .; 111 !! 82 .con_initcall.init : { *(.con_initcall.init) } 112 /* !! 83 __con_initcall_end = .; 113 * .exit.text is discarded at runtime, !! 84 SECURITY_INIT 114 * to deal with references from __bug_ !! 85 . = ALIGN(4); 115 */ !! 86 __alt_instructions = .; 116 .exit.text : { !! 87 .altinstructions : { *(.altinstructions) } 117 EXIT_TEXT !! 88 __alt_instructions_end = .; 118 } !! 89 .altinstr_replacement : { *(.altinstr_replacement) } 119 !! 90 /* .exit.text is discard at runtime, not link time, to deal with references 120 .exit.data : { !! 91 from .altinstructions and .eh_frame */ 121 EXIT_DATA !! 92 .exit.text : { *(.exit.text) } 122 } !! 93 .exit.data : { *(.exit.data) } 123 !! 94 . = ALIGN(4096); 124 /* !! 95 __initramfs_start = .; 125 * struct alt_inst entries. From the h !! 96 .init.ramfs : { *(.init.ramfs) } 126 * "Alternative instructions for diffe !! 97 __initramfs_end = .; 127 * Think locking instructions on spinl !! 98 . = ALIGN(32); 128 * Note, that it is a part of __init r !! 99 __per_cpu_start = .; 129 */ !! 100 .data.percpu : { *(.data.percpu) } 130 . = ALIGN(8); !! 101 __per_cpu_end = .; 131 .altinstructions : { !! 102 . = ALIGN(4096); 132 __alt_instructions = .; !! 103 __init_end = .; 133 *(.altinstructions) !! 104 /* freed after init ends here */ 134 __alt_instructions_end = .; !! 105 135 } !! 106 __bss_start = .; /* BSS */ 136 !! 107 .bss : { *(.bss) } 137 /* !! 108 __bss_stop = .; 138 * And here are the replacement instru !! 109 139 * them as binary blobs. The .altinstr !! 110 _end = . ; 140 * get the address and the length of t !! 111 141 * Note, that it is a part of __init r !! 112 /* Sections to be discarded */ 142 */ !! 113 /DISCARD/ : { 143 .altinstr_replacement : { !! 114 *(.exitcall.exit) 144 *(.altinstr_replacement) !! 115 } 145 } !! 116 146 !! 117 /* Stabs debugging sections. */ 147 /* !! 118 .stab 0 : { *(.stab) } 148 * Table with the patch locations to u !! 119 .stabstr 0 : { *(.stabstr) } 149 */ !! 120 .stab.excl 0 : { *(.stab.excl) } 150 . = ALIGN(4); !! 121 .stab.exclstr 0 : { *(.stab.exclstr) } 151 .nospec_call_table : { !! 122 .stab.index 0 : { *(.stab.index) } 152 __nospec_call_start = . ; !! 123 .stab.indexstr 0 : { *(.stab.indexstr) } 153 *(.s390_indirect*) !! 124 .comment 0 : { *(.comment) } 154 __nospec_call_end = . ; << 155 } << 156 .nospec_return_table : { << 157 __nospec_return_start = . ; << 158 *(.s390_return*) << 159 __nospec_return_end = . ; << 160 } << 161 << 162 BOOT_DATA << 163 << 164 /* << 165 * .amode31 section for code, data, ex << 166 * below 2 GB, even when the kernel is << 167 */ << 168 . = ALIGN(PAGE_SIZE); << 169 _samode31 = .; << 170 .amode31.text : { << 171 _stext_amode31 = .; << 172 *(.amode31.text) << 173 *(.amode31.text.*_indirect_*) << 174 . = ALIGN(PAGE_SIZE); << 175 _etext_amode31 = .; << 176 } << 177 . = ALIGN(16); << 178 .amode31.ex_table : { << 179 _start_amode31_ex_table = .; << 180 KEEP(*(.amode31.ex_table)) << 181 _stop_amode31_ex_table = .; << 182 } << 183 . = ALIGN(PAGE_SIZE); << 184 .amode31.data : { << 185 *(.amode31.data) << 186 } << 187 . = _samode31 + AMODE31_SIZE; << 188 _eamode31 = .; << 189 << 190 /* early.c uses stsi, which requires p << 191 . = ALIGN(PAGE_SIZE); << 192 INIT_DATA_SECTION(0x100) << 193 << 194 RUNTIME_CONST_VARIABLES << 195 << 196 PERCPU_SECTION(0x100) << 197 << 198 . = ALIGN(PAGE_SIZE); << 199 __init_end = .; /* freed after << 200 << 201 BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, << 202 << 203 . = ALIGN(PAGE_SIZE); << 204 _end = . ; << 205 << 206 /* << 207 * uncompressed image info used by the << 208 * it should match struct vmlinux_info << 209 */ << 210 .vmlinux.info 0 (INFO) : { << 211 QUAD(startup_continue) << 212 QUAD(__bss_start - _stext) << 213 QUAD(__bss_stop - __bss_start) << 214 QUAD(__boot_data_start) << 215 QUAD(__boot_data_end - __boot_ << 216 QUAD(__boot_data_preserved_sta << 217 QUAD(__boot_data_preserved_end << 218 __boot_data_preserved_sta << 219 QUAD(__got_start) << 220 QUAD(__got_end) << 221 QUAD(_eamode31 - _samode31) << 222 QUAD(init_mm) << 223 QUAD(swapper_pg_dir) << 224 QUAD(invalid_pg_dir) << 225 QUAD(__alt_instructions) << 226 QUAD(__alt_instructions_end) << 227 #ifdef CONFIG_KASAN << 228 QUAD(kasan_early_shadow_page) << 229 QUAD(kasan_early_shadow_pte) << 230 QUAD(kasan_early_shadow_pmd) << 231 QUAD(kasan_early_shadow_pud) << 232 QUAD(kasan_early_shadow_p4d) << 233 #endif << 234 } :NONE << 235 << 236 /* Debugging sections. */ << 237 STABS_DEBUG << 238 DWARF_DEBUG << 239 ELF_DETAILS << 240 << 241 /* << 242 * Make sure that the .got.plt is eith << 243 * contains only the three reserved do << 244 */ << 245 .got.plt : { << 246 *(.got.plt) << 247 } << 248 ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF << 249 << 250 /* << 251 * Sections that should stay zero size << 252 * explicitly check instead of blindly << 253 */ << 254 .plt : { << 255 *(.plt) *(.plt.*) *(.iplt) *(. << 256 } << 257 ASSERT(SIZEOF(.plt) == 0, "Unexpected << 258 .rela.dyn : { << 259 *(.rela.*) *(.rela_*) << 260 } << 261 ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpe << 262 << 263 /* Sections to be discarded */ << 264 DISCARDS << 265 /DISCARD/ : { << 266 *(.eh_frame) << 267 *(.interp) << 268 } << 269 } 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.