kern.ldscript revision 1.6
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) 8SECTIONS 9{ 10 /* Read-only sections, merged into text segment: */ 11 .text : 12 { 13 PROVIDE (__kernel_text = .); 14 PROVIDE_HIDDEN (__eprol = .); 15 *(.text) 16 *(.text.unlikely .text.*_unlikely) 17 *(.text.exit .text.exit.*) 18 *(.text.startup .text.startup.*) 19 *(.text.hot .text.hot.*) 20 *(.stub .text.* .gnu.linkonce.t.*) 21 /* .gnu.warning sections are handled specially by elf32.em. */ 22 } =0 23 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 24 .rodata1 : { *(.rodata1) } 25 .eh_frame_hdr : { *(.eh_frame_hdr) } 26 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } 27 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table 28 .gcc_except_table.*) } 29 /* These sections are generated by the Sun/Oracle C++ compiler. */ 30 .exception_ranges : ONLY_IF_RO { *(.exception_ranges 31 .exception_ranges*) } 32 PROVIDE (__etext = .); 33 PROVIDE (_etext = .); 34 PROVIDE (etext = .); 35 /* Adjust the address for the data segment. Move .data to the next L2 block, 36 and .text and .rodata will be set readonly if needed. */ 37 PROVIDE (_erodata = .); 38 . = ALIGN (L2_SIZE); 39 . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); 40 /* Exception handling */ 41 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } 42 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } 43 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) } 44 .got : { *(.got) *(.igot) } 45 . = DATA_SEGMENT_RELRO_END (24, .); 46 .got.plt : { *(.got.plt) *(.igot.plt) } 47 .data : 48 { 49 PROVIDE (__data_start = .); 50 *(.data .gnu.linkonce.d.*) 51 SORT(CONSTRUCTORS) 52 } 53 .data1 : { *(.data1) } 54 55 . = ALIGN(64); /* COHERENCY_UNIT */ 56 .data.cacheline_aligned : 57 { 58 *(.data.cacheline_aligned) 59 } 60 . = ALIGN(64); /* COHERENCY_UNIT */ 61 .data.read_mostly : 62 { 63 *(.data.read_mostly) 64 } 65 . = ALIGN(64); /* COHERENCY_UNIT */ 66 67 _edata = .; PROVIDE (edata = .); 68 . = .; 69 __bss_start = .; 70 __bss_start__ = .; 71 .bss : 72 { 73 *(.dynbss) 74 *(.bss .bss.* .gnu.linkonce.b.*) 75 *(COMMON) 76 /* Align here to ensure that the .bss section occupies space up to 77 _end. Align after .bss to ensure correct alignment even if the 78 .bss section disappears because there are no input sections. 79 FIXME: Why do we need it? When there is no .bss section, we don't 80 pad the .data section. */ 81 . = ALIGN(. != 0 ? 32 / 8 : 1); 82 } 83 _bss_end__ = . ; __bss_end__ = . ; 84 . = ALIGN(32 / 8); 85 . = ALIGN(32 / 8); 86 __end__ = . ; 87 _end = .; PROVIDE (end = .); 88 . = DATA_SEGMENT_END (.); 89 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) } 90 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 91} 92