1186690Sobrien# Linker script for PE. 2284778Sdelphij# 3268515Sdelphij# Copyright (C) 2014-2017 Free Software Foundation, Inc. 4234449Sobrien# 5234449Sobrien# Copying and distribution of this file, with or without modification, 6268515Sdelphij# are permitted in any medium without royalty provided the copyright 7234449Sobrien# notice and this notice are preserved. 8186690Sobrien 9186690Sobrienif test -z "${RELOCATEABLE_OUTPUT_FORMAT}"; then 10186690Sobrien RELOCATEABLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} 11186690Sobrienfi 12186690Sobrien 13186690Sobrien# We can't easily and portably get an unquoted $ in a shell 14186690Sobrien# substitution, so we do this instead. 15186690Sobrienif test "${RELOCATING}"; then 16186690Sobrien R_TEXT='*(.text$*)' 17186690Sobrien R_DATA='*(.data$*)' 18186690Sobrien R_RDATA='*(.rdata$*)' 19186690Sobrien R_IDATA=' 20186690Sobrien *(.idata$2) 21186690Sobrien *(.idata$3) 22186690Sobrien /* These zeroes mark the end of the import list. */ 23186690Sobrien LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); 24186690Sobrien *(.idata$4) 25186690Sobrien *(.idata$5) 26186690Sobrien *(.idata$6) 27186690Sobrien *(.idata$7)' 28186690Sobrien R_CRT='*(.CRT$*)' 29186690Sobrien R_RSRC='*(.rsrc$*)' 30186690Sobrien R_EXC='*(.exc$*)' 31186690Sobrienelse 32186690Sobrien R_TEXT= 33186690Sobrien R_DATA= 34186690Sobrien R_RDATA= 35186690Sobrien R_IDATA= 36186690Sobrien R_CRT= 37186690Sobrien R_RSRC= 38186690Sobrien R_EXC= 39186690Sobrienfi 40186690Sobrien 41186690Sobriencat <<EOF 42186690Sobrien/* Copyright (C) 2014-2017 Free Software Foundation, Inc. 43186690Sobrien 44186690Sobrien Copying and distribution of this script, with or without modification, 45186690Sobrien are permitted in any medium without royalty provided the copyright 46186690Sobrien notice and this notice are preserved. */ 47186690Sobrien 48186690Sobrien${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})} 49186690Sobrien${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})} 50186690Sobrien 51186690Sobrien${LIB_SEARCH_DIRS} 52234449Sobrien 53234449Sobrien${RELOCATING+ENTRY (__start)} 54234449Sobrien${RELOCATING+header = .;} 55234449Sobrien${RELOCATING+__fltused = .; /* set up floating pt for MS .obj\'s */} 56234449Sobrien${RELOCATING+__ldused = .;} 57234449SobrienSECTIONS 58234449Sobrien{ 59234449Sobrien .text ${RELOCATING+ __image_base__ + __section_alignment__ } : 60234449Sobrien { 61234449Sobrien ${RELOCATING+ __text_start__ = . ;} 62234449Sobrien ${RELOCATING+ *(.init)} 63234449Sobrien *(.text) 64192350Sdelphij ${R_TEXT} 65186690Sobrien *(.glue_7t) 66186690Sobrien *(.glue_7) 67186690Sobrien ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; 68186690Sobrien LONG (-1); *(.ctors); *(.ctor); LONG (0); } 69186690Sobrien ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; 70186690Sobrien LONG (-1); *(.dtors); *(.dtor); LONG (0); } 71268515Sdelphij ${RELOCATING+ *(.fini)} 72268515Sdelphij /* ??? Why is .gcc_exc here? */ 73186690Sobrien ${RELOCATING+ *(.gcc_exc)} 74268515Sdelphij ${RELOCATING+ etext = .;} 75186690Sobrien ${RELOCATING+ __text_end__ = .;} 76186690Sobrien *(.gcc_except_table) 77268515Sdelphij } 78268515Sdelphij 79186690Sobrien /* The Cygwin32 library uses a section to avoid copying certain data 80186690Sobrien on fork. This used to be named ".data$nocopy". The linker used 81186690Sobrien to include this between __data_start__ and __data_end__, but that 82186690Sobrien breaks building the cygwin32 dll. Instead, we name the section 83186690Sobrien ".data_cygwin_nocopy" and explicitly include it after __data_end__. */ 84268515Sdelphij 85284778Sdelphij .data ${RELOCATING+BLOCK(__section_alignment__)} : 86186690Sobrien { 87186690Sobrien ${RELOCATING+__data_start__ = . ;} 88284778Sdelphij *(.data) 89284778Sdelphij *(.data2) 90284778Sdelphij ${R_DATA} 91284778Sdelphij ${RELOCATING+__data_end__ = . ;} 92186690Sobrien ${RELOCATING+*(.data_cygwin_nocopy)} 93186690Sobrien } 94186690Sobrien 95186690Sobrien .bss ${RELOCATING+BLOCK(__section_alignment__)} : 96186690Sobrien { 97186690Sobrien ${RELOCATING+__bss_start__ = . ;} 98186690Sobrien *(.bss) 99268515Sdelphij *(COMMON) 100268515Sdelphij /* link.exe apparently pulls in .obj's because of UNDEF common 101186690Sobrien symbols, which is not the coff way, but that's MS for you. */ 102186690Sobrien *(.CRT\$XCA) 103186690Sobrien *(.CRT\$XCZ) 104186690Sobrien *(.CRT\$XIA) 105186690Sobrien *(.CRT\$XIZ) 106192350Sdelphij ${RELOCATING+__bss_end__ = . ;} 107268515Sdelphij } 108268515Sdelphij 109268515Sdelphij .rdata ${RELOCATING+BLOCK(__section_alignment__)} : 110268515Sdelphij { 111268515Sdelphij *(.rdata) 112268515Sdelphij ${R_RDATA} 113268515Sdelphij *(.eh_frame) 114268515Sdelphij } 115268515Sdelphij 116268515Sdelphij .edata ${RELOCATING+BLOCK(__section_alignment__)} : 117268515Sdelphij { 118268515Sdelphij *(.edata) 119192350Sdelphij } 120186690Sobrien 121186690Sobrien /DISCARD/ : 122186690Sobrien { 123192350Sdelphij *(.debug\$S) 124186690Sobrien *(.debug\$T) 125186690Sobrien *(.debug\$F) 126186690Sobrien *(.drectve) 127186690Sobrien *(.debug*) 128186690Sobrien } 129186690Sobrien 130186690Sobrien .idata ${RELOCATING+BLOCK(__section_alignment__)} : 131234449Sobrien { 132186690Sobrien /* This cannot currently be handled with grouped sections. 133234449Sobrien See pe.em:sort_sections. */ 134186690Sobrien ${R_IDATA} 135186690Sobrien } 136186690Sobrien .CRT ${RELOCATING+BLOCK(__section_alignment__)} : 137186690Sobrien { 138234449Sobrien ${R_CRT} 139234449Sobrien } 140234449Sobrien 141234449Sobrien .endjunk ${RELOCATING+BLOCK(__section_alignment__)} : 142186690Sobrien { 143186690Sobrien /* end is deprecated, don't use it */ 144186690Sobrien ${RELOCATING+ end = .;} 145276415Sdelphij ${RELOCATING+ _end = .;} 146186690Sobrien ${RELOCATING+ __end__ = .;} 147186690Sobrien } 148284778Sdelphij 149186690Sobrien .reloc ${RELOCATING+BLOCK(__section_alignment__)} : 150186690Sobrien { 151186690Sobrien *(.reloc) 152234449Sobrien } 153234449Sobrien 154234449Sobrien .rsrc ${RELOCATING+BLOCK(__section_alignment__)} : 155186690Sobrien { 156186690Sobrien *(.rsrc) 157186690Sobrien ${R_RSRC} 158186690Sobrien } 159186690Sobrien 160186690Sobrien .exc ${RELOCATING+BLOCK(__section_alignment__)} : 161 { 162 *(.exc) 163 ${R_EXC} 164 } 165 166 .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : 167 { 168 [ .stab ] 169 } 170 171 .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : 172 { 173 [ .stabstr ] 174 } 175EOF 176 177. $srcdir/scripttempl/DWARF.sc 178 179cat <<EOF 180} 181EOF 182