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 #include <asm/orc_lookup.h>
7 #define PAGE_SIZE _PAGE_SIZE
8 #define RO_EXCEPTION_TABLE_ALIGN 4
9 #define PHYSADDR_MASK 0xffffffffffff /* 48-bit */
12 * Put .bss..swapper_pg_dir as the first thing in .bss. This will
13 * ensure that it has .bss alignment (64K).
15 #define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir)
17 #include <asm-generic/vmlinux.lds.h>
18 #include "image-vars.h"
21 * Max avaliable Page Size is 64K, so we set SectionAlignment
22 * field of EFI application to 64K.
24 PECOFF_FILE_ALIGN = 0x200;
25 PECOFF_SEGMENT_ALIGN = 0x10000;
27 OUTPUT_ARCH(loongarch)
30 text PT_LOAD FLAGS(7); /* RWX */
31 note PT_NOTE FLAGS(4); /* R__ */
38 . = VMLINUX_LOAD_ADDRESS;
43 . = ALIGN(PECOFF_SEGMENT_ALIGN);
55 . = ALIGN(PECOFF_SEGMENT_ALIGN);
58 . = ALIGN(PECOFF_SEGMENT_ALIGN);
62 INIT_TEXT_SECTION(PAGE_SIZE)
67 . = ALIGN(PECOFF_SEGMENT_ALIGN);
73 * struct alt_inst entries. From the header (alternative.h):
74 * "Alternative instructions for different CPU types or capabilities"
75 * Think locking instructions on spinlocks.
78 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
79 __alt_instructions = .;
81 __alt_instructions_end = .;
90 PERCPU_SECTION(1 << CONFIG_L1_CACHE_SHIFT)
96 . = ALIGN(PECOFF_SEGMENT_ALIGN);
104 .got : ALIGN(16) { *(.got) }
105 .plt : ALIGN(16) { *(.plt) }
106 .got.plt : ALIGN(16) { *(.got.plt) }
108 RW_DATA(1 << CONFIG_L1_CACHE_SHIFT, PAGE_SIZE, THREAD_SIZE)
110 .rela.dyn : ALIGN(8) {
111 __rela_dyn_begin = .;
112 *(.rela.dyn) *(.rela*)
117 .relr.dyn : ALIGN(8) {
118 __relr_dyn_begin = .;
124 .data.rel : { *(.data.rel*) }
126 #ifdef CONFIG_RELOCATABLE
128 .la_abs : AT(ADDR(.la_abs) - LOAD_OFFSET) {
140 .edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGN); }
143 BSS_SECTION(0, SZ_64K, 8)
144 . = ALIGN(PECOFF_SEGMENT_ALIGN);
152 #ifdef CONFIG_EFI_STUB
154 _kernel_entry = ABSOLUTE(kernel_entry & PHYSADDR_MASK);
155 _kernel_asize = ABSOLUTE(_end - _text);
156 _kernel_fsize = ABSOLUTE(_edata - _text);
157 _kernel_vsize = ABSOLUTE(_end - __initdata_begin);
158 _kernel_rsize = ABSOLUTE(_edata - __initdata_begin);
172 *(.dynamic .dynsym .dynstr .hash .gnu.hash)