1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* ld script to make s390 Linux kernel !! 2 #include <asm/asm-offsets.h> 3 * Written by Martin Schwidefsky (schwidefsky@ << 4 */ << 5 << 6 #include <asm/thread_info.h> 3 #include <asm/thread_info.h> 7 #include <asm/page.h> !! 4 8 #include <asm/ftrace.lds.h> !! 5 #define PAGE_SIZE _PAGE_SIZE 9 6 10 /* 7 /* 11 * Put .bss..swapper_pg_dir as the first thing 8 * Put .bss..swapper_pg_dir as the first thing in .bss. This will 12 * make sure it has 16k alignment. !! 9 * ensure that it has .bss alignment (64K). 13 */ 10 */ 14 #define BSS_FIRST_SECTIONS *(.bss..swapper_pg_ !! 11 #define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir) 15 *(.bss..invalid_pg_ << 16 << 17 #define RO_EXCEPTION_TABLE_ALIGN 16 << 18 12 19 /* Handle ro_after_init data on our own. */ !! 13 /* Cavium Octeon should not have a separate PT_NOTE Program Header. */ 20 #define RO_AFTER_INIT_DATA !! 14 #ifndef CONFIG_CAVIUM_OCTEON_SOC >> 15 #define EMITS_PT_NOTE >> 16 #endif 21 17 22 #define RUNTIME_DISCARD_EXIT 18 #define RUNTIME_DISCARD_EXIT 23 19 24 #define EMITS_PT_NOTE << 25 << 26 #include <asm-generic/vmlinux.lds.h> 20 #include <asm-generic/vmlinux.lds.h> 27 #include <asm/vmlinux.lds.h> << 28 << 29 OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf << 30 OUTPUT_ARCH(s390:64-bit) << 31 ENTRY(startup_continue) << 32 jiffies = jiffies_64; << 33 21 >> 22 #undef mips >> 23 #define mips mips >> 24 OUTPUT_ARCH(mips) >> 25 ENTRY(kernel_entry) 34 PHDRS { 26 PHDRS { 35 text PT_LOAD FLAGS(5); /* R_E */ !! 27 text PT_LOAD FLAGS(7); /* RWX */ 36 data PT_LOAD FLAGS(7); /* RWE */ !! 28 #ifndef CONFIG_CAVIUM_OCTEON_SOC 37 note PT_NOTE FLAGS(0); /* ___ */ !! 29 note PT_NOTE FLAGS(4); /* R__ */ >> 30 #endif /* CAVIUM_OCTEON_SOC */ 38 } 31 } 39 32 >> 33 #ifdef CONFIG_32BIT >> 34 #ifdef CONFIG_CPU_LITTLE_ENDIAN >> 35 jiffies = jiffies_64; >> 36 #else >> 37 jiffies = jiffies_64 + 4; >> 38 #endif >> 39 #else >> 40 jiffies = jiffies_64; >> 41 #endif >> 42 40 SECTIONS 43 SECTIONS 41 { 44 { 42 . = TEXT_OFFSET; !! 45 #ifdef CONFIG_BOOT_ELF64 >> 46 /* Read-only sections, merged into text segment: */ >> 47 /* . = 0xc000000000000000; */ >> 48 >> 49 /* This is the value for an Origin kernel, taken from an IRIX kernel. */ >> 50 /* . = 0xc00000000001c000; */ >> 51 >> 52 /* Set the vaddr for the text segment to a value >> 53 * >= 0xa800 0000 0001 9000 if no symmon is going to configured >> 54 * >= 0xa800 0000 0030 0000 otherwise >> 55 */ >> 56 >> 57 /* . = 0xa800000000300000; */ >> 58 . = 0xffffffff80300000; >> 59 #endif >> 60 . = LINKER_LOAD_ADDRESS; >> 61 /* read-only */ >> 62 _text = .; /* Text and read-only data */ 43 .text : { 63 .text : { 44 _stext = .; /* Sta << 45 _text = .; /* Tex << 46 HEAD_TEXT << 47 TEXT_TEXT 64 TEXT_TEXT 48 SCHED_TEXT 65 SCHED_TEXT 49 LOCK_TEXT 66 LOCK_TEXT 50 KPROBES_TEXT 67 KPROBES_TEXT 51 IRQENTRY_TEXT 68 IRQENTRY_TEXT 52 SOFTIRQENTRY_TEXT 69 SOFTIRQENTRY_TEXT 53 FTRACE_HOTPATCH_TRAMPOLINES_TE << 54 *(.text.*_indirect_*) << 55 *(.fixup) 70 *(.fixup) 56 *(.gnu.warning) 71 *(.gnu.warning) 57 . = ALIGN(PAGE_SIZE); !! 72 . = ALIGN(16); 58 _etext = .; /* End !! 73 *(.got) /* Global offset table */ 59 } :text = 0x0700 !! 74 } :text = 0 60 !! 75 _etext = .; /* End of text section */ 61 RO_DATA(PAGE_SIZE) !! 76 62 !! 77 EXCEPTION_TABLE(16) 63 . = ALIGN(PAGE_SIZE); !! 78 64 _sdata = .; /* Start of da !! 79 /* Exception table for data bus errors */ 65 !! 80 __dbe_table : { 66 . = ALIGN(PAGE_SIZE); !! 81 __start___dbe_table = .; 67 __start_ro_after_init = .; !! 82 KEEP(*(__dbe_table)) 68 .data..ro_after_init : { !! 83 __stop___dbe_table = .; 69 *(.data..ro_after_init) !! 84 } 70 JUMP_TABLE_DATA !! 85 71 } :data !! 86 _sdata = .; /* Start of data section */ 72 . = ALIGN(PAGE_SIZE); !! 87 RO_DATA(4096) 73 __end_ro_after_init = .; !! 88 74 !! 89 /* writeable */ 75 .data.rel.ro : { !! 90 .data : { /* Data */ 76 *(.data.rel.ro .data.rel.ro.*) !! 91 . = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */ 77 } !! 92 78 .got : { !! 93 INIT_TASK_DATA(THREAD_SIZE) 79 __got_start = .; !! 94 NOSAVE_DATA 80 *(.got) !! 95 PAGE_ALIGNED_DATA(PAGE_SIZE) 81 __got_end = .; !! 96 CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) 82 } !! 97 READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) 83 !! 98 DATA_DATA 84 RW_DATA(0x100, PAGE_SIZE, THREAD_SIZE) !! 99 CONSTRUCTORS 85 .data.rel : { !! 100 } 86 *(.data.rel*) !! 101 BUG_TABLE >> 102 _gp = . + 0x8000; >> 103 .lit8 : { >> 104 *(.lit8) >> 105 } >> 106 .lit4 : { >> 107 *(.lit4) >> 108 } >> 109 /* We want the small data sections together, so single-instruction offsets >> 110 can access them all, and initialized data all before uninitialized, so >> 111 we can shorten the on-disk segment size. */ >> 112 .sdata : { >> 113 *(.sdata) 87 } 114 } 88 BOOT_DATA_PRESERVED !! 115 _edata = .; /* End of data section */ 89 << 90 . = ALIGN(8); << 91 .amode31.refs : { << 92 _start_amode31_refs = .; << 93 *(.amode31.refs) << 94 _end_amode31_refs = .; << 95 } << 96 << 97 . = ALIGN(PAGE_SIZE); << 98 _edata = .; /* End of data << 99 116 100 /* will be freed after init */ 117 /* will be freed after init */ 101 . = ALIGN(PAGE_SIZE); /* Init code a !! 118 . = ALIGN(PAGE_SIZE); /* Init code and data */ 102 __init_begin = .; 119 __init_begin = .; >> 120 INIT_TEXT_SECTION(PAGE_SIZE) >> 121 INIT_DATA_SECTION(16) 103 122 104 . = ALIGN(PAGE_SIZE); !! 123 . = ALIGN(4); 105 .init.text : AT(ADDR(.init.text) - LOA !! 124 .mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) { 106 _sinittext = .; !! 125 __mips_machines_start = .; 107 INIT_TEXT !! 126 KEEP(*(.mips.machines.init)) 108 . = ALIGN(PAGE_SIZE); !! 127 __mips_machines_end = .; 109 _einittext = .; << 110 } 128 } 111 129 112 /* !! 130 /* .exit.text is discarded at runtime, not link time, to deal with 113 * .exit.text is discarded at runtime, !! 131 * references from .rodata 114 * to deal with references from __bug_ !! 132 */ 115 */ << 116 .exit.text : { 133 .exit.text : { 117 EXIT_TEXT 134 EXIT_TEXT 118 } 135 } 119 << 120 .exit.data : { 136 .exit.data : { 121 EXIT_DATA 137 EXIT_DATA 122 } 138 } >> 139 #ifdef CONFIG_SMP >> 140 PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT) >> 141 #endif 123 142 124 /* !! 143 .rel.dyn : ALIGN(8) { 125 * struct alt_inst entries. From the h !! 144 *(.rel) 126 * "Alternative instructions for diffe !! 145 *(.rel*) 127 * Think locking instructions on spinl << 128 * Note, that it is a part of __init r << 129 */ << 130 . = ALIGN(8); << 131 .altinstructions : { << 132 __alt_instructions = .; << 133 *(.altinstructions) << 134 __alt_instructions_end = .; << 135 } 146 } 136 147 137 /* !! 148 #ifdef CONFIG_MIPS_ELF_APPENDED_DTB 138 * And here are the replacement instru !! 149 STRUCT_ALIGN(); 139 * them as binary blobs. The .altinstr !! 150 .appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) { 140 * get the address and the length of t !! 151 *(.appended_dtb) 141 * Note, that it is a part of __init r !! 152 KEEP(*(.appended_dtb)) 142 */ << 143 .altinstr_replacement : { << 144 *(.altinstr_replacement) << 145 } 153 } >> 154 #endif 146 155 147 /* !! 156 #ifdef CONFIG_RELOCATABLE 148 * Table with the patch locations to u << 149 */ << 150 . = ALIGN(4); 157 . = ALIGN(4); 151 .nospec_call_table : { << 152 __nospec_call_start = . ; << 153 *(.s390_indirect*) << 154 __nospec_call_end = . ; << 155 } << 156 .nospec_return_table : { << 157 __nospec_return_start = . ; << 158 *(.s390_return*) << 159 __nospec_return_end = . ; << 160 } << 161 158 162 BOOT_DATA !! 159 .data.reloc : { >> 160 _relocation_start = .; >> 161 /* >> 162 * Space for relocation table >> 163 * This needs to be filled so that the >> 164 * relocs tool can overwrite the content. >> 165 * An invalid value is left at the start of the >> 166 * section to abort relocation if the table >> 167 * has not been filled in. >> 168 */ >> 169 LONG(0xFFFFFFFF); >> 170 FILL(0); >> 171 . += CONFIG_RELOCATION_TABLE_SIZE - 4; >> 172 _relocation_end = .; >> 173 } >> 174 #endif 163 175 >> 176 #ifdef CONFIG_MIPS_RAW_APPENDED_DTB >> 177 .fill : { >> 178 FILL(0); >> 179 BYTE(0); >> 180 STRUCT_ALIGN(); >> 181 } >> 182 __appended_dtb = .; >> 183 /* leave space for appended DTB */ >> 184 . += 0x100000; >> 185 #endif 164 /* 186 /* 165 * .amode31 section for code, data, ex !! 187 * Align to 64K in attempt to eliminate holes before the 166 * below 2 GB, even when the kernel is !! 188 * .bss..swapper_pg_dir section at the start of .bss. This 167 */ !! 189 * also satisfies PAGE_SIZE alignment as the largest page size 168 . = ALIGN(PAGE_SIZE); !! 190 * allowed is 64K. 169 _samode31 = .; !! 191 */ 170 .amode31.text : { !! 192 . = ALIGN(0x10000); 171 _stext_amode31 = .; !! 193 __init_end = .; 172 *(.amode31.text) !! 194 /* freed after init ends here */ 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 195 196 PERCPU_SECTION(0x100) !! 196 /* 197 !! 197 * Force .bss to 64K alignment so that .bss..swapper_pg_dir 198 . = ALIGN(PAGE_SIZE); !! 198 * gets that alignment. .sbss should be empty, so there will be 199 __init_end = .; /* freed after !! 199 * no holes after __init_end. */ 200 !! 200 BSS_SECTION(0, 0x10000, 8) 201 BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, << 202 201 203 . = ALIGN(PAGE_SIZE); << 204 _end = . ; 202 _end = . ; 205 203 206 /* !! 204 /* These mark the ABI of the kernel for debuggers. */ 207 * uncompressed image info used by the !! 205 .mdebug.abi32 : { 208 * it should match struct vmlinux_info !! 206 KEEP(*(.mdebug.abi32)) 209 */ !! 207 } 210 .vmlinux.info 0 (INFO) : { !! 208 .mdebug.abi64 : { 211 QUAD(startup_continue) !! 209 KEEP(*(.mdebug.abi64)) 212 QUAD(__bss_start - _stext) !! 210 } 213 QUAD(__bss_stop - __bss_start) !! 211 214 QUAD(__boot_data_start) !! 212 /* This is the MIPS specific mdebug section. */ 215 QUAD(__boot_data_end - __boot_ !! 213 .mdebug : { 216 QUAD(__boot_data_preserved_sta !! 214 *(.mdebug) 217 QUAD(__boot_data_preserved_end !! 215 } 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 216 236 /* Debugging sections. */ << 237 STABS_DEBUG 217 STABS_DEBUG 238 DWARF_DEBUG 218 DWARF_DEBUG 239 ELF_DETAILS 219 ELF_DETAILS 240 220 241 /* !! 221 /* These must appear regardless of . */ 242 * Make sure that the .got.plt is eith !! 222 .gptab.sdata : { 243 * contains only the three reserved do !! 223 *(.gptab.data) 244 */ !! 224 *(.gptab.sdata) 245 .got.plt : { !! 225 } 246 *(.got.plt) !! 226 .gptab.sbss : { 247 } !! 227 *(.gptab.bss) 248 ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF !! 228 *(.gptab.sbss) 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 } 229 } 261 ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpe << 262 230 263 /* Sections to be discarded */ 231 /* Sections to be discarded */ 264 DISCARDS 232 DISCARDS 265 /DISCARD/ : { 233 /DISCARD/ : { 266 *(.eh_frame) !! 234 /* ABI crap starts here */ 267 *(.interp) !! 235 *(.MIPS.abiflags) >> 236 *(.MIPS.options) >> 237 *(.gnu.attributes) >> 238 *(.options) >> 239 *(.pdr) >> 240 *(.reginfo) 268 } 241 } 269 } 242 }
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.