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