Commit | Line | Data |
---|---|---|
49af8a4e SS |
1 | /* This file is is generated by a shell script. DO NOT EDIT! */ |
2 | ||
3 | /* AIX emulation code for ppcmacos | |
4 | Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc. | |
5 | Written by Steve Chamberlain <sac@cygnus.com> | |
6 | AIX support by Ian Lance Taylor <ian@cygnus.com> | |
7 | ||
8 | This file is part of GLD, the Gnu Linker. | |
9 | ||
10 | This program is free software; you can redistribute it and/or modify | |
11 | it under the terms of the GNU General Public License as published by | |
12 | the Free Software Foundation; either version 2 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | This program is distributed in the hope that it will be useful, | |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | GNU General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU General Public License | |
21 | along with this program; if not, write to the Free Software | |
22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
23 | ||
24 | #define TARGET_IS_ppcmacos | |
25 | ||
26 | #include "bfd.h" | |
27 | #include "sysdep.h" | |
28 | #include "libiberty.h" | |
29 | #include "getopt.h" | |
30 | #include "bfdlink.h" | |
31 | ||
32 | #include <ctype.h> | |
33 | ||
34 | #include "ld.h" | |
35 | #include "ldmain.h" | |
36 | #include "ldemul.h" | |
37 | #include "ldfile.h" | |
38 | #include "ldmisc.h" | |
39 | #include "ldexp.h" | |
40 | #include "ldlang.h" | |
41 | ||
42 | static void gldppcmacos_before_parse PARAMS ((void)); | |
43 | static int gldppcmacos_parse_args PARAMS ((int, char **)); | |
44 | static void gldppcmacos_before_allocation PARAMS ((void)); | |
45 | static void gldppcmacos_read_file PARAMS ((const char *, boolean)); | |
46 | static void gldppcmacos_free PARAMS ((PTR)); | |
47 | static char *gldppcmacos_get_script PARAMS ((int *isfile)); | |
48 | ||
49 | /* The file alignment required for each section. */ | |
50 | static unsigned long file_align; | |
51 | ||
52 | /* The maximum size the stack is permitted to grow. This is stored in | |
53 | the a.out header. */ | |
54 | static unsigned long maxstack; | |
55 | ||
56 | /* The maximum data size. This is stored in the a.out header. */ | |
57 | static unsigned long maxdata; | |
58 | ||
59 | /* Whether to perform garbage collection. */ | |
60 | static int gc = 1; | |
61 | ||
62 | /* The module type to use. */ | |
63 | static unsigned short modtype = ('1' << 8) | 'L'; | |
64 | ||
65 | /* Whether the .text section must be read-only (i.e., no relocs | |
66 | permitted). */ | |
67 | static int textro; | |
68 | ||
69 | /* Structure used to hold import or export file list. */ | |
70 | ||
71 | struct filelist | |
72 | { | |
73 | struct filelist *next; | |
74 | const char *name; | |
75 | }; | |
76 | ||
77 | /* List of import files. */ | |
78 | struct filelist *import_files; | |
79 | ||
80 | /* List of export files. */ | |
81 | struct filelist *export_files; | |
82 | ||
83 | static void | |
84 | gldppcmacos_before_parse() | |
85 | { | |
86 | #ifndef TARGET_ /* I.e., if not generic. */ | |
87 | ldfile_output_architecture = bfd_arch_powerpc; | |
88 | #endif /* not TARGET_ */ | |
89 | } | |
90 | ||
91 | /* Handle AIX specific options. */ | |
92 | ||
93 | static int | |
94 | gldppcmacos_parse_args (argc, argv) | |
95 | int argc; | |
96 | char **argv; | |
97 | { | |
98 | int prevoptind = optind; | |
99 | int prevopterr = opterr; | |
100 | int longind; | |
101 | int optc; | |
102 | long val; | |
103 | char *end; | |
104 | ||
105 | #define OPTION_IGNORE (300) | |
106 | #define OPTION_AUTOIMP (OPTION_IGNORE + 1) | |
107 | #define OPTION_ERNOTOK (OPTION_AUTOIMP + 1) | |
108 | #define OPTION_EROK (OPTION_ERNOTOK + 1) | |
109 | #define OPTION_EXPORT (OPTION_EROK + 1) | |
110 | #define OPTION_IMPORT (OPTION_EXPORT + 1) | |
111 | #define OPTION_MAXDATA (OPTION_IMPORT + 1) | |
112 | #define OPTION_MAXSTACK (OPTION_MAXDATA + 1) | |
113 | #define OPTION_MODTYPE (OPTION_MAXSTACK + 1) | |
114 | #define OPTION_NOAUTOIMP (OPTION_MODTYPE + 1) | |
115 | #define OPTION_NOSTRCMPCT (OPTION_NOAUTOIMP + 1) | |
116 | #define OPTION_STRCMPCT (OPTION_NOSTRCMPCT + 1) | |
117 | ||
118 | static struct option longopts[] = { | |
119 | {"basis", no_argument, NULL, OPTION_IGNORE}, | |
120 | {"bautoimp", no_argument, NULL, OPTION_AUTOIMP}, | |
121 | {"bcomprld", no_argument, NULL, OPTION_IGNORE}, | |
122 | {"bcrld", no_argument, NULL, OPTION_IGNORE}, | |
123 | {"bcror31", no_argument, NULL, OPTION_IGNORE}, | |
124 | {"bD", required_argument, NULL, OPTION_MAXDATA}, | |
125 | {"bE", required_argument, NULL, OPTION_EXPORT}, | |
126 | {"bernotok", no_argument, NULL, OPTION_ERNOTOK}, | |
127 | {"berok", no_argument, NULL, OPTION_EROK}, | |
128 | {"berrmsg", no_argument, NULL, OPTION_IGNORE}, | |
129 | {"bexport", required_argument, NULL, OPTION_EXPORT}, | |
130 | {"bf", no_argument, NULL, OPTION_ERNOTOK}, | |
131 | {"bgc", no_argument, &gc, 1}, | |
132 | {"bh", required_argument, NULL, OPTION_IGNORE}, | |
133 | {"bhalt", required_argument, NULL, OPTION_IGNORE}, | |
134 | {"bI", required_argument, NULL, OPTION_IMPORT}, | |
135 | {"bimport", required_argument, NULL, OPTION_IMPORT}, | |
136 | {"bmaxdata", required_argument, NULL, OPTION_MAXDATA}, | |
137 | {"bmaxstack", required_argument, NULL, OPTION_MAXSTACK}, | |
138 | {"bM", required_argument, NULL, OPTION_MODTYPE}, | |
139 | {"bmodtype", required_argument, NULL, OPTION_MODTYPE}, | |
140 | {"bnoautoimp", no_argument, NULL, OPTION_NOAUTOIMP}, | |
141 | {"bnodelcsect", no_argument, NULL, OPTION_IGNORE}, | |
142 | {"bnogc", no_argument, &gc, 0}, | |
143 | {"bnso", no_argument, NULL, OPTION_NOAUTOIMP}, | |
144 | {"bnostrcmpct", no_argument, NULL, OPTION_NOSTRCMPCT}, | |
145 | {"bnotextro", no_argument, &textro, 0}, | |
146 | {"bnro", no_argument, &textro, 0}, | |
147 | {"bro", no_argument, &textro, 1}, | |
148 | {"bS", required_argument, NULL, OPTION_MAXSTACK}, | |
149 | {"bso", no_argument, NULL, OPTION_AUTOIMP}, | |
150 | {"bstrcmpct", no_argument, NULL, OPTION_STRCMPCT}, | |
151 | {"btextro", no_argument, &textro, 1}, | |
152 | {NULL, no_argument, NULL, 0} | |
153 | }; | |
154 | ||
155 | /* Options supported by the AIX linker which we do not support: -f, | |
156 | -S, -v, -Z, -bbindcmds, -bbinder, -bbindopts, -bcalls, -bcaps, | |
157 | -bcror15, -bdebugopt, -bdbg, -bdelcsect, -bex?, -bfilelist, -bfl, | |
158 | -bgcbypass, -bglink, -binsert, -bi, -bloadmap, -bl, -bmap, -bnl, | |
159 | -bnobind, -bnocomprld, -bnocrld, -bnoerrmsg, -bnoglink, | |
160 | -bnoloadmap, -bnl, -bnoobjreorder, -bnoquiet, -bnoreorder, | |
161 | -bnotypchk, -bnox, -bquiet, -bR, -brename, -breorder, -btypchk, | |
162 | -bx, -bX, -bxref. */ | |
163 | ||
164 | /* If the first option starts with -b, change the first : to an =. | |
165 | The AIX linker uses : to separate the option from the argument; | |
166 | changing it to = lets us treat it as a getopt option. */ | |
167 | if (optind < argc && strncmp (argv[optind], "-b", 2) == 0) | |
168 | { | |
169 | char *s; | |
170 | ||
171 | for (s = argv[optind]; *s != '\0'; s++) | |
172 | { | |
173 | if (*s == ':') | |
174 | { | |
175 | *s = '='; | |
176 | break; | |
177 | } | |
178 | } | |
179 | } | |
180 | ||
181 | opterr = 0; | |
182 | optc = getopt_long_only (argc, argv, "-D:H:KT:z", longopts, &longind); | |
183 | opterr = prevopterr; | |
184 | ||
185 | switch (optc) | |
186 | { | |
187 | default: | |
188 | optind = prevoptind; | |
189 | return 0; | |
190 | ||
191 | case 0: | |
192 | /* Long option which just sets a flag. */ | |
193 | break; | |
194 | ||
195 | case 'D': | |
196 | val = strtol (optarg, &end, 0); | |
197 | if (*end != '\0') | |
198 | einfo ("%P: warning: ignoring invalid -D number %s\n", optarg); | |
199 | else if (val != -1) | |
200 | lang_section_start (".data", exp_intop (val)); | |
201 | break; | |
202 | ||
203 | case 'H': | |
204 | val = strtoul (optarg, &end, 0); | |
205 | if (*end != '\0' | |
206 | || (val & (val - 1)) != 0) | |
207 | einfo ("%P: warning: ignoring invalid -H number %s\n", optarg); | |
208 | else | |
209 | file_align = val; | |
210 | break; | |
211 | ||
212 | case 'K': | |
213 | case 'z': | |
214 | /* FIXME: This should use the page size for the target system. */ | |
215 | file_align = 4096; | |
216 | break; | |
217 | ||
218 | case 'T': | |
219 | /* On AIX this is the same as GNU ld -Ttext. When we see -T | |
220 | number, we assume the AIX option is intended. Otherwise, we | |
221 | assume the usual GNU ld -T option is intended. We can't just | |
222 | ignore the AIX option, because gcc passes it to the linker. */ | |
223 | val = strtoul (optarg, &end, 0); | |
224 | if (*end != '\0') | |
225 | { | |
226 | optind = prevoptind; | |
227 | return 0; | |
228 | } | |
229 | lang_section_start (".text", exp_intop (val)); | |
230 | break; | |
231 | ||
232 | case OPTION_IGNORE: | |
233 | break; | |
234 | ||
235 | case OPTION_AUTOIMP: | |
236 | link_info.static_link = false; | |
237 | break; | |
238 | ||
239 | case OPTION_ERNOTOK: | |
240 | force_make_executable = false; | |
241 | break; | |
242 | ||
243 | case OPTION_EROK: | |
244 | force_make_executable = true; | |
245 | break; | |
246 | ||
247 | case OPTION_EXPORT: | |
248 | case OPTION_IMPORT: | |
249 | { | |
250 | struct filelist *n; | |
251 | struct filelist **flpp; | |
252 | ||
253 | n = (struct filelist *) xmalloc (sizeof (struct filelist)); | |
254 | n->next = NULL; | |
255 | n->name = optarg; | |
256 | if (optc == OPTION_EXPORT) | |
257 | flpp = &export_files; | |
258 | else | |
259 | flpp = &import_files; | |
260 | while (*flpp != NULL) | |
261 | flpp = &(*flpp)->next; | |
262 | *flpp = n; | |
263 | } | |
264 | break; | |
265 | ||
266 | case OPTION_MAXDATA: | |
267 | val = strtoul (optarg, &end, 0); | |
268 | if (*end != '\0') | |
269 | einfo ("%P: warning: ignoring invalid -bmaxdata number %s\n", | |
270 | optarg); | |
271 | else | |
272 | maxdata = val; | |
273 | break; | |
274 | ||
275 | case OPTION_MAXSTACK: | |
276 | val = strtoul (optarg, &end, 0); | |
277 | if (*end != '\0') | |
278 | einfo ("%P: warning: ignoring invalid -bmaxstack number %s\n", | |
279 | optarg); | |
280 | else | |
281 | maxstack = val; | |
282 | break; | |
283 | ||
284 | case OPTION_MODTYPE: | |
285 | if (*optarg == 'S') | |
286 | { | |
287 | link_info.shared = true; | |
288 | ++optarg; | |
289 | } | |
290 | if (*optarg == '\0' || optarg[1] == '\0') | |
291 | einfo ("%P: warning: ignoring invalid module type %s\n", optarg); | |
292 | else | |
293 | modtype = (*optarg << 8) | optarg[1]; | |
294 | break; | |
295 | ||
296 | case OPTION_NOAUTOIMP: | |
297 | link_info.static_link = true; | |
298 | break; | |
299 | ||
300 | case OPTION_NOSTRCMPCT: | |
301 | config.traditional_format = true; | |
302 | break; | |
303 | ||
304 | case OPTION_STRCMPCT: | |
305 | config.traditional_format = false; | |
306 | break; | |
307 | } | |
308 | ||
309 | return 1; | |
310 | } | |
311 | ||
312 | /* This is called after the sections have been attached to output | |
313 | sections, but before any sizes or addresses have been set. */ | |
314 | ||
315 | static void | |
316 | gldppcmacos_before_allocation () | |
317 | { | |
318 | struct filelist *fl; | |
319 | char *libpath; | |
320 | ||
321 | /* Handle the import and export files, if any. */ | |
322 | for (fl = import_files; fl != NULL; fl = fl->next) | |
323 | gldppcmacos_read_file (fl->name, true); | |
324 | for (fl = export_files; fl != NULL; fl = fl->next) | |
325 | gldppcmacos_read_file (fl->name, false); | |
326 | ||
327 | /* We need to build LIBPATH from the -L arguments. If any -rpath | |
328 | arguments were used, though, we use -rpath instead, as a GNU | |
329 | extension. */ | |
330 | if (command_line.rpath != NULL) | |
331 | libpath = command_line.rpath; | |
332 | else if (search_head == NULL) | |
333 | libpath = (char *) ""; | |
334 | else | |
335 | { | |
336 | size_t len; | |
337 | search_dirs_type *search; | |
338 | ||
339 | len = strlen (search_head->name); | |
340 | libpath = xmalloc (len + 1); | |
341 | strcpy (libpath, search_head->name); | |
342 | for (search = search_head->next; search != NULL; search = search->next) | |
343 | { | |
344 | size_t nlen; | |
345 | ||
346 | nlen = strlen (search->name); | |
347 | libpath = xrealloc (libpath, len + nlen + 2); | |
348 | libpath[len] = ':'; | |
349 | strcpy (libpath + len + 1, search->name); | |
350 | len += nlen + 1; | |
351 | } | |
352 | } | |
353 | ||
354 | /* Let the XCOFF backend set up the .loader section. */ | |
355 | if (! bfd_xcoff_size_dynamic_sections (output_bfd, &link_info, libpath, | |
356 | entry_symbol, file_align, | |
357 | maxstack, maxdata, | |
358 | gc ? true : false, | |
359 | modtype, | |
360 | textro ? true : false)) | |
361 | einfo ("%P%F: failed to set dynamic section sizes: %E\n"); | |
362 | } | |
363 | ||
364 | /* Read an import or export file. */ | |
365 | ||
366 | static void | |
367 | gldppcmacos_read_file (filename, import) | |
368 | const char *filename; | |
369 | boolean import; | |
370 | { | |
371 | struct obstack *o; | |
372 | FILE *f; | |
373 | int lineno; | |
374 | int c; | |
375 | boolean keep; | |
376 | const char *imppath; | |
377 | const char *impfile; | |
378 | const char *impmember; | |
379 | ||
380 | o = (struct obstack *) xmalloc (sizeof (struct obstack)); | |
381 | obstack_specify_allocation (o, 0, 0, xmalloc, gldppcmacos_free); | |
382 | ||
383 | f = fopen (filename, "r"); | |
384 | if (f == NULL) | |
385 | { | |
386 | bfd_set_error (bfd_error_system_call); | |
387 | einfo ("%F%s: %E\n", filename); | |
388 | } | |
389 | ||
390 | keep = false; | |
391 | ||
392 | imppath = NULL; | |
393 | impfile = NULL; | |
394 | impmember = NULL; | |
395 | ||
396 | lineno = 0; | |
397 | while ((c = getc (f)) != EOF) | |
398 | { | |
399 | char *s; | |
400 | char *symname; | |
401 | boolean syscall; | |
402 | bfd_vma address; | |
403 | struct bfd_link_hash_entry *h; | |
404 | ||
405 | if (c != '\n') | |
406 | { | |
407 | obstack_1grow (o, c); | |
408 | continue; | |
409 | } | |
410 | ||
411 | obstack_1grow (o, '\0'); | |
412 | ++lineno; | |
413 | ||
414 | s = (char *) obstack_base (o); | |
415 | while (isspace ((unsigned char) *s)) | |
416 | ++s; | |
417 | if (*s == '\0' | |
418 | || *s == '*' | |
419 | || (*s == '#' && s[1] == ' ') | |
420 | || (! import && *s == '#' && s[1] == '!')) | |
421 | { | |
422 | obstack_free (o, obstack_base (o)); | |
423 | continue; | |
424 | } | |
425 | ||
426 | if (*s == '#' && s[1] == '!') | |
427 | { | |
428 | s += 2; | |
429 | while (isspace ((unsigned char) *s)) | |
430 | ++s; | |
431 | if (*s == '\0') | |
432 | { | |
433 | imppath = NULL; | |
434 | impfile = NULL; | |
435 | impmember = NULL; | |
436 | obstack_free (o, obstack_base (o)); | |
437 | } | |
438 | else if (*s == '(') | |
439 | einfo ("%F%s%d: #! ([member]) is not supported in import files", | |
440 | filename, lineno); | |
441 | else | |
442 | { | |
443 | char cs; | |
444 | char *file; | |
445 | ||
446 | (void) obstack_finish (o); | |
447 | keep = true; | |
448 | imppath = s; | |
449 | impfile = NULL; | |
450 | while (! isspace ((unsigned char) *s) && *s != '(' && *s != '\0') | |
451 | { | |
452 | if (*s == '/') | |
453 | file = s + 1; | |
454 | ++s; | |
455 | } | |
456 | if (file != NULL) | |
457 | { | |
458 | file[-1] = '\0'; | |
459 | impfile = file; | |
460 | if (imppath == file - 1) | |
461 | imppath = "/"; | |
462 | } | |
463 | else | |
464 | { | |
465 | impfile = imppath; | |
466 | imppath = ""; | |
467 | } | |
468 | cs = *s; | |
469 | *s = '\0'; | |
470 | while (isspace ((unsigned char) cs)) | |
471 | { | |
472 | ++s; | |
473 | cs = *s; | |
474 | } | |
475 | if (cs != '(') | |
476 | { | |
477 | impmember = ""; | |
478 | if (cs != '\0') | |
479 | einfo ("%s:%d: warning: syntax error in import file\n", | |
480 | filename, lineno); | |
481 | } | |
482 | else | |
483 | { | |
484 | ++s; | |
485 | impmember = s; | |
486 | while (*s != ')' && *s != '\0') | |
487 | ++s; | |
488 | if (*s == ')') | |
489 | *s = '\0'; | |
490 | else | |
491 | einfo ("%s:%d: warning: syntax error in import file\n", | |
492 | filename, lineno); | |
493 | } | |
494 | } | |
495 | ||
496 | continue; | |
497 | } | |
498 | ||
499 | /* This is a symbol to be imported or exported. */ | |
500 | symname = s; | |
501 | syscall = false; | |
502 | address = (bfd_vma) -1; | |
503 | ||
504 | while (! isspace ((unsigned char) *s) && *s != '\0') | |
505 | ++s; | |
506 | if (*s != '\0') | |
507 | { | |
508 | char *se; | |
509 | ||
510 | *s++ = '\0'; | |
511 | ||
512 | while (isspace ((unsigned char) *s)) | |
513 | ++s; | |
514 | ||
515 | se = s; | |
516 | while (! isspace ((unsigned char) *se) && *se != '\0') | |
517 | ++se; | |
518 | if (*se != '\0') | |
519 | { | |
520 | *se++ = '\0'; | |
521 | while (isspace ((unsigned char) *se)) | |
522 | ++se; | |
523 | if (*se != '\0') | |
524 | einfo ("%s%d: warning: syntax error in import/export file\n", | |
525 | filename, lineno); | |
526 | } | |
527 | ||
528 | if (strcasecmp (s, "svc") == 0 | |
529 | || strcasecmp (s, "syscall") == 0) | |
530 | syscall = true; | |
531 | else | |
532 | { | |
533 | char *end; | |
534 | ||
535 | address = strtoul (s, &end, 0); | |
536 | if (*end != '\0') | |
537 | einfo ("%s:%d: warning: syntax error in import/export file\n", | |
538 | filename, lineno); | |
539 | } | |
540 | } | |
541 | ||
542 | h = bfd_link_hash_lookup (link_info.hash, symname, false, false, true); | |
543 | if (h == NULL || h->type == bfd_link_hash_new) | |
544 | { | |
545 | /* We can just ignore attempts to import an unreferenced | |
546 | symbol. */ | |
547 | if (! import) | |
548 | einfo ("%X%s:%d: attempt to export undefined symbol %s\n", | |
549 | filename, lineno, symname); | |
550 | } | |
551 | else if (import) | |
552 | { | |
553 | if (! bfd_xcoff_import_symbol (output_bfd, &link_info, h, address, | |
554 | imppath, impfile, impmember)) | |
555 | einfo ("%X%s:%d: failed to import symbol %s: %E\n", | |
556 | filename, lineno, symname); | |
557 | } | |
558 | else | |
559 | { | |
560 | if (! bfd_xcoff_export_symbol (output_bfd, &link_info, h, syscall)) | |
561 | einfo ("%X%s:%d: failed to export symbol %s: %E\n", | |
562 | filename, lineno, symname); | |
563 | } | |
564 | ||
565 | obstack_free (o, obstack_base (o)); | |
566 | } | |
567 | ||
568 | if (obstack_object_size (o) > 0) | |
569 | { | |
570 | einfo ("%s:%d: warning: ignoring unterminated last line\n", | |
571 | filename, lineno); | |
572 | obstack_free (o, obstack_base (o)); | |
573 | } | |
574 | ||
575 | if (! keep) | |
576 | { | |
577 | obstack_free (o, NULL); | |
578 | free (o); | |
579 | } | |
580 | } | |
581 | ||
582 | /* This routine saves us from worrying about declaring free. */ | |
583 | ||
584 | static void | |
585 | gldppcmacos_free (p) | |
586 | PTR p; | |
587 | { | |
588 | free (p); | |
589 | } | |
590 | ||
591 | static char * | |
592 | gldppcmacos_get_script(isfile) | |
593 | int *isfile; | |
594 | { | |
595 | *isfile = 0; | |
596 | ||
597 | if (link_info.relocateable == true && config.build_constructors == true) | |
598 | return | |
599 | "OUTPUT_FORMAT(\"xcoff-powermac\")\n\ | |
600 | OUTPUT_ARCH(powerpc)\n\ | |
601 | ENTRY(__start)\n\ | |
602 | SECTIONS\n\ | |
603 | {\n\ | |
604 | .pad 0 : { *(.pad) }\n\ | |
605 | .text 0 : {\n\ | |
606 | *(.text)\n\ | |
607 | *(.pr)\n\ | |
608 | *(.ro)\n\ | |
609 | *(.db)\n\ | |
610 | *(.gl)\n\ | |
611 | *(.xo)\n\ | |
612 | *(.ti)\n\ | |
613 | *(.tb)\n\ | |
614 | }\n\ | |
615 | .data 0 : {\n\ | |
616 | *(.data)\n\ | |
617 | *(.rw)\n\ | |
618 | *(.sv)\n\ | |
619 | *(.ua)\n\ | |
620 | *(.ds)\n\ | |
621 | *(.tc0)\n\ | |
622 | *(.tc)\n\ | |
623 | *(.td)\n\ | |
624 | }\n\ | |
625 | .bss : {\n\ | |
626 | *(.bss)\n\ | |
627 | *(.bs)\n\ | |
628 | *(.uc)\n\ | |
629 | *(COMMON)\n\ | |
630 | }\n\ | |
631 | .loader 0 : {\n\ | |
632 | *(.loader)\n\ | |
633 | }\n\ | |
634 | .debug 0 : {\n\ | |
635 | *(.debug)\n\ | |
636 | }\n\ | |
637 | }\n\n" | |
638 | ; else if (link_info.relocateable == true) return | |
639 | "OUTPUT_FORMAT(\"xcoff-powermac\")\n\ | |
640 | OUTPUT_ARCH(powerpc)\n\ | |
641 | ENTRY(__start)\n\ | |
642 | SECTIONS\n\ | |
643 | {\n\ | |
644 | .pad 0 : { *(.pad) }\n\ | |
645 | .text 0 : {\n\ | |
646 | *(.text)\n\ | |
647 | *(.pr)\n\ | |
648 | *(.ro)\n\ | |
649 | *(.db)\n\ | |
650 | *(.gl)\n\ | |
651 | *(.xo)\n\ | |
652 | *(.ti)\n\ | |
653 | *(.tb)\n\ | |
654 | }\n\ | |
655 | .data 0 : {\n\ | |
656 | *(.data)\n\ | |
657 | *(.rw)\n\ | |
658 | *(.sv)\n\ | |
659 | *(.ua)\n\ | |
660 | *(.ds)\n\ | |
661 | *(.tc0)\n\ | |
662 | *(.tc)\n\ | |
663 | *(.td)\n\ | |
664 | }\n\ | |
665 | .bss : {\n\ | |
666 | *(.bss)\n\ | |
667 | *(.bs)\n\ | |
668 | *(.uc)\n\ | |
669 | *(COMMON)\n\ | |
670 | }\n\ | |
671 | .loader 0 : {\n\ | |
672 | *(.loader)\n\ | |
673 | }\n\ | |
674 | .debug 0 : {\n\ | |
675 | *(.debug)\n\ | |
676 | }\n\ | |
677 | }\n\n" | |
678 | ; else if (!config.text_read_only) return | |
679 | "OUTPUT_FORMAT(\"xcoff-powermac\")\n\ | |
680 | OUTPUT_ARCH(powerpc)\n\ | |
681 | SEARCH_DIR(/usr/local/powerpc-apple-macos/lib);\n\ | |
682 | ENTRY(__start)\n\ | |
683 | SECTIONS\n\ | |
684 | {\n\ | |
685 | .pad 0 : { *(.pad) }\n\ | |
686 | .text : {\n\ | |
687 | PROVIDE (_text = .);\n\ | |
688 | *(.text)\n\ | |
689 | *(.pr)\n\ | |
690 | *(.ro)\n\ | |
691 | *(.db)\n\ | |
692 | *(.gl)\n\ | |
693 | *(.xo)\n\ | |
694 | *(.ti)\n\ | |
695 | *(.tb)\n\ | |
696 | PROVIDE (_etext = .);\n\ | |
697 | }\n\ | |
698 | .data 0 : {\n\ | |
699 | PROVIDE (_data = .);\n\ | |
700 | *(.data)\n\ | |
701 | *(.rw)\n\ | |
702 | *(.sv)\n\ | |
703 | *(.ua)\n\ | |
704 | *(.ds)\n\ | |
705 | *(.tc0)\n\ | |
706 | *(.tc)\n\ | |
707 | *(.td)\n\ | |
708 | PROVIDE (_edata = .);\n\ | |
709 | }\n\ | |
710 | .bss : {\n\ | |
711 | *(.bss)\n\ | |
712 | *(.bs)\n\ | |
713 | *(.uc)\n\ | |
714 | *(COMMON)\n\ | |
715 | PROVIDE (_end = .);\n\ | |
716 | PROVIDE (end = .);\n\ | |
717 | }\n\ | |
718 | .loader 0 : {\n\ | |
719 | *(.loader)\n\ | |
720 | }\n\ | |
721 | .debug 0 : {\n\ | |
722 | *(.debug)\n\ | |
723 | }\n\ | |
724 | }\n\n" | |
725 | ; else if (!config.magic_demand_paged) return | |
726 | "OUTPUT_FORMAT(\"xcoff-powermac\")\n\ | |
727 | OUTPUT_ARCH(powerpc)\n\ | |
728 | SEARCH_DIR(/usr/local/powerpc-apple-macos/lib);\n\ | |
729 | ENTRY(__start)\n\ | |
730 | SECTIONS\n\ | |
731 | {\n\ | |
732 | .pad 0 : { *(.pad) }\n\ | |
733 | .text : {\n\ | |
734 | PROVIDE (_text = .);\n\ | |
735 | *(.text)\n\ | |
736 | *(.pr)\n\ | |
737 | *(.ro)\n\ | |
738 | *(.db)\n\ | |
739 | *(.gl)\n\ | |
740 | *(.xo)\n\ | |
741 | *(.ti)\n\ | |
742 | *(.tb)\n\ | |
743 | PROVIDE (_etext = .);\n\ | |
744 | }\n\ | |
745 | .data 0 : {\n\ | |
746 | PROVIDE (_data = .);\n\ | |
747 | *(.data)\n\ | |
748 | *(.rw)\n\ | |
749 | *(.sv)\n\ | |
750 | *(.ua)\n\ | |
751 | *(.ds)\n\ | |
752 | *(.tc0)\n\ | |
753 | *(.tc)\n\ | |
754 | *(.td)\n\ | |
755 | PROVIDE (_edata = .);\n\ | |
756 | }\n\ | |
757 | .bss : {\n\ | |
758 | *(.bss)\n\ | |
759 | *(.bs)\n\ | |
760 | *(.uc)\n\ | |
761 | *(COMMON)\n\ | |
762 | PROVIDE (_end = .);\n\ | |
763 | PROVIDE (end = .);\n\ | |
764 | }\n\ | |
765 | .loader 0 : {\n\ | |
766 | *(.loader)\n\ | |
767 | }\n\ | |
768 | .debug 0 : {\n\ | |
769 | *(.debug)\n\ | |
770 | }\n\ | |
771 | }\n\n" | |
772 | ; else return | |
773 | "OUTPUT_FORMAT(\"xcoff-powermac\")\n\ | |
774 | OUTPUT_ARCH(powerpc)\n\ | |
775 | SEARCH_DIR(/usr/local/powerpc-apple-macos/lib);\n\ | |
776 | ENTRY(__start)\n\ | |
777 | SECTIONS\n\ | |
778 | {\n\ | |
779 | .pad 0 : { *(.pad) }\n\ | |
780 | .text : {\n\ | |
781 | PROVIDE (_text = .);\n\ | |
782 | *(.text)\n\ | |
783 | *(.pr)\n\ | |
784 | *(.ro)\n\ | |
785 | *(.db)\n\ | |
786 | *(.gl)\n\ | |
787 | *(.xo)\n\ | |
788 | *(.ti)\n\ | |
789 | *(.tb)\n\ | |
790 | PROVIDE (_etext = .);\n\ | |
791 | }\n\ | |
792 | .data 0 : {\n\ | |
793 | PROVIDE (_data = .);\n\ | |
794 | *(.data)\n\ | |
795 | *(.rw)\n\ | |
796 | *(.sv)\n\ | |
797 | *(.ua)\n\ | |
798 | *(.ds)\n\ | |
799 | *(.tc0)\n\ | |
800 | *(.tc)\n\ | |
801 | *(.td)\n\ | |
802 | PROVIDE (_edata = .);\n\ | |
803 | }\n\ | |
804 | .bss : {\n\ | |
805 | *(.bss)\n\ | |
806 | *(.bs)\n\ | |
807 | *(.uc)\n\ | |
808 | *(COMMON)\n\ | |
809 | PROVIDE (_end = .);\n\ | |
810 | PROVIDE (end = .);\n\ | |
811 | }\n\ | |
812 | .loader 0 : {\n\ | |
813 | *(.loader)\n\ | |
814 | }\n\ | |
815 | .debug 0 : {\n\ | |
816 | *(.debug)\n\ | |
817 | }\n\ | |
818 | }\n\n" | |
819 | ; } | |
820 | ||
821 | struct ld_emulation_xfer_struct ld_ppcmacos_emulation = | |
822 | { | |
823 | gldppcmacos_before_parse, | |
824 | syslib_default, | |
825 | hll_default, | |
826 | after_parse_default, | |
827 | after_open_default, | |
828 | after_allocation_default, | |
829 | set_output_arch_default, | |
830 | ldemul_default_target, | |
831 | gldppcmacos_before_allocation, | |
832 | gldppcmacos_get_script, | |
833 | "ppcmacos", | |
834 | "xcoff-powermac", | |
835 | 0, /* finish */ | |
836 | 0, /* create_output_section_statements */ | |
837 | 0, /* open_dynamic_archive */ | |
838 | 0, /* place_orphan */ | |
839 | 0, /* set_symbols */ | |
840 | gldppcmacos_parse_args, | |
841 | }; |