x
[external/binutils.git] / ld / mpw-esh.c
1 /* This file is is generated by a shell script.  DO NOT EDIT! */
2
3 /* emulate the original gld for the given sh
4    Copyright (C) 1991, 1993 Free Software Foundation, Inc.
5    Written by Steve Chamberlain steve@cygnus.com
6
7 This file is part of GLD, the Gnu Linker.
8
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.
13
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.
18
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.  */
22
23 #define TARGET_IS_sh
24
25 #include "libiberty.h"
26 #include "bfd.h"
27 #include "sysdep.h"
28 #include "bfdlink.h"
29
30 #include "ld.h"
31 #include "ldmain.h"
32 #include "ldemul.h"
33 #include "ldfile.h"
34 #include "ldmisc.h"
35
36 static void gldsh_before_parse PARAMS ((void));
37 static char *gldsh_get_script PARAMS ((int *isfile));
38
39 static void
40 gldsh_before_parse()
41 {
42 #ifndef TARGET_                 /* I.e., if not generic.  */
43   ldfile_output_architecture = bfd_arch_sh;
44 #endif /* not TARGET_ */
45 }
46
47 static char *
48 gldsh_get_script(isfile)
49      int *isfile;
50 {                            
51   *isfile = 0;
52
53   if (link_info.relocateable == true && config.build_constructors == true)
54     return
55 concat(
56 "OUTPUT_FORMAT(\"coff-sh\")\n\
57 OUTPUT_ARCH(sh)\n\
58 MEMORY\n\
59 {\n\
60   ram : o = 0x1000, l = 512k\n\
61 }\n\
62  "," SECTIONS\n\
63 {\n\
64  ","  .text :\n\
65   {\n\
66     *(.text)\n\
67     *(.strings)\n\
68   } \n\
69   .tors :\n\
70   {\n\
71     ___ctors = . ;\n\
72     *(.ctors)\n\
73     ___ctors_end = . ;\n\
74     ___dtors = . ;\n\
75     *(.dtors)\n\
76     ___dtors_end = . ;\n\
77   } \n\
78  ","  .data :\n\
79   {\n\
80     *(.data)\n\
81   } \n\
82  "," .bss :\n\
83   {\n\
84     *(.bss)\n\
85     *(COMMON)\n\
86   } \n\
87  "," .stack   :\n\
88   {\n\
89     *(.stack)\n\
90   } \n\
91  "," .stab 0  :\n\
92   {\n\
93     *(.stab)\n\
94   }\n\
95  "," .stabstr 0  :\n\
96   {\n\
97     *(.stabstr)\n\
98   }\n\
99 }\n\n", NULL)
100   ; else if (link_info.relocateable == true) return
101 concat (
102 "OUTPUT_FORMAT(\"coff-sh\")\n\
103 OUTPUT_ARCH(sh)\n\
104  "," MEMORY\n\
105 {\n\
106   ram : o = 0x1000, l = 512k\n\
107 }\n\
108  "," SECTIONS\n\
109 {\n\
110  ","  .text :\n\
111   {\n\
112     *(.text)\n\
113     *(.strings)\n\
114   } \n\
115  ","   .tors :\n\
116   {\n\
117     ___ctors = . ;\n\
118     *(.ctors)\n\
119     ___ctors_end = . ;\n\
120     ___dtors = . ;\n\
121     *(.dtors)\n\
122     ___dtors_end = . ;\n\
123   } \n\
124  ","   .data :\n\
125   {\n\
126     *(.data)\n\
127   } \n\
128  ","   .bss :\n\
129   {\n\
130     *(.bss)\n\
131     *(COMMON)\n\
132   } \n\
133  ","   .stack   :\n\
134   {\n\
135     *(.stack)\n\
136   } \n\
137  ","   .stab 0  :\n\
138   {\n\
139     *(.stab)\n\
140   }\n\
141  ","   .stabstr 0  :\n\
142   {\n\
143     *(.stabstr)\n\
144   }\n\
145 }\n\n", NULL)
146   ; else if (!config.text_read_only) return
147 concat (
148 "OUTPUT_FORMAT(\"coff-sh\")\n\
149 OUTPUT_ARCH(sh)\n\
150 MEMORY\n\
151 {\n\
152   ram : o = 0x1000, l = 512k\n\
153 }\n\
154 SECTIONS\n\
155 {\n\
156  ","   .text :\n\
157   {\n\
158     *(.text)\n\
159     *(.strings)\n\
160      _etext = . ; \n\
161   }  > ram\n\
162  ","   .tors :\n\
163   {\n\
164     ___ctors = . ;\n\
165     *(.ctors)\n\
166     ___ctors_end = . ;\n\
167     ___dtors = . ;\n\
168     *(.dtors)\n\
169     ___dtors_end = . ;\n\
170   }  > ram\n\
171  ","   .data :\n\
172   {\n\
173     *(.data)\n\
174      _edata = . ; \n\
175   }  > ram\n\
176  ","   .bss :\n\
177   {\n\
178      _bss_start = . ; \n\
179     *(.bss)\n\
180     *(COMMON)\n\
181      _end = . ;  \n\
182   }  > ram\n\
183  ","   .stack  0x30000   :\n\
184   {\n\
185      _stack = . ; \n\
186     *(.stack)\n\
187   }  > ram\n\
188  ","   .stab 0 (NOLOAD) :\n\
189   {\n\
190     *(.stab)\n\
191   }\n\
192  ","   .stabstr 0 (NOLOAD) :\n\
193   {\n\
194     *(.stabstr)\n\
195   }\n\
196 }\n\n", NULL)
197   ; else if (!config.magic_demand_paged) return
198 concat (
199 "OUTPUT_FORMAT(\"coff-sh\")\n\
200 OUTPUT_ARCH(sh)\n\
201 MEMORY\n\
202 {\n\
203   ram : o = 0x1000, l = 512k\n\
204 }\n\
205 SECTIONS\n\
206 {\n\
207  ","   .text :\n\
208   {\n\
209     *(.text)\n\
210     *(.strings)\n\
211      _etext = . ; \n\
212   }  > ram\n\
213  ","   .tors :\n\
214   {\n\
215     ___ctors = . ;\n\
216     *(.ctors)\n\
217     ___ctors_end = . ;\n\
218     ___dtors = . ;\n\
219     *(.dtors)\n\
220     ___dtors_end = . ;\n\
221   }  > ram\n\
222  ","   .data :\n\
223   {\n\
224     *(.data)\n\
225      _edata = . ; \n\
226   }  > ram\n\
227  ","   .bss :\n\
228   {\n\
229      _bss_start = . ; \n\
230     *(.bss)\n\
231     *(COMMON)\n\
232      _end = . ;  \n\
233   }  > ram\n\
234  ","   .stack  0x30000   :\n\
235   {\n\
236      _stack = . ; \n\
237     *(.stack)\n\
238   }  > ram\n\
239  ","   .stab 0 (NOLOAD) :\n\
240   {\n\
241     *(.stab)\n\
242   }\n\
243  ","   .stabstr 0 (NOLOAD) :\n\
244   {\n\
245     *(.stabstr)\n\
246   }\n\
247 }\n\n", NULL)
248   ; else return
249 concat (
250 "OUTPUT_FORMAT(\"coff-sh\")\n\
251 OUTPUT_ARCH(sh)\n\
252 MEMORY\n\
253 {\n\
254   ram : o = 0x1000, l = 512k\n\
255 }\n\
256 SECTIONS\n\
257 {\n\
258  ","   .text :\n\
259   {\n\
260     *(.text)\n\
261     *(.strings)\n\
262      _etext = . ; \n\
263   }  > ram\n\
264  ","   .tors :\n\
265   {\n\
266     ___ctors = . ;\n\
267     *(.ctors)\n\
268     ___ctors_end = . ;\n\
269     ___dtors = . ;\n\
270     *(.dtors)\n\
271     ___dtors_end = . ;\n\
272   }  > ram\n\
273  ","   .data :\n\
274   {\n\
275     *(.data)\n\
276      _edata = . ; \n\
277   }  > ram\n\
278  ","   .bss :\n\
279   {\n\
280      _bss_start = . ; \n\
281     *(.bss)\n\
282     *(COMMON)\n\
283      _end = . ;  \n\
284   }  > ram\n\
285  ","   .stack  0x30000   :\n\
286   {\n\
287      _stack = . ; \n\
288     *(.stack)\n\
289   }  > ram\n\
290  ","   .stab 0 (NOLOAD) :\n\
291   {\n\
292     *(.stab)\n\
293   }\n\
294  ","   .stabstr 0 (NOLOAD) :\n\
295   {\n\
296     *(.stabstr)\n\
297   }\n\
298 }\n\n", NULL)
299 ; }
300
301 struct ld_emulation_xfer_struct ld_sh_emulation = 
302 {
303   gldsh_before_parse,
304   syslib_default,
305   hll_default,
306   after_parse_default,
307   after_open_default,
308   after_allocation_default,
309   set_output_arch_default,
310   ldemul_default_target,
311   before_allocation_default,
312   gldsh_get_script,
313   "sh",
314   "coff-sh"
315 };