1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #include <linux/sizes.h> << 3 #include <asm/asm-offsets.h> 2 #include <asm/asm-offsets.h> 4 #include <asm/thread_info.h> 3 #include <asm/thread_info.h> 5 #include <asm/orc_lookup.h> << 6 4 7 #define PAGE_SIZE _PAGE_SIZE 5 #define PAGE_SIZE _PAGE_SIZE 8 #define RO_EXCEPTION_TABLE_ALIGN 4 << 9 #define PHYSADDR_MASK 0xffff << 10 6 11 /* 7 /* 12 * Put .bss..swapper_pg_dir as the first thing 8 * Put .bss..swapper_pg_dir as the first thing in .bss. This will 13 * ensure that it has .bss alignment (64K). 9 * ensure that it has .bss alignment (64K). 14 */ 10 */ 15 #define BSS_FIRST_SECTIONS *(.bss..swapper_pg_ 11 #define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir) 16 12 17 #include <asm-generic/vmlinux.lds.h> !! 13 /* Cavium Octeon should not have a separate PT_NOTE Program Header. */ 18 #include "image-vars.h" !! 14 #ifndef CONFIG_CAVIUM_OCTEON_SOC >> 15 #define EMITS_PT_NOTE >> 16 #endif 19 17 20 /* !! 18 #define RUNTIME_DISCARD_EXIT 21 * Max avaliable Page Size is 64K, so we set S << 22 * field of EFI application to 64K. << 23 */ << 24 PECOFF_FILE_ALIGN = 0x200; << 25 PECOFF_SEGMENT_ALIGN = 0x10000; << 26 19 27 OUTPUT_ARCH(loongarch) !! 20 #include <asm-generic/vmlinux.lds.h> >> 21 >> 22 #undef mips >> 23 #define mips mips >> 24 OUTPUT_ARCH(mips) 28 ENTRY(kernel_entry) 25 ENTRY(kernel_entry) 29 PHDRS { 26 PHDRS { 30 text PT_LOAD FLAGS(7); /* RWX */ 27 text PT_LOAD FLAGS(7); /* RWX */ >> 28 #ifndef CONFIG_CAVIUM_OCTEON_SOC 31 note PT_NOTE FLAGS(4); /* R__ */ 29 note PT_NOTE FLAGS(4); /* R__ */ >> 30 #endif /* CAVIUM_OCTEON_SOC */ 32 } 31 } 33 32 34 jiffies = jiffies_64; !! 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 35 42 36 SECTIONS 43 SECTIONS 37 { 44 { 38 . = VMLINUX_LOAD_ADDRESS; !! 45 #ifdef CONFIG_BOOT_ELF64 39 !! 46 /* Read-only sections, merged into text segment: */ 40 _text = .; !! 47 /* . = 0xc000000000000000; */ 41 HEAD_TEXT_SECTION !! 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 */ 42 56 43 . = ALIGN(PECOFF_SEGMENT_ALIGN); !! 57 /* . = 0xa800000000300000; */ 44 _stext = .; !! 58 . = 0xffffffff80300000; >> 59 #endif >> 60 . = LINKER_LOAD_ADDRESS; >> 61 /* read-only */ >> 62 _text = .; /* Text and read-only data */ 45 .text : { 63 .text : { 46 TEXT_TEXT 64 TEXT_TEXT 47 SCHED_TEXT 65 SCHED_TEXT 48 LOCK_TEXT 66 LOCK_TEXT 49 KPROBES_TEXT 67 KPROBES_TEXT 50 IRQENTRY_TEXT 68 IRQENTRY_TEXT 51 SOFTIRQENTRY_TEXT 69 SOFTIRQENTRY_TEXT 52 *(.fixup) 70 *(.fixup) 53 *(.gnu.warning) 71 *(.gnu.warning) >> 72 . = ALIGN(16); >> 73 *(.got) /* Global offset table */ 54 } :text = 0 74 } :text = 0 55 . = ALIGN(PECOFF_SEGMENT_ALIGN); !! 75 _etext = .; /* End of text section */ 56 _etext = .; << 57 76 58 . = ALIGN(PECOFF_SEGMENT_ALIGN); !! 77 EXCEPTION_TABLE(16) 59 __init_begin = .; << 60 __inittext_begin = .; << 61 78 62 INIT_TEXT_SECTION(PAGE_SIZE) !! 79 /* Exception table for data bus errors */ 63 .exit.text : { !! 80 __dbe_table : { 64 EXIT_TEXT !! 81 __start___dbe_table = .; >> 82 KEEP(*(__dbe_table)) >> 83 __stop___dbe_table = .; 65 } 84 } 66 85 67 . = ALIGN(PECOFF_SEGMENT_ALIGN); !! 86 _sdata = .; /* Start of data section */ 68 __inittext_end = .; !! 87 RO_DATA(4096) 69 88 70 __initdata_begin = .; !! 89 /* writeable */ >> 90 .data : { /* Data */ >> 91 . = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */ >> 92 >> 93 INIT_TASK_DATA(THREAD_SIZE) >> 94 NOSAVE_DATA >> 95 PAGE_ALIGNED_DATA(PAGE_SIZE) >> 96 CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) >> 97 READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) >> 98 DATA_DATA >> 99 CONSTRUCTORS >> 100 } >> 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) >> 114 } >> 115 _edata = .; /* End of data section */ >> 116 >> 117 /* will be freed after init */ >> 118 . = ALIGN(PAGE_SIZE); /* Init code and data */ >> 119 __init_begin = .; >> 120 INIT_TEXT_SECTION(PAGE_SIZE) >> 121 INIT_DATA_SECTION(16) 71 122 72 /* << 73 * struct alt_inst entries. From the h << 74 * "Alternative instructions for diffe << 75 * Think locking instructions on spinl << 76 */ << 77 . = ALIGN(4); 123 . = ALIGN(4); 78 .altinstructions : AT(ADDR(.altinstruc !! 124 .mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) { 79 __alt_instructions = .; !! 125 __mips_machines_start = .; 80 *(.altinstructions) !! 126 KEEP(*(.mips.machines.init)) 81 __alt_instructions_end = .; !! 127 __mips_machines_end = .; 82 } 128 } 83 129 84 INIT_DATA_SECTION(16) !! 130 /* .exit.text is discarded at runtime, not link time, to deal with >> 131 * references from .rodata >> 132 */ >> 133 .exit.text : { >> 134 EXIT_TEXT >> 135 } 85 .exit.data : { 136 .exit.data : { 86 EXIT_DATA 137 EXIT_DATA 87 } 138 } 88 << 89 #ifdef CONFIG_SMP 139 #ifdef CONFIG_SMP 90 PERCPU_SECTION(1 << CONFIG_L1_CACHE_SH !! 140 PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT) 91 #endif 141 #endif 92 142 93 .init.bss : { !! 143 .rel.dyn : ALIGN(8) { 94 *(.init.bss) !! 144 *(.rel) 95 } !! 145 *(.rel*) 96 . = ALIGN(PECOFF_SEGMENT_ALIGN); << 97 __initdata_end = .; << 98 << 99 __init_end = .; << 100 << 101 _sdata = .; << 102 RO_DATA(4096) << 103 << 104 .got : ALIGN(16) { *(.got) } << 105 .plt : ALIGN(16) { *(.plt) } << 106 .got.plt : ALIGN(16) { *(.got.plt) } << 107 << 108 RW_DATA(1 << CONFIG_L1_CACHE_SHIFT, PA << 109 << 110 .rela.dyn : ALIGN(8) { << 111 __rela_dyn_begin = .; << 112 *(.rela.dyn) *(.rela*) << 113 __rela_dyn_end = .; << 114 } 146 } 115 147 116 #ifdef CONFIG_RELR !! 148 #ifdef CONFIG_MIPS_ELF_APPENDED_DTB 117 .relr.dyn : ALIGN(8) { !! 149 STRUCT_ALIGN(); 118 __relr_dyn_begin = .; !! 150 .appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) { 119 *(.relr.dyn) !! 151 *(.appended_dtb) 120 __relr_dyn_end = .; !! 152 KEEP(*(.appended_dtb)) 121 } 153 } 122 #endif 154 #endif 123 155 124 .data.rel : { *(.data.rel*) } << 125 << 126 #ifdef CONFIG_RELOCATABLE 156 #ifdef CONFIG_RELOCATABLE 127 . = ALIGN(8); !! 157 . = ALIGN(4); 128 .la_abs : AT(ADDR(.la_abs) - LOAD_OFFS !! 158 129 __la_abs_begin = .; !! 159 .data.reloc : { 130 *(.la_abs) !! 160 _relocation_start = .; 131 __la_abs_end = .; !! 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 = .; 132 } 173 } 133 #endif 174 #endif 134 175 135 ORC_UNWIND_TABLE !! 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 >> 186 /* >> 187 * Align to 64K in attempt to eliminate holes before the >> 188 * .bss..swapper_pg_dir section at the start of .bss. This >> 189 * also satisfies PAGE_SIZE alignment as the largest page size >> 190 * allowed is 64K. >> 191 */ >> 192 . = ALIGN(0x10000); >> 193 __init_end = .; >> 194 /* freed after init ends here */ 136 195 137 .sdata : { !! 196 /* 138 *(.sdata) !! 197 * Force .bss to 64K alignment so that .bss..swapper_pg_dir 139 } !! 198 * gets that alignment. .sbss should be empty, so there will be 140 .edata_padding : { BYTE(0); . = ALIGN( !! 199 * no holes after __init_end. */ 141 _edata = .; !! 200 BSS_SECTION(0, 0x10000, 8) 142 201 143 BSS_SECTION(0, SZ_64K, 8) !! 202 _end = . ; 144 . = ALIGN(PECOFF_SEGMENT_ALIGN); << 145 203 146 _end = .; !! 204 /* These mark the ABI of the kernel for debuggers. */ >> 205 .mdebug.abi32 : { >> 206 KEEP(*(.mdebug.abi32)) >> 207 } >> 208 .mdebug.abi64 : { >> 209 KEEP(*(.mdebug.abi64)) >> 210 } >> 211 >> 212 /* This is the MIPS specific mdebug section. */ >> 213 .mdebug : { >> 214 *(.mdebug) >> 215 } 147 216 148 STABS_DEBUG 217 STABS_DEBUG 149 DWARF_DEBUG 218 DWARF_DEBUG 150 ELF_DETAILS 219 ELF_DETAILS 151 220 152 #ifdef CONFIG_EFI_STUB !! 221 /* These must appear regardless of . */ 153 /* header symbols */ << 154 _kernel_entry = ABSOLUTE(kernel_entry << 155 _kernel_asize = ABSOLUTE(_end - _text) << 156 _kernel_fsize = ABSOLUTE(_edata - _tex << 157 _kernel_vsize = ABSOLUTE(_end - __init << 158 _kernel_rsize = ABSOLUTE(_edata - __in << 159 #endif << 160 << 161 .gptab.sdata : { 222 .gptab.sdata : { 162 *(.gptab.data) 223 *(.gptab.data) 163 *(.gptab.sdata) 224 *(.gptab.sdata) 164 } 225 } 165 .gptab.sbss : { 226 .gptab.sbss : { 166 *(.gptab.bss) 227 *(.gptab.bss) 167 *(.gptab.sbss) 228 *(.gptab.sbss) 168 } 229 } 169 230 >> 231 /* Sections to be discarded */ 170 DISCARDS 232 DISCARDS 171 /DISCARD/ : { 233 /DISCARD/ : { 172 *(.dynamic .dynsym .dynstr .ha !! 234 /* ABI crap starts here */ >> 235 *(.MIPS.abiflags) >> 236 *(.MIPS.options) 173 *(.gnu.attributes) 237 *(.gnu.attributes) 174 *(.options) 238 *(.options) 175 *(.eh_frame) !! 239 *(.pdr) >> 240 *(.reginfo) 176 } 241 } 177 } 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.