1*3d8817e4Smiod# Linker script for MCore PE. 2*3d8817e4Smiod 3*3d8817e4Smiodif test -z "${RELOCATEABLE_OUTPUT_FORMAT}"; then 4*3d8817e4Smiod RELOCATEABLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} 5*3d8817e4Smiodfi 6*3d8817e4Smiod 7*3d8817e4Smiod# We can't easily and portably get an unquoted $ in a shell 8*3d8817e4Smiod# substitution, so we do this instead. 9*3d8817e4Smiod# Sorting of the .foo$* sections is required by the definition of 10*3d8817e4Smiod# grouped sections in PE. 11*3d8817e4Smiod# Sorting of the file names in R_IDATA is required by the 12*3d8817e4Smiod# current implementation of dlltool (this could probably be changed to 13*3d8817e4Smiod# use grouped sections instead). 14*3d8817e4Smiodif test "${RELOCATING}"; then 15*3d8817e4Smiod R_TEXT='*(SORT(.text$*))' 16*3d8817e4Smiod R_DATA='*(SORT(.data$*))' 17*3d8817e4Smiod R_RDATA='*(SORT(.rdata$*))' 18*3d8817e4Smiod R_IDATA=' 19*3d8817e4Smiod SORT(*)(.idata$2) 20*3d8817e4Smiod SORT(*)(.idata$3) 21*3d8817e4Smiod /* These zeroes mark the end of the import list. */ 22*3d8817e4Smiod LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); 23*3d8817e4Smiod SORT(*)(.idata$4) 24*3d8817e4Smiod SORT(*)(.idata$5) 25*3d8817e4Smiod SORT(*)(.idata$6) 26*3d8817e4Smiod SORT(*)(.idata$7)' 27*3d8817e4Smiod R_CRT='*(SORT(.CRT$*))' 28*3d8817e4Smiod R_RSRC='*(SORT(.rsrc$*))' 29*3d8817e4Smiodelse 30*3d8817e4Smiod R_TEXT= 31*3d8817e4Smiod R_DATA= 32*3d8817e4Smiod R_RDATA= 33*3d8817e4Smiod R_IDATA= 34*3d8817e4Smiod R_CRT= 35*3d8817e4Smiod R_RSRC= 36*3d8817e4Smiodfi 37*3d8817e4Smiod 38*3d8817e4Smiodif test "$RELOCATING"; then 39*3d8817e4Smiod # Can't use ${RELOCATING+blah "blah" blah} for this, 40*3d8817e4Smiod # because bash 2.x will lose the doublequotes. 41*3d8817e4Smiod cat <<EOF 42*3d8817e4SmiodOUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", 43*3d8817e4Smiod "${LITTLE_OUTPUT_FORMAT}") 44*3d8817e4SmiodEOF 45*3d8817e4Smiodfi 46*3d8817e4Smiod 47*3d8817e4Smiodcat <<EOF 48*3d8817e4Smiod${LIB_SEARCH_DIRS} 49*3d8817e4Smiod 50*3d8817e4SmiodENTRY(_mainCRTStartup) 51*3d8817e4Smiod 52*3d8817e4SmiodSECTIONS 53*3d8817e4Smiod{ 54*3d8817e4Smiod .text ${RELOCATING+ __image_base__ + __section_alignment__ } : 55*3d8817e4Smiod { 56*3d8817e4Smiod ${RELOCATING+ *(.init)} 57*3d8817e4Smiod *(.text) 58*3d8817e4Smiod ${R_TEXT} 59*3d8817e4Smiod *(.glue_7t) 60*3d8817e4Smiod *(.glue_7) 61*3d8817e4Smiod ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; 62*3d8817e4Smiod LONG (-1); *(.ctors); *(.ctor); LONG (0); } 63*3d8817e4Smiod ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; 64*3d8817e4Smiod LONG (-1); *(.dtors); *(.dtor); LONG (0); } 65*3d8817e4Smiod ${RELOCATING+ *(.fini)} 66*3d8817e4Smiod /* ??? Why is .gcc_exc here? */ 67*3d8817e4Smiod ${RELOCATING+ *(.gcc_exc)} 68*3d8817e4Smiod ${RELOCATING+ etext = .;} 69*3d8817e4Smiod *(.gcc_except_table) 70*3d8817e4Smiod } 71*3d8817e4Smiod 72*3d8817e4Smiod /* The Cygwin32 library uses a section to avoid copying certain data 73*3d8817e4Smiod on fork. This used to be named ".data$nocopy". The linker used 74*3d8817e4Smiod to include this between __data_start__ and __data_end__, but that 75*3d8817e4Smiod breaks building the cygwin32 dll. Instead, we name the section 76*3d8817e4Smiod ".data_cygwin_nocopy" and explictly include it after __data_end__. */ 77*3d8817e4Smiod 78*3d8817e4Smiod .data ${RELOCATING+BLOCK(__section_alignment__)} : 79*3d8817e4Smiod { 80*3d8817e4Smiod ${RELOCATING+__data_start__ = . ;} 81*3d8817e4Smiod *(.data) 82*3d8817e4Smiod *(.data2) 83*3d8817e4Smiod ${R_DATA} 84*3d8817e4Smiod ${RELOCATING+__data_end__ = . ;} 85*3d8817e4Smiod ${RELOCATING+*(.data_cygwin_nocopy)} 86*3d8817e4Smiod } 87*3d8817e4Smiod 88*3d8817e4Smiod .bss ${RELOCATING+BLOCK(__section_alignment__)} : 89*3d8817e4Smiod { 90*3d8817e4Smiod ${RELOCATING+__bss_start__ = . ;} 91*3d8817e4Smiod *(.bss) 92*3d8817e4Smiod *(COMMON) 93*3d8817e4Smiod ${RELOCATING+__bss_end__ = . ;} 94*3d8817e4Smiod } 95*3d8817e4Smiod 96*3d8817e4Smiod .rdata ${RELOCATING+BLOCK(__section_alignment__)} : 97*3d8817e4Smiod { 98*3d8817e4Smiod *(.rdata) 99*3d8817e4Smiod ${R_RDATA} 100*3d8817e4Smiod *(.eh_frame) 101*3d8817e4Smiod } 102*3d8817e4Smiod 103*3d8817e4Smiod .edata ${RELOCATING+BLOCK(__section_alignment__)} : 104*3d8817e4Smiod { 105*3d8817e4Smiod *(.edata) 106*3d8817e4Smiod } 107*3d8817e4Smiod 108*3d8817e4Smiod /DISCARD/ : 109*3d8817e4Smiod { 110*3d8817e4Smiod *(.debug\$S) 111*3d8817e4Smiod *(.debug\$T) 112*3d8817e4Smiod *(.debug\$F) 113*3d8817e4Smiod *(.drectve) 114*3d8817e4Smiod } 115*3d8817e4Smiod 116*3d8817e4Smiod .idata ${RELOCATING+BLOCK(__section_alignment__)} : 117*3d8817e4Smiod { 118*3d8817e4Smiod /* This cannot currently be handled with grouped sections. 119*3d8817e4Smiod See pe.em:sort_sections. */ 120*3d8817e4Smiod ${R_IDATA} 121*3d8817e4Smiod } 122*3d8817e4Smiod .CRT ${RELOCATING+BLOCK(__section_alignment__)} : 123*3d8817e4Smiod { 124*3d8817e4Smiod ${R_CRT} 125*3d8817e4Smiod } 126*3d8817e4Smiod 127*3d8817e4Smiod .endjunk ${RELOCATING+BLOCK(__section_alignment__)} : 128*3d8817e4Smiod { 129*3d8817e4Smiod /* end is deprecated, don't use it */ 130*3d8817e4Smiod ${RELOCATING+ end = .;} 131*3d8817e4Smiod ${RELOCATING+ _end = .;} 132*3d8817e4Smiod ${RELOCATING+ __end__ = .;} 133*3d8817e4Smiod } 134*3d8817e4Smiod 135*3d8817e4Smiod .reloc ${RELOCATING+BLOCK(__section_alignment__)} : 136*3d8817e4Smiod { 137*3d8817e4Smiod *(.reloc) 138*3d8817e4Smiod } 139*3d8817e4Smiod 140*3d8817e4Smiod .rsrc ${RELOCATING+BLOCK(__section_alignment__)} : 141*3d8817e4Smiod { 142*3d8817e4Smiod *(.rsrc) 143*3d8817e4Smiod ${R_RSRC} 144*3d8817e4Smiod } 145*3d8817e4Smiod 146*3d8817e4Smiod .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : 147*3d8817e4Smiod { 148*3d8817e4Smiod [ .stab ] 149*3d8817e4Smiod } 150*3d8817e4Smiod 151*3d8817e4Smiod .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : 152*3d8817e4Smiod { 153*3d8817e4Smiod [ .stabstr ] 154*3d8817e4Smiod } 155*3d8817e4Smiod 156*3d8817e4Smiod .stack 0x80000 : 157*3d8817e4Smiod { 158*3d8817e4Smiod _stack = .; 159*3d8817e4Smiod *(.stack) 160*3d8817e4Smiod } 161*3d8817e4Smiod} 162*3d8817e4SmiodEOF 163