* scripttempl/h8500s.sc (.rdata): All data must go in data segment.
[deliverable/binutils-gdb.git] / ld / emultempl / armpe.em
1 # This shell script emits a C file. -*- C -*-
2 # It does some substitutions.
3 cat >e${EMULATION_NAME}.c <<EOF
4 /* For WINDOWS_NT */
5 /* This file is a copy of ei385coff which was originally generated on a Linux
6 system. It has been modified to provide a decent default script file
7 for the NT PE format. */
8
9 /* The original file generated returned different default scripts depending
10 on whether certain switches were set, but these switches pertain to the
11 Linux system and that particular version of coff. In the NT case, we
12 only determine if the subsystem is console or windows in order to select
13 the correct entry point by default. */
14
15
16 /* emulate the original gld for the given armpe
17 Copyright (C) 1991, 1993 Free Software Foundation, Inc.
18 Written by Steve Chamberlain steve@cygnus.com
19
20 This file is part of GLD, the Gnu Linker.
21
22 This program is free software; you can redistribute it and/or modify
23 it under the terms of the GNU General Public License as published by
24 the Free Software Foundation; either version 2 of the License, or
25 (at your option) any later version.
26
27 This program is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 GNU General Public License for more details.
31
32 You should have received a copy of the GNU General Public License
33 along with this program; if not, write to the Free Software
34 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
35
36 #define TARGET_IS_armpe
37
38 #include "bfd.h"
39 #include "sysdep.h"
40 #include "bfdlink.h"
41
42 #include "ld.h"
43 #include "config.h"
44 #include "ldmain.h"
45 #include "ldemul.h"
46 #include "ldfile.h"
47 #include "ldmisc.h"
48
49 static void gldarmpe_before_parse PARAMS ((void));
50 static char *gldarmpe_get_script PARAMS ((int *isfile));
51
52 static void
53 gldarmpe_before_parse()
54 {
55 #ifndef TARGET_ /* I.e., if not generic. */
56 ldfile_output_architecture = bfd_arch_arm;
57 #endif /* not TARGET_ */
58 }
59
60 static char *
61 gldarmpe_get_script(isfile)
62 int *isfile;
63 {
64 *isfile = 0;
65
66 if (link_info.subsystem == windows)
67 return
68 "OUTPUT_FORMAT(\"coff-arm\")\n\
69 SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/arm-coff/lib);\n\
70 ENTRY(_WinMainCRTStartup)\n\
71 SECTIONS\n\
72 {\n\
73 .text 0x401000 : {\n\
74 *(.text)\n\
75 ;\n\
76 }\n\
77 .bss BLOCK(0x1000) :\n\
78 { \n\
79 *(.bss)\n\
80 *(COMMON)\n\
81 ;\n\
82 }\n\
83 .rdata BLOCK(0x1000) :\n\
84 { \n\
85 *(.rdata)\n\
86 ;\n\
87 }\n\
88 .data BLOCK(0x1000) : {\n\
89 *(.data)\n\
90 *(.data2)\n\
91 ;\n\
92 }\n\
93 .idata BLOCK(0x1000) :\n\
94 { \n\
95 *(.idata\$\2)\n\
96 *(.idata\$\3)\n\
97 *(.idata\$\4)\n\
98 *(.idata\$\5)\n\
99 *(.idata\$\6)\n\
100 *(.idata\$\7)\n\
101 ;\n\
102 }\n\
103 .CRT BLOCK(0x1000) :\n\
104 { \n\
105 *(".CRT\$XCA")\n\
106 *(fucl .CRT\$XCC)\n\
107 *(.CRT\$XCZ)\n\
108 *(.CRT\$XIA)\n\
109 *(.CRT\$XIC)\n\
110 *(.CRT\$XIZ)\n\
111 *(.CRT\$XLA)\n\
112 *(.CRT\$XLZ)\n\
113 *(.CRT\$XPA)\n\
114 *(.CRT\$XPX)\n\
115 *(.CRT\$XPZ)\n\
116 *(.CRT\$XTA)\n\
117 *(.CRT\$XTZ)\n\
118 ;\n\
119 }\n\
120 .rsrc BLOCK(0x1000) :\n\
121 { \n\
122 *(.rsrc\$01)\n\
123 *(.rsrc\$02)\n\
124 ;\n\
125 }\n\
126 .reloc BLOCK(0x1000) :\n\
127 { \n\
128 *(.reloc)\n\
129 ;\n\
130 }\n\
131 .junk BLOCK(0x1000) :\n\
132 { \n\
133 *(.debug\$S)\n\
134 *(.debug\$T)\n\
135 *(.debug\$F)\n\
136 *(.drectve)\n\
137 ;\n\
138 }\n\
139 }\n\n"
140 ; else return
141 "OUTPUT_FORMAT(\"coff-arm\")\n\
142 SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/arm-coff/lib);\n\
143 ENTRY(_mainCRTStartup)\n\
144 SECTIONS\n\
145 {\n\
146 .text 0x401000 : {\n\
147 *(.text)\n\
148 ;\n\
149 }\n\
150 .bss BLOCK(0x1000) :\n\
151 { \n\
152 *(.bss)\n\
153 *(COMMON)\n\
154 ;\n\
155 }\n\
156 .rdata BLOCK(0x1000) :\n\
157 { \n\
158 *(.rdata)\n\
159 ;\n\
160 }\n\
161 .data BLOCK(0x1000) : {\n\
162 *(.data)\n\
163 *(.data2)\n\
164 ;\n\
165 }\n\
166 .idata BLOCK(0x1000) :\n\
167 { \n\
168 *(.idata\$\2)\n\
169 *(.idata\$\3)\n\
170 *(.idata\$\4)\n\
171 *(.idata\$\5)\n\
172 *(.idata\$\6)\n\
173 *(.idata\$\7)\n\
174 ;\n\
175 }\n\
176 .CRT BLOCK(0x1000) :\n\
177 { \n\
178 *(.CRT\$XCA)\n\
179 *(.CRT\$XCC)\n\
180 *(.CRT\$XCZ)\n\
181 *(.CRT\$XIA)\n\
182 *(.CRT\$XIC)\n\
183 *(.CRT\$XIZ)\n\
184 *(.CRT\$XLA)\n\
185 *(.CRT\$XLZ)\n\
186 *(.CRT\$XPA)\n\
187 *(.CRT\$XPX)\n\
188 *(.CRT\$XPZ)\n\
189 *(.CRT\$XTA)\n\
190 *(.CRT\$XTZ)\n\
191 ;\n\
192 }\n\
193 .rsrc BLOCK(0x1000) :\n\
194 { \n\
195 *(.rsrc\$01)\n\
196 *(.rsrc\$02)\n\
197 ;\n\
198 }\n\
199 .reloc BLOCK(0x1000) :\n\
200 { \n\
201 *(.reloc)\n\
202 ;\n\
203 }\n\
204 .junk BLOCK(0x1000) :\n\
205 { \n\
206 *(.debug\$S)\n\
207 *(.debug\$T)\n\
208 *(.debug\$F)\n\
209 *(.drectve)\n\
210 ;\n\
211 }\n\
212 }\n\n"
213 ;
214 }
215
216 struct ld_emulation_xfer_struct ld_armpe_emulation =
217 {
218 gldarmpe_before_parse,
219 syslib_default,
220 hll_default,
221 after_parse_default,
222 after_allocation_default,
223 set_output_arch_default,
224 ldemul_default_target,
225 before_allocation_default,
226 gldarmpe_get_script,
227 "armpe",
228 "pei-arm"
229 };
230 EOF
This page took 0.03411 seconds and 4 git commands to generate.