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 _stext = .; 41 .text : { 42 TEXT_TEXT 43 SCHED_TEXT 44 CPUIDLE_TEXT 45 LOCK_TEXT 46 KPROBES_TEXT 47 IRQENTRY_TEXT 48 SOFTIRQENTRY_TEXT 49 *(.fixup) 50 *(.gnu.warning) 51 } :text = 0 52 . = ALIGN(PECOFF_SEGMENT_ALIGN); 53 _etext = .; 54 55 EXCEPTION_TABLE(16) 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 INIT_DATA_SECTION(16) 72 .exit.data : { 73 EXIT_DATA 74 } 75 76#ifdef CONFIG_SMP 77 PERCPU_SECTION(1 << CONFIG_L1_CACHE_SHIFT) 78#endif 79 80 .rela.dyn : ALIGN(8) { *(.rela.dyn) *(.rela*) } 81 82 .init.bss : { 83 *(.init.bss) 84 } 85 . = ALIGN(PECOFF_SEGMENT_ALIGN); 86 __initdata_end = .; 87 88 __init_end = .; 89 90 _sdata = .; 91 RO_DATA(4096) 92 RW_DATA(1 << CONFIG_L1_CACHE_SHIFT, PAGE_SIZE, THREAD_SIZE) 93 94 .sdata : { 95 *(.sdata) 96 } 97 .edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGN); } 98 _edata = .; 99 100 BSS_SECTION(0, SZ_64K, 8) 101 . = ALIGN(PECOFF_SEGMENT_ALIGN); 102 103 _end = .; 104 105 STABS_DEBUG 106 DWARF_DEBUG 107 ELF_DETAILS 108 109 .gptab.sdata : { 110 *(.gptab.data) 111 *(.gptab.sdata) 112 } 113 .gptab.sbss : { 114 *(.gptab.bss) 115 *(.gptab.sbss) 116 } 117 118 DISCARDS 119 /DISCARD/ : { 120 *(.gnu.attributes) 121 *(.options) 122 *(.eh_frame) 123 } 124} 125