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 8/* 9 * Put .bss..swapper_pg_dir as the first thing in .bss. This will 10 * ensure that it has .bss alignment (64K). 11 */ 12#define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir) 13 14#include <asm-generic/vmlinux.lds.h> 15 16/* 17 * Max avaliable Page Size is 64K, so we set SectionAlignment 18 * field of EFI application to 64K. 19 */ 20PECOFF_FILE_ALIGN = 0x200; 21PECOFF_SEGMENT_ALIGN = 0x10000; 22 23OUTPUT_ARCH(loongarch) 24ENTRY(kernel_entry) 25PHDRS { 26 text PT_LOAD FLAGS(7); /* RWX */ 27 note PT_NOTE FLAGS(4); /* R__ */ 28} 29 30jiffies = jiffies_64; 31 32SECTIONS 33{ 34 . = VMLINUX_LOAD_ADDRESS; 35 36 _text = .; 37 HEAD_TEXT_SECTION 38 39 . = ALIGN(PECOFF_SEGMENT_ALIGN); 40 .text : { 41 TEXT_TEXT 42 SCHED_TEXT 43 CPUIDLE_TEXT 44 LOCK_TEXT 45 KPROBES_TEXT 46 IRQENTRY_TEXT 47 SOFTIRQENTRY_TEXT 48 *(.fixup) 49 *(.gnu.warning) 50 } :text = 0 51 . = ALIGN(PECOFF_SEGMENT_ALIGN); 52 _etext = .; 53 54 EXCEPTION_TABLE(16) 55 56 . = ALIGN(PECOFF_SEGMENT_ALIGN); 57 __init_begin = .; 58 __inittext_begin = .; 59 60 INIT_TEXT_SECTION(PAGE_SIZE) 61 .exit.text : { 62 EXIT_TEXT 63 } 64 65 . = ALIGN(PECOFF_SEGMENT_ALIGN); 66 __inittext_end = .; 67 68 __initdata_begin = .; 69 70 INIT_DATA_SECTION(16) 71 .exit.data : { 72 EXIT_DATA 73 } 74 75#ifdef CONFIG_SMP 76 PERCPU_SECTION(1 << CONFIG_L1_CACHE_SHIFT) 77#endif 78 79 .init.bss : { 80 *(.init.bss) 81 } 82 . = ALIGN(PECOFF_SEGMENT_ALIGN); 83 __initdata_end = .; 84 85 __init_end = .; 86 87 _sdata = .; 88 RO_DATA(4096) 89 RW_DATA(1 << CONFIG_L1_CACHE_SHIFT, PAGE_SIZE, THREAD_SIZE) 90 91 .sdata : { 92 *(.sdata) 93 } 94 .edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGN); } 95 _edata = .; 96 97 BSS_SECTION(0, SZ_64K, 8) 98 . = ALIGN(PECOFF_SEGMENT_ALIGN); 99 100 _end = .; 101 102 STABS_DEBUG 103 DWARF_DEBUG 104 105 .gptab.sdata : { 106 *(.gptab.data) 107 *(.gptab.sdata) 108 } 109 .gptab.sbss : { 110 *(.gptab.bss) 111 *(.gptab.sbss) 112 } 113 114 DISCARDS 115 /DISCARD/ : { 116 *(.gnu.attributes) 117 *(.options) 118 *(.eh_frame) 119 } 120} 121