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