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