1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * ld.script for compressed kernel support of LoongArch 4 * 5 * Author: Huacai Chen <chenhuacai@loongson.cn> 6 * Copyright (C) 2020 Loongson Technology Corporation Limited 7 */ 8 9/* 10 * Max avaliable Page Size is 64K, so we set SectionAlignment 11 * field of EFI application to 64K. 12 */ 13PECOFF_FILE_ALIGN = 0x200; 14PECOFF_SEGMENT_ALIGN = 0x10000; 15 16OUTPUT_ARCH(loongarch) 17ENTRY(start) 18PHDRS { 19 text PT_LOAD FLAGS(7); /* RWX */ 20} 21SECTIONS 22{ 23 /* Text and read-only data */ 24 _text = .; 25 .head.text : { 26 *(.head.text) 27 } 28 29 .text : { 30 *(.text) 31 *(.init.text) 32 *(.rodata) 33 }: text 34 /* End of text section */ 35 36 . = ALIGN(PECOFF_SEGMENT_ALIGN); 37 _data = .; 38 /* Writable data */ 39 .data : { 40 *(.data) 41 *(.init.data) 42 /* Put the compressed image here */ 43 __image_begin = .; 44 *(.image) 45 __image_end = .; 46 CONSTRUCTORS 47 . = ALIGN(PECOFF_FILE_ALIGN); 48 } 49 50 _edata = .; 51 /* End of data section */ 52 53 /* BSS */ 54 .bss : { 55 *(.bss) 56 *(.init.bss) 57 } 58 . = ALIGN(PECOFF_SEGMENT_ALIGN); 59 _end = .; 60 61 /* Sections to be discarded */ 62 /DISCARD/ : { 63 *(.options) 64 *(.comment) 65 *(.note) 66 } 67} 68