1 /* Script for --shared -z combreloc: shared library, combine & sort relocs */ 2 /* Modified for Android. */ 3 OUTPUT_FORMAT("elf64-tradbigmips", "elf64-tradbigmips", 4 "elf64-tradlittlemips") 5 OUTPUT_ARCH(mips) 6 ENTRY(__start) 7 SECTIONS 8 { 9 /* Read-only sections, merged into text segment: */ 10 . = 0 + SIZEOF_HEADERS; 11 .MIPS.abiflags : { *(.MIPS.abiflags) } 12 .MIPS.options : { *(.MIPS.options) } 13 .note.gnu.build-id : { *(.note.gnu.build-id) } 14 .dynamic : { *(.dynamic) } 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.dyn : 23 { 24 *(.rel.init) 25 *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) 26 *(.rel.fini) 27 *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) 28 *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*) 29 *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) 30 *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) 31 *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) 32 *(.rel.ctors) 33 *(.rel.dtors) 34 *(.rel.got) 35 *(.rel.dyn) 36 *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) 37 *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) 38 *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) 39 *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) 40 *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) 41 *(.rel.iplt) 42 } 43 .rela.dyn : 44 { 45 *(.rela.init) 46 *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) 47 *(.rela.fini) 48 *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) 49 *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) 50 *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) 51 *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) 52 *(.rela.ctors) 53 *(.rela.dtors) 54 *(.rela.got) 55 *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) 56 *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) 57 *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) 58 *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) 59 *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) 60 *(.rela.iplt) 61 } 62 .rel.plt : 63 { 64 *(.rel.plt) 65 } 66 .rela.plt : 67 { 68 *(.rela.plt) 69 } 70 .init : 71 { 72 KEEP (*(SORT_NONE(.init))) 73 } 74 .plt : { *(.plt) } 75 .iplt : { *(.iplt) } 76 .text : 77 { 78 _ftext = . ; 79 *(.text.unlikely .text.*_unlikely .text.unlikely.*) 80 *(.text.exit .text.exit.*) 81 *(.text.startup .text.startup.*) 82 *(.text.hot .text.hot.*) 83 *(.text .stub .text.* .gnu.linkonce.t.*) 84 /* .gnu.warning sections are handled specially by elf32.em. */ 85 *(.gnu.warning) 86 *(.mips16.fn.*) *(.mips16.call.*) 87 } 88 .fini : 89 { 90 KEEP (*(SORT_NONE(.fini))) 91 } 92 PROVIDE (__etext = .); 93 PROVIDE (_etext = .); 94 PROVIDE (etext = .); 95 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 96 .rodata1 : { *(.rodata1) } 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)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = 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 .preinit_array : 120 { 121 KEEP (*(.preinit_array)) 122 } 123 .init_array : 124 { 125 KEEP (*crtbegin*.o(.init_array)) 126 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) 127 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .ctors)) 128 } 129 .fini_array : 130 { 131 KEEP (*crtbegin*.o(.fini_array)) 132 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) 133 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .dtors)) 134 } 135 .ctors : 136 { 137 /* gcc uses crtbegin.o to find the start of 138 the constructors, so we make sure it is 139 first. Because this is a wildcard, it 140 doesn't matter if the user does not 141 actually link against crtbegin.o; the 142 linker won't look for a file to match a 143 wildcard. The wildcard also means that it 144 doesn't matter which directory crtbegin.o 145 is in. */ 146 KEEP (*crtbegin.o(.ctors)) 147 KEEP (*crtbegin*.o(.ctors)) 148 /* We don't want to include the .ctor section from 149 the crtend.o file until after the sorted ctors. 150 The .ctor section from the crtend file contains the 151 end of ctors marker and it must be last */ 152 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .ctors)) 153 KEEP (*(SORT(.ctors.*))) 154 KEEP (*(.ctors)) 155 } 156 .dtors : 157 { 158 KEEP (*crtbegin.o(.dtors)) 159 KEEP (*crtbegin*.o(.dtors)) 160 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .dtors)) 161 KEEP (*(SORT(.dtors.*))) 162 KEEP (*(.dtors)) 163 } 164 .jcr : { KEEP (*(.jcr)) } 165 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) } 166 . = DATA_SEGMENT_RELRO_END (0, .); 167 .data : 168 { 169 _fdata = . ; 170 *(.data .data.* .gnu.linkonce.d.*) 171 SORT(CONSTRUCTORS) 172 } 173 .data1 : { *(.data1) } 174 .got.plt : { *(.got.plt) } 175 . = .; 176 . = .; 177 HIDDEN (_gp = ALIGN (16) + 0x7ff0); 178 .got : { *(.got) } 179 /* We want the small data sections together, so single-instruction offsets 180 can access them all, and initialized data all before uninitialized, so 181 we can shorten the on-disk segment size. */ 182 .sdata : 183 { 184 *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) 185 *(.sdata .sdata.* .gnu.linkonce.s.*) 186 } 187 .lit8 : { *(.lit8) } 188 .lit4 : { *(.lit4) } 189 .srdata : { *(.srdata) } 190 _edata = .; PROVIDE (edata = .); 191 . = .; 192 __bss_start = .; 193 _fbss = .; 194 .sbss : 195 { 196 *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) 197 *(.dynsbss) 198 *(.sbss .sbss.* .gnu.linkonce.sb.*) 199 *(.scommon) 200 } 201 .bss : 202 { 203 *(.dynbss) 204 *(.bss .bss.* .gnu.linkonce.b.*) 205 *(COMMON) 206 /* Align here to ensure that the .bss section occupies space up to 207 _end. Align after .bss to ensure correct alignment even if the 208 .bss section disappears because there are no input sections. */ 209 . = ALIGN(64 / 8); 210 } 211 . = ALIGN(64 / 8); 212 . = SEGMENT_START("ldata-segment", .); 213 . = ALIGN(64 / 8); 214 _end = .; 215 _bss_end__ = . ; __bss_end__ = . ; __end__ = . ; 216 PROVIDE (end = .); 217 . = DATA_SEGMENT_END (.); 218 /* Stabs debugging sections. */ 219 .stab 0 : { *(.stab) } 220 .stabstr 0 : { *(.stabstr) } 221 .stab.excl 0 : { *(.stab.excl) } 222 .stab.exclstr 0 : { *(.stab.exclstr) } 223 .stab.index 0 : { *(.stab.index) } 224 .stab.indexstr 0 : { *(.stab.indexstr) } 225 .comment 0 : { *(.comment) } 226 /* DWARF debug sections. 227 Symbols in the DWARF debugging sections are relative to the beginning 228 of the section so we begin them at 0. */ 229 /* DWARF 1 */ 230 .debug 0 : { *(.debug) } 231 .line 0 : { *(.line) } 232 /* GNU DWARF 1 extensions */ 233 .debug_srcinfo 0 : { *(.debug_srcinfo) } 234 .debug_sfnames 0 : { *(.debug_sfnames) } 235 /* DWARF 1.1 and DWARF 2 */ 236 .debug_aranges 0 : { *(.debug_aranges) } 237 .debug_pubnames 0 : { *(.debug_pubnames) } 238 /* DWARF 2 */ 239 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 240 .debug_abbrev 0 : { *(.debug_abbrev) } 241 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } 242 .debug_frame 0 : { *(.debug_frame) } 243 .debug_str 0 : { *(.debug_str) } 244 .debug_loc 0 : { *(.debug_loc) } 245 .debug_macinfo 0 : { *(.debug_macinfo) } 246 /* SGI/MIPS DWARF 2 extensions */ 247 .debug_weaknames 0 : { *(.debug_weaknames) } 248 .debug_funcnames 0 : { *(.debug_funcnames) } 249 .debug_typenames 0 : { *(.debug_typenames) } 250 .debug_varnames 0 : { *(.debug_varnames) } 251 /* DWARF 3 */ 252 .debug_pubtypes 0 : { *(.debug_pubtypes) } 253 .debug_ranges 0 : { *(.debug_ranges) } 254 /* DWARF Extension. */ 255 .debug_macro 0 : { *(.debug_macro) } 256 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } 257 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } 258 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } 259 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.mdebug.*) } 260 } 261