kern.ldscript revision 1.10
1#include "assym.h" 2 3/* Default linker script, for normal executables */ 4OUTPUT_FORMAT("elf64-littleaarch64", "elf64-bigaarch64", 5 "elf64-littleaarch64") 6OUTPUT_ARCH(aarch64) 7ENTRY(_start) 8 9SECTIONS 10{ 11 .text : 12 { 13 PROVIDE(__kernel_text = .); 14 *(.text) 15 *(.text.*) 16 *(.stub) 17 } =0 18 19 /* Move .rodata to the next L2 block to set unexecutable */ 20 . = ALIGN(L2_SIZE); 21 22 PROVIDE(__rodata_start = .); 23 .rodata : 24 { 25 *(.rodata) 26 *(.rodata.*) 27 } 28 29 PROVIDE(_etext = .); 30 PROVIDE(etext = .); 31 32 /* 33 * Adjust the address for the data segment. Move .data to the next 34 * L2 block, and .text and .rodata will be set readonly if needed. 35 */ 36 PROVIDE(_erodata = .); 37 . = ALIGN(L2_SIZE); 38 39 .data : 40 { 41 PROVIDE(__data_start = .); 42 *(.data) 43 } 44 45 . = ALIGN(COHERENCY_UNIT); 46 .data.cacheline_aligned : 47 { 48 *(.data.cacheline_aligned) 49 } 50 . = ALIGN(COHERENCY_UNIT); 51 .data.read_mostly : 52 { 53 *(.data.read_mostly) 54 } 55 . = ALIGN(COHERENCY_UNIT); 56 57 _edata = .; 58 PROVIDE (edata = .); 59 60 __bss_start = .; 61 __bss_start__ = .; 62 .bss : 63 { 64 *(.bss) 65 *(.bss.*) 66 *(COMMON) 67 68 /* 69 * Align here to ensure that the .bss section occupies space 70 * up to _end. Align after .bss to ensure correct alignment 71 * even if the .bss section disappears because there are no 72 * input sections. 73 * 74 * FIXME: Why do we need it? When there is no .bss section, 75 * we don't pad the .data section. 76 */ 77 . = ALIGN(. != 0 ? 32 / 8 : 1); 78 } 79 _bss_end__ = . ; 80 __bss_end__ = . ; 81 . = ALIGN(32 / 8); 82 83 __end__ = . ; 84 _end = .; 85 PROVIDE(end = .); 86} 87