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