1/* SPDX-License-Identifier: GPL-2.0 */ 2#include <linux/sizes.h> 3#include <asm/asm-offsets.h> 4#include <asm/thread_info.h> 5 6#define PAGE_SIZE _PAGE_SIZE 7#define RO_EXCEPTION_TABLE_ALIGN 4 8#define PHYSADDR_MASK 0xffffffffffff /* 48-bit */ 9 10/* 11 * Put .bss..swapper_pg_dir as the first thing in .bss. This will 12 * ensure that it has .bss alignment (64K). 13 */ 14#define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir) 15 16#include <asm-generic/vmlinux.lds.h> 17#include "image-vars.h" 18 19/* 20 * Max avaliable Page Size is 64K, so we set SectionAlignment 21 * field of EFI application to 64K. 22 */ 23PECOFF_FILE_ALIGN = 0x200; 24PECOFF_SEGMENT_ALIGN = 0x10000; 25 26OUTPUT_ARCH(loongarch) 27ENTRY(kernel_entry) 28PHDRS { 29 text PT_LOAD FLAGS(7); /* RWX */ 30 note PT_NOTE FLAGS(4); /* R__ */ 31} 32 33jiffies = jiffies_64; 34 35SECTIONS 36{ 37 . = VMLINUX_LOAD_ADDRESS; 38 39 _text = .; 40 HEAD_TEXT_SECTION 41 42 . = ALIGN(PECOFF_SEGMENT_ALIGN); 43 _stext = .; 44 .text : { 45 TEXT_TEXT 46 SCHED_TEXT 47 LOCK_TEXT 48 KPROBES_TEXT 49 IRQENTRY_TEXT 50 SOFTIRQENTRY_TEXT 51 *(.fixup) 52 *(.gnu.warning) 53 } :text = 0 54 . = ALIGN(PECOFF_SEGMENT_ALIGN); 55 _etext = .; 56 57 . = ALIGN(PECOFF_SEGMENT_ALIGN); 58 __init_begin = .; 59 __inittext_begin = .; 60 61 INIT_TEXT_SECTION(PAGE_SIZE) 62 .exit.text : { 63 EXIT_TEXT 64 } 65 66 . = ALIGN(PECOFF_SEGMENT_ALIGN); 67 __inittext_end = .; 68 69 __initdata_begin = .; 70 71 /* 72 * struct alt_inst entries. From the header (alternative.h): 73 * "Alternative instructions for different CPU types or capabilities" 74 * Think locking instructions on spinlocks. 75 */ 76 . = ALIGN(4); 77 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) { 78 __alt_instructions = .; 79 *(.altinstructions) 80 __alt_instructions_end = .; 81 } 82 83 INIT_DATA_SECTION(16) 84 .exit.data : { 85 EXIT_DATA 86 } 87 88#ifdef CONFIG_SMP 89 PERCPU_SECTION(1 << CONFIG_L1_CACHE_SHIFT) 90#endif 91 92 .init.bss : { 93 *(.init.bss) 94 } 95 . = ALIGN(PECOFF_SEGMENT_ALIGN); 96 __initdata_end = .; 97 98 __init_end = .; 99 100 _sdata = .; 101 RO_DATA(4096) 102 103 .got : ALIGN(16) { *(.got) } 104 .plt : ALIGN(16) { *(.plt) } 105 .got.plt : ALIGN(16) { *(.got.plt) } 106 107 RW_DATA(1 << CONFIG_L1_CACHE_SHIFT, PAGE_SIZE, THREAD_SIZE) 108 109 .rela.dyn : ALIGN(8) { 110 __rela_dyn_begin = .; 111 *(.rela.dyn) *(.rela*) 112 __rela_dyn_end = .; 113 } 114 115 .data.rel : { *(.data.rel*) } 116 117#ifdef CONFIG_RELOCATABLE 118 . = ALIGN(8); 119 .la_abs : AT(ADDR(.la_abs) - LOAD_OFFSET) { 120 __la_abs_begin = .; 121 *(.la_abs) 122 __la_abs_end = .; 123 } 124#endif 125 126 .sdata : { 127 *(.sdata) 128 } 129 .edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGN); } 130 _edata = .; 131 132 BSS_SECTION(0, SZ_64K, 8) 133 . = ALIGN(PECOFF_SEGMENT_ALIGN); 134 135 _end = .; 136 137 STABS_DEBUG 138 DWARF_DEBUG 139 ELF_DETAILS 140 141#ifdef CONFIG_EFI_STUB 142 /* header symbols */ 143 _kernel_entry = ABSOLUTE(kernel_entry & PHYSADDR_MASK); 144 _kernel_asize = ABSOLUTE(_end - _text); 145 _kernel_fsize = ABSOLUTE(_edata - _text); 146 _kernel_vsize = ABSOLUTE(_end - __initdata_begin); 147 _kernel_rsize = ABSOLUTE(_edata - __initdata_begin); 148#endif 149 150 .gptab.sdata : { 151 *(.gptab.data) 152 *(.gptab.sdata) 153 } 154 .gptab.sbss : { 155 *(.gptab.bss) 156 *(.gptab.sbss) 157 } 158 159 DISCARDS 160 /DISCARD/ : { 161 *(.dynamic .dynsym .dynstr .hash .gnu.hash) 162 *(.gnu.attributes) 163 *(.options) 164 *(.eh_frame) 165 } 166} 167