1f7cc78ecSespie# Linker script for PE. 2f7cc78ecSespie 3f7cc78ecSespieif test -z "${RELOCATEABLE_OUTPUT_FORMAT}"; then 4f7cc78ecSespie RELOCATEABLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} 5f7cc78ecSespiefi 6f7cc78ecSespie 7f7cc78ecSespie# We can't easily and portably get an unquoted $ in a shell 8f7cc78ecSespie# substitution, so we do this instead. 9f7cc78ecSespieif test "${RELOCATING}"; then 10f7cc78ecSespie R_TEXT='*(.text$*)' 11f7cc78ecSespie R_DATA='*(.data$*)' 12f7cc78ecSespie R_RDATA='*(.rdata$*)' 13f7cc78ecSespie R_IDATA=' 14f7cc78ecSespie *(.idata$2) 15f7cc78ecSespie *(.idata$3) 16f7cc78ecSespie /* These zeroes mark the end of the import list. */ 17f7cc78ecSespie LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); 18f7cc78ecSespie *(.idata$4) 19f7cc78ecSespie *(.idata$5) 20f7cc78ecSespie *(.idata$6) 21f7cc78ecSespie *(.idata$7)' 22f7cc78ecSespie R_CRT='*(.CRT$*)' 23f7cc78ecSespie R_RSRC='*(.rsrc$*)' 24f7cc78ecSespie R_EXC='*(.exc$*)' 25f7cc78ecSespieelse 26f7cc78ecSespie R_TEXT= 27f7cc78ecSespie R_DATA= 28f7cc78ecSespie R_RDATA= 29f7cc78ecSespie R_IDATA= 30f7cc78ecSespie R_CRT= 31f7cc78ecSespie R_RSRC= 32f7cc78ecSespie R_EXC= 33f7cc78ecSespiefi 34f7cc78ecSespie 35f7cc78ecSespiecat <<EOF 36f7cc78ecSespie${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})} 37f7cc78ecSespie${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})} 38f7cc78ecSespie 39f7cc78ecSespie${LIB_SEARCH_DIRS} 40f7cc78ecSespie 41f7cc78ecSespieENTRY(__start) 42f7cc78ecSespie${RELOCATING+header = .;} 43f7cc78ecSespie${RELOCATING+__fltused = .; /* set up floating pt for MS .obj\'s */} 44f7cc78ecSespie${RELOCATING+__ldused = .;} 45f7cc78ecSespieSECTIONS 46f7cc78ecSespie{ 47f7cc78ecSespie .text ${RELOCATING+ __image_base__ + __section_alignment__ } : 48f7cc78ecSespie { 49f7cc78ecSespie ${RELOCATING+ __text_start__ = . ;} 50f7cc78ecSespie ${RELOCATING+ *(.init)} 51f7cc78ecSespie *(.text) 52f7cc78ecSespie ${R_TEXT} 53f7cc78ecSespie *(.glue_7t) 54f7cc78ecSespie *(.glue_7) 55f7cc78ecSespie ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; 56f7cc78ecSespie LONG (-1); *(.ctors); *(.ctor); LONG (0); } 57f7cc78ecSespie ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; 58f7cc78ecSespie LONG (-1); *(.dtors); *(.dtor); LONG (0); } 59f7cc78ecSespie ${RELOCATING+ *(.fini)} 60f7cc78ecSespie /* ??? Why is .gcc_exc here? */ 61f7cc78ecSespie ${RELOCATING+ *(.gcc_exc)} 62f7cc78ecSespie ${RELOCATING+ etext = .;} 63f7cc78ecSespie ${RELOCATING+ __text_end__ = .;} 64f7cc78ecSespie *(.gcc_except_table) 65f7cc78ecSespie } 66f7cc78ecSespie 67f7cc78ecSespie /* The Cygwin32 library uses a section to avoid copying certain data 68f7cc78ecSespie on fork. This used to be named ".data$nocopy". The linker used 69f7cc78ecSespie to include this between __data_start__ and __data_end__, but that 70f7cc78ecSespie breaks building the cygwin32 dll. Instead, we name the section 71f7cc78ecSespie ".data_cygwin_nocopy" and explictly include it after __data_end__. */ 72f7cc78ecSespie 73f7cc78ecSespie .data ${RELOCATING+BLOCK(__section_alignment__)} : 74f7cc78ecSespie { 75f7cc78ecSespie ${RELOCATING+__data_start__ = . ;} 76f7cc78ecSespie *(.data) 77f7cc78ecSespie *(.data2) 78f7cc78ecSespie ${R_DATA} 79f7cc78ecSespie ${RELOCATING+__data_end__ = . ;} 80f7cc78ecSespie ${RELOCATING+*(.data_cygwin_nocopy)} 81f7cc78ecSespie } 82f7cc78ecSespie 83f7cc78ecSespie .bss ${RELOCATING+BLOCK(__section_alignment__)} : 84f7cc78ecSespie { 85f7cc78ecSespie ${RELOCATING+__bss_start__ = . ;} 86f7cc78ecSespie *(.bss) 87f7cc78ecSespie *(COMMON) 88f7cc78ecSespie /* link.exe apparently pulls in .obj's because of UNDEF common 89f7cc78ecSespie symbols, which is not the coff way, but that's MS for you. */ 90f7cc78ecSespie *(.CRT\$XCA) 91f7cc78ecSespie *(.CRT\$XCZ) 92f7cc78ecSespie *(.CRT\$XIA) 93f7cc78ecSespie *(.CRT\$XIZ) 94f7cc78ecSespie ${RELOCATING+__bss_end__ = . ;} 95f7cc78ecSespie } 96f7cc78ecSespie 97f7cc78ecSespie .rdata ${RELOCATING+BLOCK(__section_alignment__)} : 98f7cc78ecSespie { 99f7cc78ecSespie *(.rdata) 100f7cc78ecSespie ${R_RDATA} 101f7cc78ecSespie *(.eh_frame) 102f7cc78ecSespie } 103f7cc78ecSespie 104f7cc78ecSespie .edata ${RELOCATING+BLOCK(__section_alignment__)} : 105f7cc78ecSespie { 106f7cc78ecSespie *(.edata) 107f7cc78ecSespie } 108f7cc78ecSespie 109f7cc78ecSespie /DISCARD/ : 110f7cc78ecSespie { 111f7cc78ecSespie *(.debug\$S) 112f7cc78ecSespie *(.debug\$T) 113f7cc78ecSespie *(.debug\$F) 114f7cc78ecSespie *(.drectve) 115f7cc78ecSespie *(.debug*) 116f7cc78ecSespie } 117f7cc78ecSespie 118f7cc78ecSespie .idata ${RELOCATING+BLOCK(__section_alignment__)} : 119f7cc78ecSespie { 120f7cc78ecSespie /* This cannot currently be handled with grouped sections. 121f7cc78ecSespie See pe.em:sort_sections. */ 122f7cc78ecSespie ${R_IDATA} 123f7cc78ecSespie } 124f7cc78ecSespie .CRT ${RELOCATING+BLOCK(__section_alignment__)} : 125f7cc78ecSespie { 126f7cc78ecSespie ${R_CRT} 127f7cc78ecSespie } 128f7cc78ecSespie 129f7cc78ecSespie .endjunk ${RELOCATING+BLOCK(__section_alignment__)} : 130f7cc78ecSespie { 131f7cc78ecSespie /* end is deprecated, don't use it */ 132f7cc78ecSespie ${RELOCATING+ end = .;} 133f7cc78ecSespie ${RELOCATING+ _end = .;} 134f7cc78ecSespie ${RELOCATING+ __end__ = .;} 135f7cc78ecSespie } 136f7cc78ecSespie 137f7cc78ecSespie .reloc ${RELOCATING+BLOCK(__section_alignment__)} : 138f7cc78ecSespie { 139f7cc78ecSespie *(.reloc) 140f7cc78ecSespie } 141f7cc78ecSespie 142f7cc78ecSespie .rsrc ${RELOCATING+BLOCK(__section_alignment__)} : 143f7cc78ecSespie { 144f7cc78ecSespie *(.rsrc) 145f7cc78ecSespie ${R_RSRC} 146f7cc78ecSespie } 147f7cc78ecSespie 148f7cc78ecSespie .exc ${RELOCATING+BLOCK(__section_alignment__)} : 149f7cc78ecSespie { 150f7cc78ecSespie *(.exc) 151f7cc78ecSespie ${R_EXC} 152f7cc78ecSespie } 153f7cc78ecSespie 154f7cc78ecSespie .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : 155f7cc78ecSespie { 156f7cc78ecSespie [ .stab ] 157f7cc78ecSespie } 158f7cc78ecSespie 159f7cc78ecSespie .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : 160f7cc78ecSespie { 161f7cc78ecSespie [ .stabstr ] 162f7cc78ecSespie } 163f7cc78ecSespie /* DWARF debug sections. 164f7cc78ecSespie Symbols in the DWARF debugging sections are relative to the beginning 165f7cc78ecSespie of the section so we begin them at 0. */ 166f7cc78ecSespie 167f7cc78ecSespie /* DWARF 1 */ 168f7cc78ecSespie .debug 0 ${RELOCATING+(NOLOAD)} : { *(.debug) } 169f7cc78ecSespie .line 0 ${RELOCATING+(NOLOAD)} : { *(.line) } 170f7cc78ecSespie 171f7cc78ecSespie /* GNU DWARF 1 extensions */ 172f7cc78ecSespie .debug_srcinfo 0 ${RELOCATING+(NOLOAD)} : { *(.debug_srcinfo) } 173f7cc78ecSespie .debug_sfnames 0 ${RELOCATING+(NOLOAD)} : { *(.debug_sfnames) } 174f7cc78ecSespie 175f7cc78ecSespie /* DWARF 1.1 and DWARF 2 */ 176f7cc78ecSespie .debug_aranges 0 ${RELOCATING+(NOLOAD)} : { *(.debug_aranges) } 177f7cc78ecSespie .debug_pubnames 0 ${RELOCATING+(NOLOAD)} : { *(.debug_pubnames) } 178f7cc78ecSespie 179f7cc78ecSespie /* DWARF 2 */ 180*5f210c2aSfgsch .debug_info 0 ${RELOCATING+(NOLOAD)} : { *(.debug_info) *(.gnu.linkonce.wi.*) } 181f7cc78ecSespie .debug_abbrev 0 ${RELOCATING+(NOLOAD)} : { *(.debug_abbrev) } 182f7cc78ecSespie .debug_line 0 ${RELOCATING+(NOLOAD)} : { *(.debug_line) } 183f7cc78ecSespie .debug_frame 0 ${RELOCATING+(NOLOAD)} : { *(.debug_frame) } 184f7cc78ecSespie .debug_str 0 ${RELOCATING+(NOLOAD)} : { *(.debug_str) } 185f7cc78ecSespie .debug_loc 0 ${RELOCATING+(NOLOAD)} : { *(.debug_loc) } 186f7cc78ecSespie .debug_macinfo 0 ${RELOCATING+(NOLOAD)} : { *(.debug_macinfo) } 187f7cc78ecSespie 188f7cc78ecSespie /* SGI/MIPS DWARF 2 extensions */ 189f7cc78ecSespie .debug_weaknames 0 ${RELOCATING+(NOLOAD)} : { *(.debug_weaknames) } 190f7cc78ecSespie .debug_funcnames 0 ${RELOCATING+(NOLOAD)} : { *(.debug_funcnames) } 191f7cc78ecSespie .debug_typenames 0 ${RELOCATING+(NOLOAD)} : { *(.debug_typenames) } 192f7cc78ecSespie .debug_varnames 0 ${RELOCATING+(NOLOAD)} : { *(.debug_varnames) } 193f7cc78ecSespie} 194f7cc78ecSespieEOF 195