This commit was generated by cvs2svn to track changes on a CVS vendor
[external/binutils.git] / ld / scripttempl / pe.sc
1 # Linker script for PE.
2
3 if test -z "${RELOCATEABLE_OUTPUT_FORMAT}"; then
4   RELOCATEABLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
5 fi
6
7 cat <<EOF
8 ${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})}
9 ${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})}
10
11 ${LIB_SEARCH_DIRS}
12
13 ENTRY(_mainCRTStartup)
14
15 SECTIONS
16 {
17   .text ${RELOCATING+ __image_base__ + __section_alignment__ } : 
18   {
19     ${RELOCATING+ *(.init)}
20     *(.text)
21     ${RELOCATING+*(.text\$*)}
22     ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; 
23                         LONG (-1); *(.ctors); *(.ctor); LONG (0); }
24     ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; 
25                         LONG (-1); *(.dtors); *(.dtor);  LONG (0); }
26     ${RELOCATING+ *(.fini)}
27     /* ??? Why is .gcc_exc here?  */
28     ${RELOCATING+ *(.gcc_exc)}
29     ${RELOCATING+ etext = .;}
30     *(.gcc_except_table)
31   }
32
33   /* The Cygwin32 library uses a section to avoid copying certain data
34      on fork.  This used to be named ".data$nocopy".  The linker used
35      to include this between __data_start__ and __data_end__, but that
36      breaks building the cygwin32 dll.  Instead, we name the section
37      ".data_cygwin_nocopy" and explictly include it after __data_end__. */
38
39   .data ${RELOCATING+BLOCK(__section_alignment__)} : 
40   {
41     ${RELOCATING+__data_start__ = . ;}
42     *(.data)
43     *(.data2)
44     ${RELOCATING+*(.data\$*)}
45     ${RELOCATING+__data_end__ = . ;}
46     ${RELOCATING+*(.data_cygwin_nocopy)}
47   }
48
49   .bss ${RELOCATING+BLOCK(__section_alignment__)} :
50   {
51     ${RELOCATING+__bss_start__ = . ;}
52     *(.bss)
53     *(COMMON)
54     ${RELOCATING+__bss_end__ = . ;}
55   }
56
57   .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
58   {
59     *(.rdata)
60     ${RELOCATING+*(.rdata\$*)}
61     *(.eh_frame)
62   }
63
64   .edata ${RELOCATING+BLOCK(__section_alignment__)} :
65   {
66     *(.edata)
67   }
68
69   /DISCARD/ :
70   {
71     *(.debug\$S)
72     *(.debug\$T)
73     *(.debug\$F)
74     *(.drectve)
75   }
76
77   .idata ${RELOCATING+BLOCK(__section_alignment__)} :
78   {
79     /* This cannot currently be handled with grouped sections.
80         See pe.em:sort_sections.  */
81     ${RELOCATING+*(.idata\$2)}
82     ${RELOCATING+*(.idata\$3)}
83     ${RELOCATING+ /* These zeroes mark the end of the import list.  */}
84     ${RELOCATING+ LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);}
85     ${RELOCATING+*(.idata\$4)}
86     ${RELOCATING+*(.idata\$5)}
87     ${RELOCATING+*(.idata\$6)}
88     ${RELOCATING+*(.idata\$7)}
89   }
90   .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
91   {                                     
92     ${RELOCATING+*(.CRT\$*)}
93   }
94
95   .endjunk ${RELOCATING+BLOCK(__section_alignment__)} :
96   {
97     /* end is deprecated, don't use it */
98     ${RELOCATING+ end = .;}
99     ${RELOCATING+ __end__ = .;}
100   }
101
102   .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
103   {                                     
104     *(.reloc)
105   }
106
107   .rsrc ${RELOCATING+BLOCK(__section_alignment__)} :
108   {                                     
109     *(.rsrc)
110     ${RELOCATING+*(.rsrc\$*)}
111   }
112
113   .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
114   {
115     [ .stab ]
116   }
117
118   .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
119   {
120     [ .stabstr ]
121   }
122
123 }
124 EOF