1 /* Script for ld --enable-auto-import: Like the default script except read only data is placed into .data */ 2 /* Copyright (C) 2014 Free Software Foundation, Inc. 3 Copying and distribution of this script, with or without modification, 4 are permitted in any medium without royalty provided the copyright 5 notice and this notice are preserved. */ 6 OUTPUT_FORMAT(pei-i386) 7 SEARCH_DIR("=/tmp/build-mingw64-toolchain-joshualang/install-x86_64-linux-gnu/x86_64-w64-mingw32/x86_64-w64-mingw32/lib"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib"); 8 SECTIONS 9 { 10 /* Make the virtual address and file offset synced if the alignment is 11 lower than the target page size. */ 12 . = SIZEOF_HEADERS; 13 . = ALIGN(__section_alignment__); 14 .text __image_base__ + ( __section_alignment__ < 0x1000 ? . : __section_alignment__ ) : 15 { 16 *(.init) 17 *(.text) 18 *(SORT(.text$*)) 19 *(.text.*) 20 *(.gnu.linkonce.t.*) 21 *(.glue_7t) 22 *(.glue_7) 23 ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; 24 LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0); 25 ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; 26 LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0); 27 *(.fini) 28 /* ??? Why is .gcc_exc here? */ 29 *(.gcc_exc) 30 PROVIDE (etext = .); 31 PROVIDE (_etext = .); 32 *(.gcc_except_table) 33 } 34 /* The Cygwin32 library uses a section to avoid copying certain data 35 on fork. This used to be named ".data". The linker used 36 to include this between __data_start__ and __data_end__, but that 37 breaks building the cygwin32 dll. Instead, we name the section 38 ".data_cygwin_nocopy" and explicitly include it after __data_end__. */ 39 .data BLOCK(__section_alignment__) : 40 { 41 __data_start__ = . ; 42 *(.data) 43 *(.data2) 44 *(SORT(.data$*)) 45 *(.rdata) 46 *(SORT(.rdata$*)) 47 *(.jcr) 48 __data_end__ = . ; 49 *(.data_cygwin_nocopy) 50 } 51 .rdata BLOCK(__section_alignment__) : 52 { 53 __rt_psrelocs_start = .; 54 *(.rdata_runtime_pseudo_reloc) 55 __rt_psrelocs_end = .; 56 } 57 __rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start; 58 ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .; 59 __RUNTIME_PSEUDO_RELOC_LIST_END__ = .; 60 ___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size; 61 __RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size; 62 .eh_frame BLOCK(__section_alignment__) : 63 { 64 *(.eh_frame*) 65 } 66 .pdata BLOCK(__section_alignment__) : 67 { 68 *(.pdata) 69 } 70 .bss BLOCK(__section_alignment__) : 71 { 72 __bss_start__ = . ; 73 *(.bss) 74 *(COMMON) 75 __bss_end__ = . ; 76 } 77 .edata BLOCK(__section_alignment__) : 78 { 79 *(.edata) 80 } 81 /DISCARD/ : 82 { 83 *(.debug$S) 84 *(.debug$T) 85 *(.debug$F) 86 *(.drectve) 87 *(.note.GNU-stack) 88 *(.gnu.lto_*) 89 } 90 .idata BLOCK(__section_alignment__) : 91 { 92 /* This cannot currently be handled with grouped sections. 93 See pe.em:sort_sections. */ 94 SORT(*)(.idata$2) 95 SORT(*)(.idata$3) 96 /* These zeroes mark the end of the import list. */ 97 LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); 98 SORT(*)(.idata$4) 99 __IAT_start__ = .; 100 SORT(*)(.idata$5) 101 __IAT_end__ = .; 102 SORT(*)(.idata$6) 103 SORT(*)(.idata$7) 104 } 105 .CRT BLOCK(__section_alignment__) : 106 { 107 ___crt_xc_start__ = . ; 108 *(SORT(.CRT$XC*)) /* C initialization */ 109 ___crt_xc_end__ = . ; 110 ___crt_xi_start__ = . ; 111 *(SORT(.CRT$XI*)) /* C++ initialization */ 112 ___crt_xi_end__ = . ; 113 ___crt_xl_start__ = . ; 114 *(SORT(.CRT$XL*)) /* TLS callbacks */ 115 /* ___crt_xl_end__ is defined in the TLS Directory support code */ 116 ___crt_xp_start__ = . ; 117 *(SORT(.CRT$XP*)) /* Pre-termination */ 118 ___crt_xp_end__ = . ; 119 ___crt_xt_start__ = . ; 120 *(SORT(.CRT$XT*)) /* Termination */ 121 ___crt_xt_end__ = . ; 122 } 123 /* Windows TLS expects .tls$AAA to be at the start and .tls$ZZZ to be 124 at the end of section. This is important because _tls_start MUST 125 be at the beginning of the section to enable SECREL32 relocations with TLS 126 data. */ 127 .tls BLOCK(__section_alignment__) : 128 { 129 ___tls_start__ = . ; 130 *(.tls$AAA) 131 *(.tls) 132 *(.tls$) 133 *(SORT(.tls$*)) 134 *(.tls$ZZZ) 135 ___tls_end__ = . ; 136 } 137 .endjunk BLOCK(__section_alignment__) : 138 { 139 /* end is deprecated, don't use it */ 140 PROVIDE (end = .); 141 PROVIDE ( _end = .); 142 __end__ = .; 143 } 144 .rsrc BLOCK(__section_alignment__) : SUBALIGN(4) 145 { 146 *(.rsrc) 147 *(.rsrc$*) 148 } 149 .reloc BLOCK(__section_alignment__) : 150 { 151 *(.reloc) 152 } 153 .stab BLOCK(__section_alignment__) (NOLOAD) : 154 { 155 *(.stab) 156 } 157 .stabstr BLOCK(__section_alignment__) (NOLOAD) : 158 { 159 *(.stabstr) 160 } 161 /* DWARF debug sections. 162 Symbols in the DWARF debugging sections are relative to the beginning 163 of the section. Unlike other targets that fake this by putting the 164 section VMA at 0, the PE format will not allow it. */ 165 /* DWARF 1.1 and DWARF 2. */ 166 .debug_aranges BLOCK(__section_alignment__) (NOLOAD) : 167 { 168 *(.debug_aranges) 169 } 170 .zdebug_aranges BLOCK(__section_alignment__) (NOLOAD) : 171 { 172 *(.zdebug_aranges) 173 } 174 .debug_pubnames BLOCK(__section_alignment__) (NOLOAD) : 175 { 176 *(.debug_pubnames) 177 } 178 .zdebug_pubnames BLOCK(__section_alignment__) (NOLOAD) : 179 { 180 *(.zdebug_pubnames) 181 } 182 .debug_pubtypes BLOCK(__section_alignment__) (NOLOAD) : 183 { 184 *(.debug_pubtypes) 185 } 186 .zdebug_pubtypes BLOCK(__section_alignment__) (NOLOAD) : 187 { 188 *(.zdebug_pubtypes) 189 } 190 /* DWARF 2. */ 191 .debug_info BLOCK(__section_alignment__) (NOLOAD) : 192 { 193 *(.debug_info .gnu.linkonce.wi.*) 194 } 195 .zdebug_info BLOCK(__section_alignment__) (NOLOAD) : 196 { 197 *(.zdebug_info .zdebug.gnu.linkonce.wi.*) 198 } 199 .debug_abbrev BLOCK(__section_alignment__) (NOLOAD) : 200 { 201 *(.debug_abbrev) 202 } 203 .zdebug_abbrev BLOCK(__section_alignment__) (NOLOAD) : 204 { 205 *(.zdebug_abbrev) 206 } 207 .debug_line BLOCK(__section_alignment__) (NOLOAD) : 208 { 209 *(.debug_line) 210 } 211 .zdebug_line BLOCK(__section_alignment__) (NOLOAD) : 212 { 213 *(.zdebug_line) 214 } 215 .debug_frame BLOCK(__section_alignment__) (NOLOAD) : 216 { 217 *(.debug_frame*) 218 } 219 .zdebug_frame BLOCK(__section_alignment__) (NOLOAD) : 220 { 221 *(.zdebug_frame*) 222 } 223 .debug_str BLOCK(__section_alignment__) (NOLOAD) : 224 { 225 *(.debug_str) 226 } 227 .zdebug_str BLOCK(__section_alignment__) (NOLOAD) : 228 { 229 *(.zdebug_str) 230 } 231 .debug_loc BLOCK(__section_alignment__) (NOLOAD) : 232 { 233 *(.debug_loc) 234 } 235 .zdebug_loc BLOCK(__section_alignment__) (NOLOAD) : 236 { 237 *(.zdebug_loc) 238 } 239 .debug_macinfo BLOCK(__section_alignment__) (NOLOAD) : 240 { 241 *(.debug_macinfo) 242 } 243 .zdebug_macinfo BLOCK(__section_alignment__) (NOLOAD) : 244 { 245 *(.zdebug_macinfo) 246 } 247 /* SGI/MIPS DWARF 2 extensions. */ 248 .debug_weaknames BLOCK(__section_alignment__) (NOLOAD) : 249 { 250 *(.debug_weaknames) 251 } 252 .zdebug_weaknames BLOCK(__section_alignment__) (NOLOAD) : 253 { 254 *(.zdebug_weaknames) 255 } 256 .debug_funcnames BLOCK(__section_alignment__) (NOLOAD) : 257 { 258 *(.debug_funcnames) 259 } 260 .zdebug_funcnames BLOCK(__section_alignment__) (NOLOAD) : 261 { 262 *(.zdebug_funcnames) 263 } 264 .debug_typenames BLOCK(__section_alignment__) (NOLOAD) : 265 { 266 *(.debug_typenames) 267 } 268 .zdebug_typenames BLOCK(__section_alignment__) (NOLOAD) : 269 { 270 *(.zdebug_typenames) 271 } 272 .debug_varnames BLOCK(__section_alignment__) (NOLOAD) : 273 { 274 *(.debug_varnames) 275 } 276 .zdebug_varnames BLOCK(__section_alignment__) (NOLOAD) : 277 { 278 *(.zdebug_varnames) 279 } 280 .debug_macro BLOCK(__section_alignment__) (NOLOAD) : 281 { 282 *(.debug_macro) 283 } 284 .zdebug_macro BLOCK(__section_alignment__) (NOLOAD) : 285 { 286 *(.zdebug_macro) 287 } 288 /* DWARF 3. */ 289 .debug_ranges BLOCK(__section_alignment__) (NOLOAD) : 290 { 291 *(.debug_ranges) 292 } 293 .zdebug_ranges BLOCK(__section_alignment__) (NOLOAD) : 294 { 295 *(.zdebug_ranges) 296 } 297 /* DWARF 4. */ 298 .debug_types BLOCK(__section_alignment__) (NOLOAD) : 299 { 300 *(.debug_types .gnu.linkonce.wt.*) 301 } 302 .zdebug_types BLOCK(__section_alignment__) (NOLOAD) : 303 { 304 *(.zdebug_types .gnu.linkonce.wt.*) 305 } 306 } 307