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