1 /* Script for -n: mix text and data on same page */ 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 PROVIDE (__executable_start = 0x00010000); . = 0x00010000 + SIZEOF_HEADERS; 14 .interp : { *(.interp) } 15 .note.gnu.build-id : { *(.note.gnu.build-id) } 16 .hash : { *(.hash) } 17 .gnu.hash : { *(.gnu.hash) } 18 .dynsym : { *(.dynsym) } 19 .dynstr : { *(.dynstr) } 20 .gnu.version : { *(.gnu.version) } 21 .gnu.version_d : { *(.gnu.version_d) } 22 .gnu.version_r : { *(.gnu.version_r) } 23 .rel.init : { *(.rel.init) } 24 .rela.init : { *(.rela.init) } 25 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 26 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } 27 .rel.fini : { *(.rel.fini) } 28 .rela.fini : { *(.rela.fini) } 29 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } 30 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } 31 .rel.data.rel.ro : { *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*) } 32 .rela.data.rel.ro : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) } 33 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 34 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 35 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 36 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 37 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 38 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 39 .rel.ctors : { *(.rel.ctors) } 40 .rela.ctors : { *(.rela.ctors) } 41 .rel.dtors : { *(.rel.dtors) } 42 .rela.dtors : { *(.rela.dtors) } 43 .rel.got : { *(.rel.got) } 44 .rela.got : { *(.rela.got) } 45 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 46 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 47 .rel.iplt : 48 { 49 PROVIDE_HIDDEN (__rel_iplt_start = .); 50 *(.rel.iplt) 51 PROVIDE_HIDDEN (__rel_iplt_end = .); 52 } 53 .rela.iplt : 54 { 55 PROVIDE_HIDDEN (__rela_iplt_start = .); 56 *(.rela.iplt) 57 PROVIDE_HIDDEN (__rela_iplt_end = .); 58 } 59 .rel.plt : 60 { 61 *(.rel.plt) 62 } 63 .rela.plt : 64 { 65 *(.rela.plt) 66 } 67 .init : 68 { 69 KEEP (*(SORT_NONE(.init))) 70 } 71 .plt : { *(.plt) } 72 .iplt : { *(.iplt) } 73 .text : 74 { 75 *(.text.unlikely .text.*_unlikely .text.unlikely.*) 76 *(.text.exit .text.exit.*) 77 *(.text.startup .text.startup.*) 78 *(.text.hot .text.hot.*) 79 *(.text .stub .text.* .gnu.linkonce.t.*) 80 /* .gnu.warning sections are handled specially by elf32.em. */ 81 *(.gnu.warning) 82 *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx) 83 } 84 .fini : 85 { 86 KEEP (*(SORT_NONE(.fini))) 87 } 88 PROVIDE (__etext = .); 89 PROVIDE (_etext = .); 90 PROVIDE (etext = .); 91 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 92 .rodata1 : { *(.rodata1) } 93 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } 94 PROVIDE_HIDDEN (__exidx_start = .); 95 .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } 96 PROVIDE_HIDDEN (__exidx_end = .); 97 .eh_frame_hdr : { *(.eh_frame_hdr) } 98 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } 99 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table 100 .gcc_except_table.*) } 101 /* These sections are generated by the Sun/Oracle C++ compiler. */ 102 .exception_ranges : ONLY_IF_RO { *(.exception_ranges 103 .exception_ranges*) } 104 /* Adjust the address for the data segment. For 32 bits we want to align 105 at exactly a page boundary to make life easier for apriori. */ 106 . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); 107 /* Exception handling */ 108 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } 109 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } 110 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) } 111 /* Thread Local Storage sections */ 112 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 113 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 114 /* Ensure the __preinit_array_start label is properly aligned. We 115 could instead move the label definition inside the section, but 116 the linker would then create the section even if it turns out to 117 be empty, which isn't pretty. */ 118 . = ALIGN(32 / 8); 119 PROVIDE_HIDDEN (__preinit_array_start = .); 120 .preinit_array : 121 { 122 KEEP (*(.preinit_array)) 123 } 124 PROVIDE_HIDDEN (__preinit_array_end = .); 125 PROVIDE_HIDDEN (__init_array_start = .); 126 .init_array : 127 { 128 KEEP (*crtbegin*.o(.init_array)) 129 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) 130 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .ctors)) 131 } 132 PROVIDE_HIDDEN (__init_array_end = .); 133 PROVIDE_HIDDEN (__fini_array_start = .); 134 .fini_array : 135 { 136 KEEP (*crtbegin*.o(.fini_array)) 137 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) 138 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .dtors)) 139 } 140 PROVIDE_HIDDEN (__fini_array_end = .); 141 .ctors : 142 { 143 /* gcc uses crtbegin.o to find the start of 144 the constructors, so we make sure it is 145 first. Because this is a wildcard, it 146 doesn't matter if the user does not 147 actually link against crtbegin.o; the 148 linker won't look for a file to match a 149 wildcard. The wildcard also means that it 150 doesn't matter which directory crtbegin.o 151 is in. */ 152 KEEP (*crtbegin.o(.ctors)) 153 KEEP (*crtbegin*.o(.ctors)) 154 /* We don't want to include the .ctor section from 155 the crtend.o file until after the sorted ctors. 156 The .ctor section from the crtend file contains the 157 end of ctors marker and it must be last */ 158 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .ctors)) 159 KEEP (*(SORT(.ctors.*))) 160 KEEP (*(.ctors)) 161 } 162 .dtors : 163 { 164 KEEP (*crtbegin.o(.dtors)) 165 KEEP (*crtbegin*.o(.dtors)) 166 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .dtors)) 167 KEEP (*(SORT(.dtors.*))) 168 KEEP (*(.dtors)) 169 } 170 .jcr : { KEEP (*(.jcr)) } 171 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) } 172 .dynamic : { *(.dynamic) } 173 . = DATA_SEGMENT_RELRO_END (0, .); 174 .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) } 175 .data : 176 { 177 PROVIDE (__data_start = .); 178 *(.data .data.* .gnu.linkonce.d.*) 179 SORT(CONSTRUCTORS) 180 } 181 .data1 : { *(.data1) } 182 _edata = .; PROVIDE (edata = .); 183 __bss_start = .; 184 __bss_start__ = .; 185 .bss : 186 { 187 *(.dynbss) 188 *(.bss .bss.* .gnu.linkonce.b.*) 189 *(COMMON) 190 /* Align here to ensure that the .bss section occupies space up to 191 _end. Align after .bss to ensure correct alignment even if the 192 .bss section disappears because there are no input sections. */ 193 . = ALIGN(32 / 8); 194 } 195 _bss_end__ = . ; __bss_end__ = . ; 196 . = ALIGN(32 / 8); 197 . = SEGMENT_START("ldata-segment", .); 198 . = ALIGN(32 / 8); 199 __end__ = . ; 200 _end = .; 201 _bss_end__ = . ; __bss_end__ = . ; __end__ = . ; 202 PROVIDE (end = .); 203 . = DATA_SEGMENT_END (.); 204 /* Stabs debugging sections. */ 205 .stab 0 : { *(.stab) } 206 .stabstr 0 : { *(.stabstr) } 207 .stab.excl 0 : { *(.stab.excl) } 208 .stab.exclstr 0 : { *(.stab.exclstr) } 209 .stab.index 0 : { *(.stab.index) } 210 .stab.indexstr 0 : { *(.stab.indexstr) } 211 .comment 0 : { *(.comment) } 212 /* DWARF debug sections. 213 Symbols in the DWARF debugging sections are relative to the beginning 214 of the section so we begin them at 0. */ 215 /* DWARF 1 */ 216 .debug 0 : { *(.debug) } 217 .line 0 : { *(.line) } 218 /* GNU DWARF 1 extensions */ 219 .debug_srcinfo 0 : { *(.debug_srcinfo) } 220 .debug_sfnames 0 : { *(.debug_sfnames) } 221 /* DWARF 1.1 and DWARF 2 */ 222 .debug_aranges 0 : { *(.debug_aranges) } 223 .debug_pubnames 0 : { *(.debug_pubnames) } 224 /* DWARF 2 */ 225 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 226 .debug_abbrev 0 : { *(.debug_abbrev) } 227 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } 228 .debug_frame 0 : { *(.debug_frame) } 229 .debug_str 0 : { *(.debug_str) } 230 .debug_loc 0 : { *(.debug_loc) } 231 .debug_macinfo 0 : { *(.debug_macinfo) } 232 /* SGI/MIPS DWARF 2 extensions */ 233 .debug_weaknames 0 : { *(.debug_weaknames) } 234 .debug_funcnames 0 : { *(.debug_funcnames) } 235 .debug_typenames 0 : { *(.debug_typenames) } 236 .debug_varnames 0 : { *(.debug_varnames) } 237 /* DWARF 3 */ 238 .debug_pubtypes 0 : { *(.debug_pubtypes) } 239 .debug_ranges 0 : { *(.debug_ranges) } 240 /* DWARF Extension. */ 241 .debug_macro 0 : { *(.debug_macro) } 242 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } 243 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 244 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.mdebug.*) } 245 } 246