1 1.1 matt /* Script for -N: mix text and data on same page; don't align data */ 2 1.1 matt OUTPUT_ARCH(mips) 3 1.1 matt ENTRY(__start) 4 1.1 matt SEARCH_DIR("=/usr/lib"); 5 1.1 matt SECTIONS 6 1.1 matt { 7 1.1 matt /* Read-only sections, merged into text segment: */ 8 1.1 matt PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x20000000)); . = SEGMENT_START("text-segment", 0x20000000) + SIZEOF_HEADERS; 9 1.1 matt .interp : { *(.interp) } 10 1.1 matt .reginfo : { *(.reginfo) } 11 1.1 matt .note.gnu.build-id : { *(.note.gnu.build-id) } 12 1.1 matt .dynamic : { *(.dynamic) } 13 1.1 matt .hash : { *(.hash) } 14 1.1 matt .gnu.hash : { *(.gnu.hash) } 15 1.1 matt .dynsym : { *(.dynsym) } 16 1.1 matt .dynstr : { *(.dynstr) } 17 1.1 matt .gnu.version : { *(.gnu.version) } 18 1.1 matt .gnu.version_d : { *(.gnu.version_d) } 19 1.1 matt .gnu.version_r : { *(.gnu.version_r) } 20 1.1 matt .rel.init : { *(.rel.init) } 21 1.1 matt .rela.init : { *(.rela.init) } 22 1.1 matt .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 23 1.1 matt .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } 24 1.1 matt .rel.fini : { *(.rel.fini) } 25 1.1 matt .rela.fini : { *(.rela.fini) } 26 1.1 matt .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } 27 1.1 matt .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } 28 1.1 matt .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) } 29 1.1 matt .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) } 30 1.1 matt .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 31 1.1 matt .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 32 1.1 matt .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 33 1.1 matt .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 34 1.1 matt .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 35 1.1 matt .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 36 1.1 matt .rel.ctors : { *(.rel.ctors) } 37 1.1 matt .rela.ctors : { *(.rela.ctors) } 38 1.1 matt .rel.dtors : { *(.rel.dtors) } 39 1.1 matt .rela.dtors : { *(.rela.dtors) } 40 1.1 matt .rel.got : { *(.rel.got) } 41 1.1 matt .rela.got : { *(.rela.got) } 42 1.1 matt .rel.dyn : { *(.rel.dyn) } 43 1.1 matt .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } 44 1.1 matt .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } 45 1.1 matt .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } 46 1.1 matt .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } 47 1.1 matt .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } 48 1.1 matt .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } 49 1.1 matt .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } 50 1.1 matt .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } 51 1.1 matt .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 52 1.1 matt .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 53 1.1 matt .rel.iplt : 54 1.1 matt { 55 1.1 matt PROVIDE_HIDDEN (__rel_iplt_start = .); 56 1.1 matt *(.rel.iplt) 57 1.1 matt PROVIDE_HIDDEN (__rel_iplt_end = .); 58 1.1 matt } 59 1.1 matt .rela.iplt : 60 1.1 matt { 61 1.1 matt PROVIDE_HIDDEN (__rela_iplt_start = .); 62 1.1 matt *(.rela.iplt) 63 1.1 matt PROVIDE_HIDDEN (__rela_iplt_end = .); 64 1.1 matt } 65 1.1 matt .rel.plt : 66 1.1 matt { 67 1.1 matt *(.rel.plt) 68 1.1 matt } 69 1.1 matt .rela.plt : 70 1.1 matt { 71 1.1 matt *(.rela.plt) 72 1.1 matt } 73 1.1 matt .init : 74 1.1 matt { 75 1.1 matt KEEP (*(.init)) 76 1.1 matt } =0 77 1.1 matt .plt : { *(.plt) } 78 1.1 matt .iplt : { *(.iplt) } 79 1.1 matt .text : 80 1.1 matt { 81 1.1 matt _ftext = . ; 82 1.1 matt *(.text.unlikely .text.*_unlikely) 83 1.1 matt *(.text.exit .text.exit.*) 84 1.1 matt *(.text.startup .text.startup.*) 85 1.1 matt *(.text.hot .text.hot.*) 86 1.1 matt *(.text .stub .text.* .gnu.linkonce.t.*) 87 1.1 matt /* .gnu.warning sections are handled specially by elf32.em. */ 88 1.1 matt *(.gnu.warning) 89 1.1 matt *(.mips16.fn.*) *(.mips16.call.*) 90 1.1 matt } =0 91 1.1 matt .fini : 92 1.1 matt { 93 1.1 matt KEEP (*(.fini)) 94 1.1 matt } =0 95 1.1 matt PROVIDE (__etext = .); 96 1.1 matt PROVIDE (_etext = .); 97 1.1 matt PROVIDE (etext = .); 98 1.1 matt .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 99 1.1 matt .rodata1 : { *(.rodata1) } 100 1.1 matt .sdata2 : 101 1.1 matt { 102 1.1 matt *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) 103 1.1 matt } 104 1.1 matt .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } 105 1.1 matt .eh_frame_hdr : { *(.eh_frame_hdr) } 106 1.1 matt .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } 107 1.1 matt .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } 108 1.1 matt /* Adjust the address for the data segment. We want to adjust up to 109 1.1 matt the same address within the page on the next page up. */ 110 1.1 matt . = .; 111 1.1 matt /* Exception handling */ 112 1.1 matt .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } 113 1.1 matt .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } 114 1.1 matt /* Thread Local Storage sections */ 115 1.1 matt .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 116 1.1 matt .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 117 1.1 matt .preinit_array : 118 1.1 matt { 119 1.1 matt PROVIDE_HIDDEN (__preinit_array_start = .); 120 1.1 matt KEEP (*(.preinit_array)) 121 1.1 matt PROVIDE_HIDDEN (__preinit_array_end = .); 122 1.1 matt } 123 1.1 matt .init_array : 124 1.1 matt { 125 1.1 matt PROVIDE_HIDDEN (__init_array_start = .); 126 1.1 matt KEEP (*(SORT(.init_array.*))) 127 1.1 matt KEEP (*(.init_array)) 128 1.1 matt PROVIDE_HIDDEN (__init_array_end = .); 129 1.1 matt } 130 1.1 matt .fini_array : 131 1.1 matt { 132 1.1 matt PROVIDE_HIDDEN (__fini_array_start = .); 133 1.1 matt KEEP (*(SORT(.fini_array.*))) 134 1.1 matt KEEP (*(.fini_array)) 135 1.1 matt PROVIDE_HIDDEN (__fini_array_end = .); 136 1.1 matt } 137 1.1 matt .ctors : 138 1.1 matt { 139 1.1 matt /* gcc uses crtbegin.o to find the start of 140 1.1 matt the constructors, so we make sure it is 141 1.1 matt first. Because this is a wildcard, it 142 1.1 matt doesn't matter if the user does not 143 1.1 matt actually link against crtbegin.o; the 144 1.1 matt linker won't look for a file to match a 145 1.1 matt wildcard. The wildcard also means that it 146 1.1 matt doesn't matter which directory crtbegin.o 147 1.1 matt is in. */ 148 1.1 matt KEEP (*crtbegin.o(.ctors)) 149 1.1 matt KEEP (*crtbegin?.o(.ctors)) 150 1.1 matt /* We don't want to include the .ctor section from 151 1.1 matt the crtend.o file until after the sorted ctors. 152 1.1 matt The .ctor section from the crtend file contains the 153 1.1 matt end of ctors marker and it must be last */ 154 1.1 matt KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) 155 1.1 matt KEEP (*(SORT(.ctors.*))) 156 1.1 matt KEEP (*(.ctors)) 157 1.1 matt } 158 1.1 matt .dtors : 159 1.1 matt { 160 1.1 matt KEEP (*crtbegin.o(.dtors)) 161 1.1 matt KEEP (*crtbegin?.o(.dtors)) 162 1.1 matt KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) 163 1.1 matt KEEP (*(SORT(.dtors.*))) 164 1.1 matt KEEP (*(.dtors)) 165 1.1 matt } 166 1.1 matt .jcr : { KEEP (*(.jcr)) } 167 1.1 matt .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } 168 1.1 matt .data : 169 1.1 matt { 170 1.1 matt _fdata = . ; 171 1.1 matt *(.data .data.* .gnu.linkonce.d.*) 172 1.1 matt SORT(CONSTRUCTORS) 173 1.1 matt } 174 1.1 matt .data1 : { *(.data1) } 175 1.1 matt .got.plt : { *(.got.plt) } 176 1.1 matt . = .; 177 1.1 matt _gp = ALIGN(16) + 0x7ff0; 178 1.1 matt .got : { *(.got) } 179 1.1 matt /* We want the small data sections together, so single-instruction offsets 180 1.1 matt can access them all, and initialized data all before uninitialized, so 181 1.1 matt we can shorten the on-disk segment size. */ 182 1.1 matt .sdata : 183 1.1 matt { 184 1.1 matt *(.sdata .sdata.* .gnu.linkonce.s.*) 185 1.1 matt } 186 1.1 matt .lit8 : { *(.lit8) } 187 1.1 matt .lit4 : { *(.lit4) } 188 1.1 matt _edata = .; PROVIDE (edata = .); 189 1.1 matt __bss_start = .; 190 1.1 matt _fbss = .; 191 1.1 matt .sbss : 192 1.1 matt { 193 1.1 matt *(.dynsbss) 194 1.1 matt *(.sbss .sbss.* .gnu.linkonce.sb.*) 195 1.1 matt *(.scommon) 196 1.1 matt } 197 1.1 matt .bss : 198 1.1 matt { 199 1.1 matt *(.dynbss) 200 1.1 matt *(.bss .bss.* .gnu.linkonce.b.*) 201 1.1 matt *(COMMON) 202 1.1 matt /* Align here to ensure that the .bss section occupies space up to 203 1.1 matt _end. Align after .bss to ensure correct alignment even if the 204 1.1 matt .bss section disappears because there are no input sections. 205 1.1 matt FIXME: Why do we need it? When there is no .bss section, we don't 206 1.1 matt pad the .data section. */ 207 1.1 matt . = ALIGN(. != 0 ? 32 / 8 : 1); 208 1.1 matt } 209 1.1 matt . = ALIGN(32 / 8); 210 1.1 matt . = ALIGN(32 / 8); 211 1.1 matt _end = .; PROVIDE (end = .); 212 1.1 matt /* Stabs debugging sections. */ 213 1.1 matt .stab 0 : { *(.stab) } 214 1.1 matt .stabstr 0 : { *(.stabstr) } 215 1.1 matt .stab.excl 0 : { *(.stab.excl) } 216 1.1 matt .stab.exclstr 0 : { *(.stab.exclstr) } 217 1.1 matt .stab.index 0 : { *(.stab.index) } 218 1.1 matt .stab.indexstr 0 : { *(.stab.indexstr) } 219 1.1 matt .comment 0 : { *(.comment) } 220 1.1 matt /* DWARF debug sections. 221 1.1 matt Symbols in the DWARF debugging sections are relative to the beginning 222 1.1 matt of the section so we begin them at 0. */ 223 1.1 matt /* DWARF 1 */ 224 1.1 matt .debug 0 : { *(.debug) } 225 1.1 matt .line 0 : { *(.line) } 226 1.1 matt /* GNU DWARF 1 extensions */ 227 1.1 matt .debug_srcinfo 0 : { *(.debug_srcinfo) } 228 1.1 matt .debug_sfnames 0 : { *(.debug_sfnames) } 229 1.1 matt /* DWARF 1.1 and DWARF 2 */ 230 1.1 matt .debug_aranges 0 : { *(.debug_aranges) } 231 1.1 matt .debug_pubnames 0 : { *(.debug_pubnames) } 232 1.1 matt /* DWARF 2 */ 233 1.1 matt .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 234 1.1 matt .debug_abbrev 0 : { *(.debug_abbrev) } 235 1.1 matt .debug_line 0 : { *(.debug_line) } 236 1.1 matt .debug_frame 0 : { *(.debug_frame) } 237 1.1 matt .debug_str 0 : { *(.debug_str) } 238 1.1 matt .debug_loc 0 : { *(.debug_loc) } 239 1.1 matt .debug_macinfo 0 : { *(.debug_macinfo) } 240 1.1 matt /* SGI/MIPS DWARF 2 extensions */ 241 1.1 matt .debug_weaknames 0 : { *(.debug_weaknames) } 242 1.1 matt .debug_funcnames 0 : { *(.debug_funcnames) } 243 1.1 matt .debug_typenames 0 : { *(.debug_typenames) } 244 1.1 matt .debug_varnames 0 : { *(.debug_varnames) } 245 1.1 matt /* DWARF 3 */ 246 1.1 matt .debug_pubtypes 0 : { *(.debug_pubtypes) } 247 1.1 matt .debug_ranges 0 : { *(.debug_ranges) } 248 1.1 matt .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } 249 1.1 matt .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } 250 1.1 matt .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } 251 1.1 matt .mdebug.abi32 : { KEEP(*(.mdebug.abi32)) } 252 1.1 matt .mdebug.abiN32 : { KEEP(*(.mdebug.abiN32)) } 253 1.1 matt .mdebug.abi64 : { KEEP(*(.mdebug.abi64)) } 254 1.1 matt .mdebug.abiO64 : { KEEP(*(.mdebug.abiO64)) } 255 1.1 matt .mdebug.eabi32 : { KEEP(*(.mdebug.eabi32)) } 256 1.1 matt .mdebug.eabi64 : { KEEP(*(.mdebug.eabi64)) } 257 1.1 matt .gcc_compiled_long32 : { KEEP(*(.gcc_compiled_long32)) } 258 1.1 matt .gcc_compiled_long64 : { KEEP(*(.gcc_compiled_long64)) } 259 1.1 matt /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } 260 1.1 matt } 261