1ENTRY(_start); 2 3SEARCH_DIR(/lib); 4SEARCH_DIR(/usr/lib); 5SEARCH_DIR(/usr/local/lib); 6SEARCH_DIR(/usr/i686-pc-linux-gnu/lib); 7 8INTERP(/lib/ld-linux.so.2); 9 10PAGESIZE(4k); 11 12SEGMENT [RX] 13{ 14#ifdef SHARED 15 . = SIZEOF_HEADERS; 16#else 17 . = 0x08048000 + SIZEOF_HEADERS; 18#endif 19 20 .interp; 21 .note.ABI-tag; 22 .note.gnu.build-id; 23 .hash; 24 .gnu.hash; 25 .dynsym; 26 .dynstr; 27 .gnu.version; 28 .gnu.version_d; 29 .gnu.version_r; 30 .rel.dyn; 31 .rel.plt; 32 .init { KEEP (*(.init)) } 33 .plt; 34 .text 35 { 36 *(.text) 37 *(.text.*) 38 *(.stub) 39 *(.gnu.warning) 40 *(.gnu.linkonce.t.*) 41 } 42 .fini { KEEP (*(.fini)) } 43 PROVIDE (__etext = .); 44 PROVIDE (_etext = .); 45 PROVIDE (etext = .); 46 .rodata 47 { 48 *(.rodata) 49 *(.rodata.*) 50 *(.gnu.linkonce.r.*) 51 } 52 .rodata1; 53 .eh_frame_hdr; 54 . = ALIGN(32 / 8); 55 PROVIDE (__preinit_array_start = .); 56 .preinit_array 57 { 58 *(.preinit_array) 59 } 60 PROVIDE (__preinit_array_end = .); 61 PROVIDE (__init_array_start = .); 62 .init_array 63 { 64 *(.init_array) 65 } 66 PROVIDE (__init_array_end = .); 67 PROVIDE (__fini_array_start = .); 68 .fini_array 69 { 70 *(.fini_array) 71 } 72 PROVIDE (__fini_array_end = .); 73} 74 75SEGMENT [RW] 76{ 77 .sdata2 78 { 79 *(.sdata2) 80 *(.sdata2.*) 81 *(.gnu.linkonce.s2.*) 82 } 83 .sbss2 84 { 85 *(.sbss2) 86 *(.sbss2.*) 87 *(.gnu.linkonce.sb2.*) 88 } 89 /* Adjust the address for the data segment. We want to adjust up to 90 the same address within the page on the next page up. */ 91 . = ALIGN(PAGESIZE) + (. & (PAGESIZE - 1)); 92 .eh_frame 93 { 94 KEEP (*(.eh_frame)) 95 } 96 .gcc_except_table; 97 .tdata 98 { 99 *(.tdata) 100 *(.tdata.*) 101 *(.gnu.linkone.td.*) 102 } 103 .tbss 104 { 105 *(.tbss) 106 *(.tbss.*) 107 *(.gnu.linkone.tb.*) 108 *(.tcommon) 109 } 110 .ctors 111 { 112 /* gcc uses crtbegin.o to find the start of 113 the constructors, so we make sure it is 114 first. Because this is a wildcard, it 115 doesn't matter if the user does not 116 actually link against crtbegin.o; the 117 linker won't look for a file to match a 118 wildcard. The wildcard also means that it 119 doesn't matter which directory crtbegin.o 120 is in. */ 121 KEEP (*crtbegin.o(.ctors)) 122 /* We don't want to include the .ctor section from 123 the crtend.o file until after the sorted ctors. 124 The .ctor section from the crtend file contains the 125 end of ctors marker and it must be last */ 126 KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) 127 KEEP (*(SORT(.ctors.*))) 128 KEEP (*(.ctors)) 129 } 130 .dtors 131 { 132 KEEP (*crtbegin.o(.dtors)) 133 KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) 134 KEEP (*(SORT(.dtors.*))) 135 KEEP (*(.dtors)) 136 } 137 .jcr; 138 .dynamic; 139 .got; 140 .got.plt; 141 .data 142 { 143 *(.data) 144 *(.data.*) 145 *(.gnu.linkonce.d.*) 146 } 147 /* We want the small data sections together, so single-instruction offsets 148 can access them all, and initialized data all before uninitialized, so 149 we can shorten the on-disk segment size. */ 150 .data1; 151 .sdata 152 { 153 *(.sdata) 154 *(.sdata.*) 155 *(.gnu.linkonce.s.*) 156 } 157 _edata = .; 158 PROVIDE (edata = .); 159 __bss_start = .; 160 .sbss 161 { 162 PROVIDE (__sbss_start = .); 163 PROVIDE (___sbss_start = .); 164 *(.dynsbss) 165 *(.sbss) 166 *(.sbss.*) 167 *(.gnu.linkonce.sb.*) 168 *(.scommon) 169 PROVIDE (__sbss_end = .); 170 PROVIDE (___sbss_end = .); 171 } 172 .bss 173 { 174 *(.dynbss) 175 *(.bss) 176 *(.bss.*) 177 *(.gnu.linkonce.b.*) 178 *(COMMON) 179 /* Align here to ensure that the .bss section occupies space up to 180 _end. Align after .bss to ensure correct alignment even if the 181 .bss section disappears because there are no input sections. */ 182 . = ALIGN(32 / 8); 183 } 184 . = ALIGN(32 / 8); 185 _end = .; 186 PROVIDE (end = .); 187} 188 189SEGMENT [] 190{ 191 /* Stabs debugging sections. */ 192 .stab; 193 .stabstr; 194 .stab.excl; 195 .stab.exclstr; 196 .stab.index; 197 .stab.indexstr; 198 .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; 204 .line; 205 /* GNU DWARF 1 extensions */ 206 .debug_srcinfo; 207 .debug_sfnames; 208 /* DWARF 1.1 and DWARF 2 */ 209 .debug_aranges; 210 .debug_pubnames; 211 /* DWARF 2 */ 212 .debug_info 213 { 214 *(.debug_info) 215 *(.gnu.linkonce.wi.*) 216 } 217 .debug_abbrev; 218 .debug_line; 219 .debug_frame; 220 .debug_str; 221 .debug_loc; 222 .debug_macinfo; 223 /* SGI/MIPS DWARF 2 extensions */ 224 .debug_weaknames; 225 .debug_funcnames; 226 .debug_typenames; 227 .debug_varnames; 228 /* These must appear regardless of . */ 229} 230