* mmap support for common simulators
[binutils-gdb.git] / ld / mpw-esh.c
blob2a0302c530a35f92be7441d1b80b5abc455c8722
1 /* This file is is generated by a shell script. DO NOT EDIT! */
3 /* emulate the original gld for the given sh
4 Copyright 1991, 1993, 1995, 2000 Free Software Foundation, Inc.
5 Written by Steve Chamberlain steve@cygnus.com
7 This file is part of GLD, the Gnu Linker.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
23 #define TARGET_IS_sh
25 #include "libiberty.h"
26 #include "bfd.h"
27 #include "sysdep.h"
28 #include "bfdlink.h"
30 #include "ld.h"
31 #include "ldmain.h"
32 #include "ldmisc.h"
34 #include "ldexp.h"
35 #include "ldlang.h"
36 #include "ldfile.h"
37 #include "ldemul.h"
39 static void gldsh_before_parse PARAMS ((void));
40 static char *gldsh_get_script PARAMS ((int *isfile));
42 static void
43 gldsh_before_parse()
45 #ifndef TARGET_ /* I.e., if not generic. */
46 ldfile_output_architecture = bfd_arch_sh;
47 #endif /* not TARGET_ */
50 static char *
51 gldsh_get_script(isfile)
52 int *isfile;
54 *isfile = 0;
56 if (link_info.relocateable == true && config.build_constructors == true)
57 return
58 concat(
59 "OUTPUT_FORMAT(\"coff-sh\")\n\
60 OUTPUT_ARCH(sh)\n\
61 MEMORY\n\
62 {\n\
63 ram : o = 0x1000, l = 512k\n\
64 }\n\
65 "," SECTIONS\n\
66 {\n\
67 "," .text :\n\
68 {\n\
69 *(.text)\n\
70 *(.strings)\n\
71 } \n\
72 .tors :\n\
73 {\n\
74 ___ctors = . ;\n\
75 *(.ctors)\n\
76 ___ctors_end = . ;\n\
77 ___dtors = . ;\n\
78 *(.dtors)\n\
79 ___dtors_end = . ;\n\
80 } \n\
81 "," .data :\n\
82 {\n\
83 *(.data)\n\
84 } \n\
85 "," .bss :\n\
86 {\n\
87 *(.bss)\n\
88 *(COMMON)\n\
89 } \n\
90 "," .stack :\n\
91 {\n\
92 *(.stack)\n\
93 } \n\
94 "," .stab 0 :\n\
95 {\n\
96 *(.stab)\n\
97 }\n\
98 "," .stabstr 0 :\n\
99 {\n\
100 *(.stabstr)\n\
101 }\n\
102 }\n\n", NULL)
103 ; else if (link_info.relocateable == true) return
104 concat (
105 "OUTPUT_FORMAT(\"coff-sh\")\n\
106 OUTPUT_ARCH(sh)\n\
107 "," MEMORY\n\
108 {\n\
109 ram : o = 0x1000, l = 512k\n\
110 }\n\
111 "," SECTIONS\n\
112 {\n\
113 "," .text :\n\
114 {\n\
115 *(.text)\n\
116 *(.strings)\n\
117 } \n\
118 "," .tors :\n\
119 {\n\
120 ___ctors = . ;\n\
121 *(.ctors)\n\
122 ___ctors_end = . ;\n\
123 ___dtors = . ;\n\
124 *(.dtors)\n\
125 ___dtors_end = . ;\n\
126 } \n\
127 "," .data :\n\
128 {\n\
129 *(.data)\n\
130 } \n\
131 "," .bss :\n\
132 {\n\
133 *(.bss)\n\
134 *(COMMON)\n\
135 } \n\
136 "," .stack :\n\
137 {\n\
138 *(.stack)\n\
139 } \n\
140 "," .stab 0 :\n\
141 {\n\
142 *(.stab)\n\
143 }\n\
144 "," .stabstr 0 :\n\
145 {\n\
146 *(.stabstr)\n\
147 }\n\
148 }\n\n", NULL)
149 ; else if (!config.text_read_only) return
150 concat (
151 "OUTPUT_FORMAT(\"coff-sh\")\n\
152 OUTPUT_ARCH(sh)\n\
153 MEMORY\n\
154 {\n\
155 ram : o = 0x1000, l = 512k\n\
156 }\n\
157 SECTIONS\n\
158 {\n\
159 "," .text :\n\
160 {\n\
161 *(.text)\n\
162 *(.strings)\n\
163 _etext = . ; \n\
164 } > ram\n\
165 "," .tors :\n\
166 {\n\
167 ___ctors = . ;\n\
168 *(.ctors)\n\
169 ___ctors_end = . ;\n\
170 ___dtors = . ;\n\
171 *(.dtors)\n\
172 ___dtors_end = . ;\n\
173 } > ram\n\
174 "," .data :\n\
175 {\n\
176 *(.data)\n\
177 _edata = . ; \n\
178 } > ram\n\
179 "," .bss :\n\
180 {\n\
181 _bss_start = . ; \n\
182 *(.bss)\n\
183 *(COMMON)\n\
184 _end = . ; \n\
185 } > ram\n\
186 "," .stack 0x30000 :\n\
187 {\n\
188 _stack = . ; \n\
189 *(.stack)\n\
190 } > ram\n\
191 "," .stab 0 (NOLOAD) :\n\
192 {\n\
193 *(.stab)\n\
194 }\n\
195 "," .stabstr 0 (NOLOAD) :\n\
196 {\n\
197 *(.stabstr)\n\
198 }\n\
199 }\n\n", NULL)
200 ; else if (!config.magic_demand_paged) return
201 concat (
202 "OUTPUT_FORMAT(\"coff-sh\")\n\
203 OUTPUT_ARCH(sh)\n\
204 MEMORY\n\
205 {\n\
206 ram : o = 0x1000, l = 512k\n\
207 }\n\
208 SECTIONS\n\
209 {\n\
210 "," .text :\n\
211 {\n\
212 *(.text)\n\
213 *(.strings)\n\
214 _etext = . ; \n\
215 } > ram\n\
216 "," .tors :\n\
217 {\n\
218 ___ctors = . ;\n\
219 *(.ctors)\n\
220 ___ctors_end = . ;\n\
221 ___dtors = . ;\n\
222 *(.dtors)\n\
223 ___dtors_end = . ;\n\
224 } > ram\n\
225 "," .data :\n\
226 {\n\
227 *(.data)\n\
228 _edata = . ; \n\
229 } > ram\n\
230 "," .bss :\n\
231 {\n\
232 _bss_start = . ; \n\
233 *(.bss)\n\
234 *(COMMON)\n\
235 _end = . ; \n\
236 } > ram\n\
237 "," .stack 0x30000 :\n\
238 {\n\
239 _stack = . ; \n\
240 *(.stack)\n\
241 } > ram\n\
242 "," .stab 0 (NOLOAD) :\n\
243 {\n\
244 *(.stab)\n\
245 }\n\
246 "," .stabstr 0 (NOLOAD) :\n\
247 {\n\
248 *(.stabstr)\n\
249 }\n\
250 }\n\n", NULL)
251 ; else return
252 concat (
253 "OUTPUT_FORMAT(\"coff-sh\")\n\
254 OUTPUT_ARCH(sh)\n\
255 MEMORY\n\
256 {\n\
257 ram : o = 0x1000, l = 512k\n\
258 }\n\
259 SECTIONS\n\
260 {\n\
261 "," .text :\n\
262 {\n\
263 *(.text)\n\
264 *(.strings)\n\
265 _etext = . ; \n\
266 } > ram\n\
267 "," .tors :\n\
268 {\n\
269 ___ctors = . ;\n\
270 *(.ctors)\n\
271 ___ctors_end = . ;\n\
272 ___dtors = . ;\n\
273 *(.dtors)\n\
274 ___dtors_end = . ;\n\
275 } > ram\n\
276 "," .data :\n\
277 {\n\
278 *(.data)\n\
279 _edata = . ; \n\
280 } > ram\n\
281 "," .bss :\n\
282 {\n\
283 _bss_start = . ; \n\
284 *(.bss)\n\
285 *(COMMON)\n\
286 _end = . ; \n\
287 } > ram\n\
288 "," .stack 0x30000 :\n\
289 {\n\
290 _stack = . ; \n\
291 *(.stack)\n\
292 } > ram\n\
293 "," .stab 0 (NOLOAD) :\n\
294 {\n\
295 *(.stab)\n\
296 }\n\
297 "," .stabstr 0 (NOLOAD) :\n\
298 {\n\
299 *(.stabstr)\n\
300 }\n\
301 }\n\n", NULL)
304 struct ld_emulation_xfer_struct ld_sh_emulation =
306 gldsh_before_parse,
307 syslib_default,
308 hll_default,
309 after_parse_default,
310 after_open_default,
311 after_allocation_default,
312 set_output_arch_default,
313 ldemul_default_target,
314 before_allocation_default,
315 gldsh_get_script,
316 "sh",
317 "coff-sh"