1/* Default linker script, for normal executables */ 2/* Copyright (C) 2014-2018 Free Software Foundation, Inc. 3 Copying and distribution of this script, with or without modification, 4 are permitted in any medium without royalty provided the copyright 5 notice and this notice are preserved. */ 6/* -*- Makefile -*- */ 7ENTRY(_start) 8 9PHDRS 10{ 11 phdr PT_PHDR PHDRS; 12 interp PT_INTERP; 13 ro PT_LOAD FILEHDR PHDRS; 14 rw PT_LOAD; 15 dyn PT_DYNAMIC; 16 tls PT_TLS; 17 ehf PT_GNU_EH_FRAME; 18 L4_DEFINE_L4PHDRS 19} 20 21 22SECTIONS 23{ 24 L4_DEFINE_ARM64_KERNEL_ENTRY_SYMS 25 26 /* Read-only sections, merged into text segment: */ 27 PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x00400000)); . = SEGMENT_START("text-segment", 0x00400000) + SIZEOF_HEADERS; 28 .interp : { *(.interp) } :ro :interp 29 .note.gnu.build-id : { *(.note.gnu.build-id) } :ro 30 .hash : { *(.hash) } 31 .gnu.hash : { *(.gnu.hash) } 32 .dynsym : { *(.dynsym) } 33 .dynstr : { *(.dynstr) } 34 .gnu.version : { *(.gnu.version) } 35 .gnu.version_d : { *(.gnu.version_d) } 36 .gnu.version_r : { *(.gnu.version_r) } 37 .rela.init : { *(.rela.init) } 38 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } 39 .rela.fini : { *(.rela.fini) } 40 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } 41 .rela.data.rel.ro : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) } 42 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 43 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 44 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 45 .rela.ctors : { *(.rela.ctors) } 46 .rela.dtors : { *(.rela.dtors) } 47 .rela.got : { *(.rela.got) } 48 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 49 .rela.ifunc : { *(.rela.ifunc) } 50 .rela.plt : 51 { 52 *(.rela.plt) 53 PROVIDE_HIDDEN (__rela_iplt_start = .); 54 *(.rela.iplt) 55 PROVIDE_HIDDEN (__rela_iplt_end = .); 56 } 57 .init : 58 { 59 KEEP (*(SORT_NONE(.init))) 60 } =0 61 .plt : { *(.plt) *(.iplt) } 62 .text : 63 { 64 *(.text.unlikely .text.*_unlikely .text.unlikely.*) 65 *(.text.exit .text.exit.*) 66 *(.text.startup .text.startup.*) 67 *(.text.hot .text.hot.*) 68 *(.text .stub .text.* .gnu.linkonce.t.*) 69 /* .gnu.warning sections are handled specially by elf32.em. */ 70 *(.gnu.warning) 71 } =0 72 .fini : 73 { 74 KEEP (*(SORT_NONE(.fini))) 75 } =0 76 PROVIDE (__etext = .); 77 PROVIDE (_etext = .); 78 PROVIDE (etext = .); 79 .rol4re_elf_aux : { 80 KEEP (*(.rol4re_elf_aux)) 81 } : ro : l4re_aux 82 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } : ro 83 .rodata1 : { *(.rodata1) } 84 .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) } :ehf :ro 85 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) } :ro 86 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table 87 .gcc_except_table.*) } :ro 88 .gnu_extab : ONLY_IF_RO { *(.gnu_extab*) } :ro 89 /* These sections are generated by the Sun/Oracle C++ compiler. */ 90 .exception_ranges : ONLY_IF_RO { *(.exception_ranges 91 .exception_ranges*) } :ro 92 /* Adjust the address for the data segment. We want to adjust up to 93 the same address within the page on the next page up. */ 94 . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)); 95 /* Exception handling */ 96 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) } :rw 97 .gnu_extab : ONLY_IF_RW { *(.gnu_extab) } :rw 98 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } :rw 99 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) } :rw 100 /* Thread Local Storage sections */ 101 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } :rw : tls 102 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 103 .preinit_array : 104 { 105 PROVIDE_HIDDEN (__preinit_array_start = .); 106 KEEP (*(.preinit_array)) 107 PROVIDE_HIDDEN (__preinit_array_end = .); 108 } : rw 109 .init_array : 110 { 111 PROVIDE_HIDDEN (__init_array_start = .); 112 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) 113 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors)) 114 PROVIDE_HIDDEN (__init_array_end = .); 115 } 116 .fini_array : 117 { 118 PROVIDE_HIDDEN (__fini_array_start = .); 119 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) 120 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors)) 121 PROVIDE_HIDDEN (__fini_array_end = .); 122 } 123 .ctors : 124 { 125 /* gcc uses crtbegin.o to find the start of 126 the constructors, so we make sure it is 127 first. Because this is a wildcard, it 128 doesn't matter if the user does not 129 actually link against crtbegin.o; the 130 linker won't look for a file to match a 131 wildcard. The wildcard also means that it 132 doesn't matter which directory crtbegin.o 133 is in. */ 134 KEEP (*crtbegin.o(.ctors)) 135 KEEP (*crtbegin?.o(.ctors)) 136 /* We don't want to include the .ctor section from 137 the crtend.o file until after the sorted ctors. 138 The .ctor section from the crtend file contains the 139 end of ctors marker and it must be last */ 140 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) 141 KEEP (*(SORT(.ctors.*))) 142 KEEP (*(.ctors)) 143 } 144 .dtors : 145 { 146 KEEP (*crtbegin.o(.dtors)) 147 KEEP (*crtbegin?.o(.dtors)) 148 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) 149 KEEP (*(SORT(.dtors.*))) 150 KEEP (*(.dtors)) 151 } 152 .jcr : { KEEP (*(.jcr)) } 153 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) } 154 .dynamic : { *(.dynamic) } :dyn :rw 155 .got : { *(.got) *(.igot) } 156 .got.plt : { *(.got.plt) *(.igot.plt) } 157 .data : 158 { 159 __data_start = . ; 160 *(.data .data.* .gnu.linkonce.d.*) 161 SORT(CONSTRUCTORS) 162 } :rw 163 .data1 : { *(.data1) } 164 _edata = .; PROVIDE (edata = .); 165 . = .; 166 __bss_start = .; 167 __bss_start__ = .; 168 .bss : 169 { 170 *(.dynbss) 171 *(.bss .bss.* .gnu.linkonce.b.*) 172 *(COMMON) 173 /* Align here to ensure that the .bss section occupies space up to 174 _end. Align after .bss to ensure correct alignment even if the 175 .bss section disappears because there are no input sections. 176 FIXME: Why do we need it? When there is no .bss section, we don't 177 pad the .data section. */ 178 . = ALIGN(. != 0 ? 64 / 8 : 1); 179 } 180 _bss_end__ = . ; __bss_end__ = . ; 181 . = ALIGN(64 / 8); 182 . = SEGMENT_START("ldata-segment", .); 183 . = ALIGN(64 / 8); 184 __end__ = . ; 185 _end = .; PROVIDE (end = .); 186 .stack 0x80000 : 187 { 188 _stack = .; 189 *(.stack) 190 } 191 /* Stabs debugging sections. */ 192 .stab 0 : { *(.stab) } 193 .stabstr 0 : { *(.stabstr) } 194 .stab.excl 0 : { *(.stab.excl) } 195 .stab.exclstr 0 : { *(.stab.exclstr) } 196 .stab.index 0 : { *(.stab.index) } 197 .stab.indexstr 0 : { *(.stab.indexstr) } 198 .comment 0 : { *(.comment) } 199 /* DWARF debug sections. 200 Symbols in the DWARF debugging sections are relative to the beginning 201 of the section so we begin them at 0. */ 202 /* DWARF 1 */ 203 .debug 0 : { *(.debug) } 204 .line 0 : { *(.line) } 205 /* GNU DWARF 1 extensions */ 206 .debug_srcinfo 0 : { *(.debug_srcinfo) } 207 .debug_sfnames 0 : { *(.debug_sfnames) } 208 /* DWARF 1.1 and DWARF 2 */ 209 .debug_aranges 0 : { *(.debug_aranges) } 210 .debug_pubnames 0 : { *(.debug_pubnames) } 211 /* DWARF 2 */ 212 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 213 .debug_abbrev 0 : { *(.debug_abbrev) } 214 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } 215 .debug_frame 0 : { *(.debug_frame) } 216 .debug_str 0 : { *(.debug_str) } 217 .debug_loc 0 : { *(.debug_loc) } 218 .debug_macinfo 0 : { *(.debug_macinfo) } 219 /* SGI/MIPS DWARF 2 extensions */ 220 .debug_weaknames 0 : { *(.debug_weaknames) } 221 .debug_funcnames 0 : { *(.debug_funcnames) } 222 .debug_typenames 0 : { *(.debug_typenames) } 223 .debug_varnames 0 : { *(.debug_varnames) } 224 /* DWARF 3 */ 225 .debug_pubtypes 0 : { *(.debug_pubtypes) } 226 .debug_ranges 0 : { *(.debug_ranges) } 227 /* DWARF Extension. */ 228 .debug_macro 0 : { *(.debug_macro) } 229 .debug_addr 0 : { *(.debug_addr) } 230 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) } 231 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 232 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } 233} 234