1 /* Script for ld --shared: link shared library */ 2 /* Copyright (C) 2014 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 OUTPUT_FORMAT("elf32-bigarm", "elf32-bigarm", 7 "elf32-littlearm") 8 OUTPUT_ARCH(arm) 9 ENTRY(_start) 10 SECTIONS 11 { 12 /* Read-only sections, merged into text segment: */ 13 . = 0 + SIZEOF_HEADERS; 14 .note.gnu.build-id : { *(.note.gnu.build-id) } 15 .hash : { *(.hash) } 16 .gnu.hash : { *(.gnu.hash) } 17 .dynsym : { *(.dynsym) } 18 .dynstr : { *(.dynstr) } 19 .gnu.version : { *(.gnu.version) } 20 .gnu.version_d : { *(.gnu.version_d) } 21 .gnu.version_r : { *(.gnu.version_r) } 22 .rel.init : { *(.rel.init) } 23 .rela.init : { *(.rela.init) } 24 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 25 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } 26 .rel.fini : { *(.rel.fini) } 27 .rela.fini : { *(.rela.fini) } 28 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } 29 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } 30 .rel.data.rel.ro : { *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*) } 31 .rela.data.rel.ro : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) } 32 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 33 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 34 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 35 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 36 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 37 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 38 .rel.ctors : { *(.rel.ctors) } 39 .rela.ctors : { *(.rela.ctors) } 40 .rel.dtors : { *(.rel.dtors) } 41 .rela.dtors : { *(.rela.dtors) } 42 .rel.got : { *(.rel.got) } 43 .rela.got : { *(.rela.got) } 44 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 45 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 46 .rel.iplt : 47 { 48 *(.rel.iplt) 49 } 50 .rela.iplt : 51 { 52 *(.rela.iplt) 53 } 54 .rel.plt : 55 { 56 *(.rel.plt) 57 } 58 .rela.plt : 59 { 60 *(.rela.plt) 61 } 62 .init : 63 { 64 KEEP (*(SORT_NONE(.init))) 65 } 66 .plt : { *(.plt) } 67 .iplt : { *(.iplt) } 68 .text : 69 { 70 *(.text.unlikely .text.*_unlikely .text.unlikely.*) 71 *(.text.exit .text.exit.*) 72 *(.text.startup .text.startup.*) 73 *(.text.hot .text.hot.*) 74 *(.text .stub .text.* .gnu.linkonce.t.*) 75 /* .gnu.warning sections are handled specially by elf32.em. */ 76 *(.gnu.warning) 77 *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx) 78 } 79 .fini : 80 { 81 KEEP (*(SORT_NONE(.fini))) 82 } 83 PROVIDE (__etext = .); 84 PROVIDE (_etext = .); 85 PROVIDE (etext = .); 86 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 87 .rodata1 : { *(.rodata1) } 88 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } 89 PROVIDE_HIDDEN (__exidx_start = .); 90 .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } 91 PROVIDE_HIDDEN (__exidx_end = .); 92 .eh_frame_hdr : { *(.eh_frame_hdr) } 93 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } 94 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table 95 .gcc_except_table.*) } 96 /* These sections are generated by the Sun/Oracle C++ compiler. */ 97 .exception_ranges : ONLY_IF_RO { *(.exception_ranges 98 .exception_ranges*) } 99 /* Adjust the address for the data segment. For 32 bits we want to align 100 at exactly a page boundary to make life easier for apriori. */ 101 . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)); 102 /* Exception handling */ 103 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } 104 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } 105 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) } 106 /* Thread Local Storage sections */ 107 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 108 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 109 /* Ensure the __preinit_array_start label is properly aligned. We 110 could instead move the label definition inside the section, but 111 the linker would then create the section even if it turns out to 112 be empty, which isn't pretty. */ 113 . = ALIGN(32 / 8); 114 .preinit_array : 115 { 116 KEEP (*(.preinit_array)) 117 } 118 .init_array : 119 { 120 KEEP (*crtbegin*.o(.init_array)) 121 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) 122 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .ctors)) 123 } 124 .fini_array : 125 { 126 KEEP (*crtbegin*.o(.fini_array)) 127 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) 128 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .dtors)) 129 } 130 .ctors : 131 { 132 /* gcc uses crtbegin.o to find the start of 133 the constructors, so we make sure it is 134 first. Because this is a wildcard, it 135 doesn't matter if the user does not 136 actually link against crtbegin.o; the 137 linker won't look for a file to match a 138 wildcard. The wildcard also means that it 139 doesn't matter which directory crtbegin.o 140 is in. */ 141 KEEP (*crtbegin.o(.ctors)) 142 KEEP (*crtbegin*.o(.ctors)) 143 /* We don't want to include the .ctor section from 144 the crtend.o file until after the sorted ctors. 145 The .ctor section from the crtend file contains the 146 end of ctors marker and it must be last */ 147 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .ctors)) 148 KEEP (*(SORT(.ctors.*))) 149 KEEP (*(.ctors)) 150 } 151 .dtors : 152 { 153 KEEP (*crtbegin.o(.dtors)) 154 KEEP (*crtbegin*.o(.dtors)) 155 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .dtors)) 156 KEEP (*(SORT(.dtors.*))) 157 KEEP (*(.dtors)) 158 } 159 .jcr : { KEEP (*(.jcr)) } 160 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) } 161 .dynamic : { *(.dynamic) } 162 .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) } 163 .data : 164 { 165 __data_start = . ; 166 *(.data .data.* .gnu.linkonce.d.*) 167 SORT(CONSTRUCTORS) 168 } 169 .data1 : { *(.data1) } 170 _edata = .; PROVIDE (edata = .); 171 __bss_start = .; 172 __bss_start__ = .; 173 .bss : 174 { 175 *(.dynbss) 176 *(.bss .bss.* .gnu.linkonce.b.*) 177 *(COMMON) 178 /* Align here to ensure that the .bss section occupies space up to 179 _end. Align after .bss to ensure correct alignment even if the 180 .bss section disappears because there are no input sections. */ 181 . = ALIGN(32 / 8); 182 } 183 _bss_end__ = . ; __bss_end__ = . ; 184 . = ALIGN(32 / 8); 185 . = SEGMENT_START("ldata-segment", .); 186 . = ALIGN(32 / 8); 187 __end__ = . ; 188 _end = .; 189 _bss_end__ = . ; __bss_end__ = . ; __end__ = . ; 190 PROVIDE (end = .); 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 .stack 0x80000 : 230 { 231 _stack = .; 232 *(.stack) 233 } 234 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) } 235 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 236 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.mdebug.*) } 237 } 238