fix output format.
[deliverable/binutils-gdb.git] / ld / scripttempl / mcorepe.sc
CommitLineData
bb3596ae 1# Linker script for MCore PE.
252b5132
RH
2
3if test -z "${RELOCATEABLE_OUTPUT_FORMAT}"; then
4 RELOCATEABLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
5fi
6
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).
14if 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$*))'
29else
30 R_TEXT=
31 R_DATA=
32 R_RDATA=
33 R_IDATA=
34 R_CRT=
35 R_RSRC=
36fi
37
38cat <<EOF
bb3596ae
NC
39${RELOCATING+OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
40 "${LITTLE_OUTPUT_FORMAT}")}
252b5132
RH
41${LIB_SEARCH_DIRS}
42
43ENTRY(_mainCRTStartup)
44
45SECTIONS
46{
47 .text ${RELOCATING+ __image_base__ + __section_alignment__ } :
48 {
49 ${RELOCATING+ *(.init)}
50 *(.text)
51 ${R_TEXT}
52 *(.glue_7t)
53 *(.glue_7)
54 ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
55 LONG (-1); *(.ctors); *(.ctor); LONG (0); }
56 ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
57 LONG (-1); *(.dtors); *(.dtor); LONG (0); }
58 ${RELOCATING+ *(.fini)}
59 /* ??? Why is .gcc_exc here? */
60 ${RELOCATING+ *(.gcc_exc)}
61 ${RELOCATING+ etext = .;}
62 *(.gcc_except_table)
63 }
64
65 /* The Cygwin32 library uses a section to avoid copying certain data
66 on fork. This used to be named ".data$nocopy". The linker used
67 to include this between __data_start__ and __data_end__, but that
68 breaks building the cygwin32 dll. Instead, we name the section
69 ".data_cygwin_nocopy" and explictly include it after __data_end__. */
70
71 .data ${RELOCATING+BLOCK(__section_alignment__)} :
72 {
73 ${RELOCATING+__data_start__ = . ;}
74 *(.data)
75 *(.data2)
76 ${R_DATA}
77 ${RELOCATING+__data_end__ = . ;}
78 ${RELOCATING+*(.data_cygwin_nocopy)}
79 }
80
81 .bss ${RELOCATING+BLOCK(__section_alignment__)} :
82 {
83 ${RELOCATING+__bss_start__ = . ;}
84 *(.bss)
85 *(COMMON)
86 ${RELOCATING+__bss_end__ = . ;}
87 }
88
89 .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
90 {
91 *(.rdata)
92 ${R_RDATA}
93 *(.eh_frame)
94 }
95
96 .edata ${RELOCATING+BLOCK(__section_alignment__)} :
97 {
98 *(.edata)
99 }
100
101 /DISCARD/ :
102 {
103 *(.debug\$S)
104 *(.debug\$T)
105 *(.debug\$F)
106 *(.drectve)
107 }
108
109 .idata ${RELOCATING+BLOCK(__section_alignment__)} :
110 {
111 /* This cannot currently be handled with grouped sections.
112 See pe.em:sort_sections. */
113 ${R_IDATA}
114 }
115 .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
116 {
117 ${R_CRT}
118 }
119
120 .endjunk ${RELOCATING+BLOCK(__section_alignment__)} :
121 {
122 /* end is deprecated, don't use it */
123 ${RELOCATING+ end = .;}
124 ${RELOCATING+ _end = .;}
125 ${RELOCATING+ __end__ = .;}
126 }
127
128 .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
129 {
130 *(.reloc)
131 }
132
133 .rsrc ${RELOCATING+BLOCK(__section_alignment__)} :
134 {
135 *(.rsrc)
136 ${R_RSRC}
137 }
138
139 .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
140 {
141 [ .stab ]
142 }
143
144 .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
145 {
146 [ .stabstr ]
147 }
148
149 .stack 0x80000 :
150 {
151 _stack = .;
152 *(.stack)
153 }
154}
155EOF
This page took 0.029372 seconds and 4 git commands to generate.