2001-05-31 H.J. Lu <hjl@gnu.org>
[binutils.git] / ld / mpw-elfmips.c
blob6f7cd2f7ef011f73c1fccaaf6ca6cb728538c99c
1 /* This file is is generated by a shell script. DO NOT EDIT! */
3 /* 32 bit ELF emulation code for elf32ebmip
4 Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001
5 Free Software Foundation, Inc.
6 Written by Steve Chamberlain <sac@cygnus.com>
7 ELF support by Ian Lance Taylor <ian@cygnus.com>
9 This file is part of GLD, the Gnu Linker.
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
25 #define TARGET_IS_elf32ebmip
27 #include "bfd.h"
28 #include "sysdep.h"
30 #include <ctype.h>
32 #include "bfdlink.h"
34 #include "ld.h"
35 #include "ldmain.h"
36 #include "ldmisc.h"
37 #include "ldexp.h"
38 #include "ldlang.h"
39 #include "ldgram.h"
40 #include "ldfile.h"
41 #include "ldemul.h"
43 static void gldelf32ebmip_before_parse PARAMS ((void));
44 static boolean gldelf32ebmip_open_dynamic_archive
45 PARAMS ((const char *, search_dirs_type *, lang_input_statement_type *));
46 static void gldelf32ebmip_after_open PARAMS ((void));
47 static void gldelf32ebmip_check_needed
48 PARAMS ((lang_input_statement_type *));
49 static void gldelf32ebmip_stat_needed
50 PARAMS ((lang_input_statement_type *));
51 static boolean gldelf32ebmip_search_needed
52 PARAMS ((const char *, const char *));
53 static boolean gldelf32ebmip_try_needed PARAMS ((const char *));
54 static void gldelf32ebmip_before_allocation PARAMS ((void));
55 static void gldelf32ebmip_find_statement_assignment
56 PARAMS ((lang_statement_union_type *));
57 static void gldelf32ebmip_find_exp_assignment PARAMS ((etree_type *));
58 static boolean gldelf32ebmip_place_orphan
59 PARAMS ((lang_input_statement_type *, asection *));
60 static void gldelf32ebmip_place_section
61 PARAMS ((lang_statement_union_type *));
62 static char *gldelf32ebmip_get_script PARAMS ((int *isfile));
64 static void
65 gldelf32ebmip_before_parse()
67 ldfile_output_architecture = bfd_arch_mips;
68 config.dynamic_link = true;
71 /* Try to open a dynamic archive. This is where we know that ELF
72 dynamic libraries have an extension of .so. */
74 static boolean
75 gldelf32ebmip_open_dynamic_archive (arch, search, entry)
76 const char *arch;
77 search_dirs_type *search;
78 lang_input_statement_type *entry;
80 const char *filename;
81 char *string;
83 if (! entry->is_archive)
84 return false;
86 filename = entry->filename;
88 string = (char *) xmalloc (strlen (search->name)
89 + strlen (filename)
90 + strlen (arch)
91 + sizeof "/lib.so");
93 sprintf (string, "%s/lib%s%s.so", search->name, filename, arch);
95 if (! ldfile_try_open_bfd (string, entry))
97 free (string);
98 return false;
101 entry->filename = string;
103 /* We have found a dynamic object to include in the link. The ELF
104 backend linker will create a DT_NEEDED entry in the .dynamic
105 section naming this file. If this file includes a DT_SONAME
106 entry, it will be used. Otherwise, the ELF linker will just use
107 the name of the file. For an archive found by searching, like
108 this one, the DT_NEEDED entry should consist of just the name of
109 the file, without the path information used to find it. Note
110 that we only need to do this if we have a dynamic object; an
111 archive will never be referenced by a DT_NEEDED entry.
113 FIXME: This approach--using bfd_elf_set_dt_needed_name--is not
114 very pretty. I haven't been able to think of anything that is
115 pretty, though. */
116 if (bfd_check_format (entry->the_bfd, bfd_object)
117 && (entry->the_bfd->flags & DYNAMIC) != 0)
119 char *needed_name;
121 ASSERT (entry->is_archive && entry->search_dirs_flag);
122 needed_name = (char *) xmalloc (strlen (filename)
123 + strlen (arch)
124 + sizeof "lib.so");
125 sprintf (needed_name, "lib%s%s.so", filename, arch);
126 bfd_elf_set_dt_needed_name (entry->the_bfd, needed_name);
129 return true;
133 /* These variables are required to pass information back and forth
134 between after_open and check_needed and stat_needed. */
136 static struct bfd_link_needed_list *global_needed;
137 static struct stat global_stat;
138 static boolean global_found;
140 /* This is called after all the input files have been opened. */
142 static void
143 gldelf32ebmip_after_open ()
145 struct bfd_link_needed_list *needed, *l;
147 /* We only need to worry about this when doing a final link. */
148 if (link_info.relocateable || link_info.shared)
149 return;
151 /* Get the list of files which appear in DT_NEEDED entries in
152 dynamic objects included in the link (often there will be none).
153 For each such file, we want to track down the corresponding
154 library, and include the symbol table in the link. This is what
155 the runtime dynamic linker will do. Tracking the files down here
156 permits one dynamic object to include another without requiring
157 special action by the person doing the link. Note that the
158 needed list can actually grow while we are stepping through this
159 loop. */
160 needed = bfd_elf_get_needed_list (output_bfd, &link_info);
161 for (l = needed; l != NULL; l = l->next)
163 struct bfd_link_needed_list *ll;
164 const char *lib_path;
165 size_t len;
166 search_dirs_type *search;
168 /* If we've already seen this file, skip it. */
169 for (ll = needed; ll != l; ll = ll->next)
170 if (strcmp (ll->name, l->name) == 0)
171 break;
172 if (ll != l)
173 continue;
175 /* See if this file was included in the link explicitly. */
176 global_needed = l;
177 global_found = false;
178 lang_for_each_input_file (gldelf32ebmip_check_needed);
179 if (global_found)
180 continue;
182 /* We need to find this file and include the symbol table. We
183 want to search for the file in the same way that the dynamic
184 linker will search. That means that we want to use
185 rpath_link, rpath, then the environment variable
186 LD_LIBRARY_PATH (native only), then the linker script
187 LIB_SEARCH_DIRS. We do not search using the -L arguments. */
188 if (gldelf32ebmip_search_needed (command_line.rpath_link,
189 l->name))
190 continue;
191 if (gldelf32ebmip_search_needed (command_line.rpath, l->name))
192 continue;
193 if (command_line.rpath_link == NULL
194 && command_line.rpath == NULL)
196 lib_path = (const char *) getenv ("LD_RUN_PATH");
197 if (gldelf32ebmip_search_needed (lib_path, l->name))
198 continue;
200 len = strlen (l->name);
201 for (search = search_head; search != NULL; search = search->next)
203 char *filename;
205 if (search->cmdline)
206 continue;
207 filename = (char *) xmalloc (strlen (search->name) + len + 2);
208 sprintf (filename, "%s/%s", search->name, l->name);
209 if (gldelf32ebmip_try_needed (filename))
210 break;
211 free (filename);
213 if (search != NULL)
214 continue;
216 einfo (_("%P: warning: %s, needed by %B, not found\n"),
217 l->name, l->by);
221 /* Search for a needed file in a path. */
223 static boolean
224 gldelf32ebmip_search_needed (path, name)
225 const char *path;
226 const char *name;
228 const char *s;
229 size_t len;
231 if (path == NULL || *path == '\0')
232 return false;
233 len = strlen (name);
234 while (1)
236 char *filename, *sset;
238 s = strchr (path, ':');
239 if (s == NULL)
240 s = path + strlen (path);
242 filename = (char *) xmalloc (s - path + len + 2);
243 if (s == path)
244 sset = filename;
245 else
247 memcpy (filename, path, s - path);
248 filename[s - path] = '/';
249 sset = filename + (s - path) + 1;
251 strcpy (sset, name);
253 if (gldelf32ebmip_try_needed (filename))
254 return true;
256 free (filename);
258 if (*s == '\0')
259 break;
260 path = s + 1;
263 return false;
266 /* This function is called for each possible name for a dynamic object
267 named by a DT_NEEDED entry. */
269 static boolean
270 gldelf32ebmip_try_needed (name)
271 const char *name;
273 bfd *abfd;
275 abfd = bfd_openr (name, bfd_get_target (output_bfd));
276 if (abfd == NULL)
277 return false;
278 if (! bfd_check_format (abfd, bfd_object))
280 (void) bfd_close (abfd);
281 return false;
283 if ((bfd_get_file_flags (abfd) & DYNAMIC) == 0)
285 (void) bfd_close (abfd);
286 return false;
289 /* We've found a dynamic object matching the DT_NEEDED entry. */
291 /* We have already checked that there is no other input file of the
292 same name. We must now check again that we are not including the
293 same file twice. We need to do this because on many systems
294 libc.so is a symlink to, e.g., libc.so.1. The SONAME entry will
295 reference libc.so.1. If we have already included libc.so, we
296 don't want to include libc.so.1 if they are the same file, and we
297 can only check that using stat. */
299 if (bfd_stat (abfd, &global_stat) != 0)
300 einfo (_("%F%P:%B: bfd_stat failed: %E\n"), abfd);
301 global_found = false;
302 lang_for_each_input_file (gldelf32ebmip_stat_needed);
303 if (global_found)
305 /* Return true to indicate that we found the file, even though
306 we aren't going to do anything with it. */
307 return true;
310 /* Tell the ELF backend that don't want the output file to have a
311 DT_NEEDED entry for this file. */
312 bfd_elf_set_dt_needed_name (abfd, "");
314 /* Add this file into the symbol table. */
315 if (! bfd_link_add_symbols (abfd, &link_info))
316 einfo (_("%F%B: could not read symbols: %E\n"), abfd);
318 return true;
321 /* See if an input file matches a DT_NEEDED entry by name. */
323 static void
324 gldelf32ebmip_check_needed (s)
325 lang_input_statement_type *s;
327 if (global_found)
328 return;
330 if (s->filename != NULL
331 && strcmp (s->filename, global_needed->name) == 0)
333 global_found = true;
334 return;
337 if (s->the_bfd != NULL)
339 const char *soname;
341 soname = bfd_elf_get_dt_soname (s->the_bfd);
342 if (soname != NULL
343 && strcmp (soname, global_needed->name) == 0)
345 global_found = true;
346 return;
350 if (s->search_dirs_flag
351 && s->filename != NULL
352 && strchr (global_needed->name, '/') == NULL)
354 const char *f;
356 f = strrchr (s->filename, '/');
357 if (f != NULL
358 && strcmp (f + 1, global_needed->name) == 0)
360 global_found = true;
361 return;
366 /* See if an input file matches a DT_NEEDED entry by running stat on
367 the file. */
369 static void
370 gldelf32ebmip_stat_needed (s)
371 lang_input_statement_type *s;
373 struct stat st;
374 const char *suffix;
375 const char *soname;
376 const char *f;
378 if (global_found)
379 return;
380 if (s->the_bfd == NULL)
381 return;
383 if (bfd_stat (s->the_bfd, &st) != 0)
385 einfo (_("%P:%B: bfd_stat failed: %E\n"), s->the_bfd);
386 return;
389 if (st.st_dev == global_stat.st_dev
390 && st.st_ino == global_stat.st_ino)
392 global_found = true;
393 return;
396 /* We issue a warning if it looks like we are including two
397 different versions of the same shared library. For example,
398 there may be a problem if -lc picks up libc.so.6 but some other
399 shared library has a DT_NEEDED entry of libc.so.5. This is a
400 hueristic test, and it will only work if the name looks like
401 NAME.so.VERSION. FIXME: Depending on file names is error-prone.
402 If we really want to issue warnings about mixing version numbers
403 of shared libraries, we need to find a better way. */
405 if (strchr (global_needed->name, '/') != NULL)
406 return;
407 suffix = strstr (global_needed->name, ".so.");
408 if (suffix == NULL)
409 return;
410 suffix += sizeof ".so." - 1;
412 soname = bfd_elf_get_dt_soname (s->the_bfd);
413 if (soname == NULL)
414 soname = s->filename;
416 f = strrchr (soname, '/');
417 if (f != NULL)
418 ++f;
419 else
420 f = soname;
422 if (strncmp (f, global_needed->name, suffix - global_needed->name) == 0)
423 einfo (_("%P: warning: %s, needed by %B, may conflict with %s\n"),
424 global_needed->name, global_needed->by, f);
427 /* This is called after the sections have been attached to output
428 sections, but before any sizes or addresses have been set. */
430 static void
431 gldelf32ebmip_before_allocation ()
433 const char *rpath;
434 asection *sinterp;
436 /* If we are going to make any variable assignments, we need to let
437 the ELF backend know about them in case the variables are
438 referred to by dynamic objects. */
439 lang_for_each_statement (gldelf32ebmip_find_statement_assignment);
441 /* Let the ELF backend work out the sizes of any sections required
442 by dynamic linking. */
443 rpath = command_line.rpath;
444 if (rpath == NULL)
445 rpath = (const char *) getenv ("LD_RUN_PATH");
446 if (! (bfd_elf32_size_dynamic_sections
447 (output_bfd, command_line.soname, rpath,
448 command_line.export_dynamic, command_line.filter_shlib,
449 (const char * const *) command_line.auxiliary_filters,
450 &link_info, &sinterp, lang_elf_version_info)))
451 einfo (_("%P%F: failed to set dynamic section sizes: %E\n"));
453 /* Let the user override the dynamic linker we are using. */
454 if (command_line.interpreter != NULL
455 && sinterp != NULL)
457 sinterp->contents = (bfd_byte *) command_line.interpreter;
458 sinterp->_raw_size = strlen (command_line.interpreter) + 1;
461 /* Look for any sections named .gnu.warning. As a GNU extensions,
462 we treat such sections as containing warning messages. We print
463 out the warning message, and then zero out the section size so
464 that it does not get copied into the output file. */
467 LANG_FOR_EACH_INPUT_STATEMENT (is)
469 asection *s;
470 bfd_size_type sz;
471 char *msg;
472 boolean ret;
474 if (is->just_syms_flag)
475 continue;
477 s = bfd_get_section_by_name (is->the_bfd, ".gnu.warning");
478 if (s == NULL)
479 continue;
481 sz = bfd_section_size (is->the_bfd, s);
482 msg = xmalloc ((size_t) sz + 1);
483 if (! bfd_get_section_contents (is->the_bfd, s, msg, (file_ptr) 0, sz))
484 einfo (_("%F%B: Can't read contents of section .gnu.warning: %E\n"),
485 is->the_bfd);
486 msg[sz] = '\0';
487 ret = link_info.callbacks->warning (&link_info, msg,
488 (const char *) NULL,
489 is->the_bfd, (asection *) NULL,
490 (bfd_vma) 0);
491 ASSERT (ret);
492 free (msg);
494 /* Clobber the section size, so that we don't waste copying the
495 warning into the output file. */
496 s->_raw_size = 0;
501 /* This is called by the before_allocation routine via
502 lang_for_each_statement. It locates any assignment statements, and
503 tells the ELF backend about them, in case they are assignments to
504 symbols which are referred to by dynamic objects. */
506 static void
507 gldelf32ebmip_find_statement_assignment (s)
508 lang_statement_union_type *s;
510 if (s->header.type == lang_assignment_statement_enum)
511 gldelf32ebmip_find_exp_assignment (s->assignment_statement.exp);
514 /* Look through an expression for an assignment statement. */
516 static void
517 gldelf32ebmip_find_exp_assignment (exp)
518 etree_type *exp;
520 struct bfd_link_hash_entry *h;
522 switch (exp->type.node_class)
524 case etree_provide:
525 case etree_provided:
526 h = bfd_link_hash_lookup (link_info.hash, exp->assign.dst,
527 false, false, false);
528 if (h == NULL)
529 break;
531 /* We call record_link_assignment even if the symbol is defined.
532 This is because if it is defined by a dynamic object, we
533 actually want to use the value defined by the linker script,
534 not the value from the dynamic object (because we are setting
535 symbols like etext). If the symbol is defined by a regular
536 object, then, as it happens, calling record_link_assignment
537 will do no harm. */
539 /* Fall through. */
540 case etree_assign:
541 if (strcmp (exp->assign.dst, ".") != 0)
543 if (! (bfd_elf32_record_link_assignment
544 (output_bfd, &link_info, exp->assign.dst,
545 exp->type.node_class != etree_assign ? true : false)))
546 einfo (_("%P%F: failed to record assignment to %s: %E\n"),
547 exp->assign.dst);
549 gldelf32ebmip_find_exp_assignment (exp->assign.src);
550 break;
552 case etree_binary:
553 gldelf32ebmip_find_exp_assignment (exp->binary.lhs);
554 gldelf32ebmip_find_exp_assignment (exp->binary.rhs);
555 break;
557 case etree_trinary:
558 gldelf32ebmip_find_exp_assignment (exp->trinary.cond);
559 gldelf32ebmip_find_exp_assignment (exp->trinary.lhs);
560 gldelf32ebmip_find_exp_assignment (exp->trinary.rhs);
561 break;
563 case etree_unary:
564 gldelf32ebmip_find_exp_assignment (exp->unary.child);
565 break;
567 default:
568 break;
572 /* Place an orphan section. We use this to put random SHF_ALLOC
573 sections in the right segment. */
575 static asection *hold_section;
576 static lang_output_section_statement_type *hold_use;
577 static lang_output_section_statement_type *hold_text;
578 static lang_output_section_statement_type *hold_rodata;
579 static lang_output_section_statement_type *hold_data;
580 static lang_output_section_statement_type *hold_bss;
581 static lang_output_section_statement_type *hold_rel;
583 /*ARGSUSED*/
584 static boolean
585 gldelf32ebmip_place_orphan (file, s)
586 lang_input_statement_type *file;
587 asection *s;
589 lang_output_section_statement_type *place;
590 asection *snew, **pps;
591 lang_statement_list_type *old;
592 lang_statement_list_type add;
593 etree_type *address;
594 const char *secname, *ps;
595 lang_output_section_statement_type *os;
597 if ((s->flags & SEC_ALLOC) == 0)
598 return false;
600 /* Look through the script to see where to place this section. */
601 hold_section = s;
602 hold_use = NULL;
603 lang_for_each_statement (gldelf32ebmip_place_section);
605 if (hold_use != NULL)
607 /* We have already placed a section with this name. */
608 wild_doit (&hold_use->children, s, hold_use, file);
609 return true;
612 secname = bfd_get_section_name (s->owner, s);
614 /* If this is a final link, then always put .gnu.warning.SYMBOL
615 sections into the .text section to get them out of the way. */
616 if (! link_info.shared
617 && ! link_info.relocateable
618 && strncmp (secname, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0
619 && hold_text != NULL)
621 wild_doit (&hold_text->children, s, hold_text, file);
622 return true;
625 /* Decide which segment the section should go in based on the
626 section name and section flags. */
627 place = NULL;
628 if ((s->flags & SEC_HAS_CONTENTS) == 0
629 && hold_bss != NULL)
630 place = hold_bss;
631 else if ((s->flags & SEC_READONLY) == 0
632 && hold_data != NULL)
633 place = hold_data;
634 else if (strncmp (secname, ".rel", 4) == 0
635 && hold_rel != NULL)
636 place = hold_rel;
637 else if ((s->flags & SEC_CODE) == 0
638 && (s->flags & SEC_READONLY) != 0
639 && hold_rodata != NULL)
640 place = hold_rodata;
641 else if ((s->flags & SEC_READONLY) != 0
642 && hold_text != NULL)
643 place = hold_text;
644 if (place == NULL)
645 return false;
647 /* Create the section in the output file, and put it in the right
648 place. This shuffling is to make the output file look neater. */
649 snew = bfd_make_section (output_bfd, secname);
650 if (snew == NULL)
651 einfo (_("%P%F: output format %s cannot represent section called %s\n"),
652 output_bfd->xvec->name, secname);
653 if (place->bfd_section != NULL)
655 for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next)
657 *pps = snew->next;
658 snew->next = place->bfd_section->next;
659 place->bfd_section->next = snew;
662 /* Start building a list of statements for this section. */
663 old = stat_ptr;
664 stat_ptr = &add;
665 lang_list_init (stat_ptr);
667 /* If the name of the section is representable in C, then create
668 symbols to mark the start and the end of the section. */
669 for (ps = secname; *ps != '\0'; ps++)
670 if (! isalnum (*ps) && *ps != '_')
671 break;
672 if (*ps == '\0' && config.build_constructors)
674 char *symname;
676 symname = (char *) xmalloc (ps - secname + sizeof "__start_");
677 sprintf (symname, "__start_%s", secname);
678 lang_add_assignment (exp_assop ('=', symname,
679 exp_unop (ALIGN_K,
680 exp_intop ((bfd_vma) 1
681 << s->alignment_power))));
684 if (! link_info.relocateable)
685 address = NULL;
686 else
687 address = exp_intop ((bfd_vma) 0);
689 lang_enter_output_section_statement (secname, address, 0,
690 (bfd_vma) 0,
691 (etree_type *) NULL,
692 (etree_type *) NULL,
693 (etree_type *) NULL);
695 os = lang_output_section_statement_lookup (secname);
696 wild_doit (&os->children, s, os, file);
698 lang_leave_output_section_statement
699 ((bfd_vma) 0, "*default*",
700 (struct lang_output_section_phdr_list *) NULL, "*default*");
701 stat_ptr = &add;
703 if (*ps == '\0' && config.build_constructors)
705 char *symname;
707 symname = (char *) xmalloc (ps - secname + sizeof "__stop_");
708 sprintf (symname, "__stop_%s", secname);
709 lang_add_assignment (exp_assop ('=', symname,
710 exp_nameop (NAME, ".")));
713 /* Now stick the new statement list right after PLACE. */
714 *add.tail = place->header.next;
715 place->header.next = add.head;
717 stat_ptr = old;
719 return true;
722 static void
723 gldelf32ebmip_place_section (s)
724 lang_statement_union_type *s;
726 lang_output_section_statement_type *os;
728 if (s->header.type != lang_output_section_statement_enum)
729 return;
731 os = &s->output_section_statement;
733 if (strcmp (os->name, hold_section->name) == 0)
734 hold_use = os;
736 if (strcmp (os->name, ".text") == 0)
737 hold_text = os;
738 else if (strcmp (os->name, ".rodata") == 0)
739 hold_rodata = os;
740 else if (strcmp (os->name, ".data") == 0)
741 hold_data = os;
742 else if (strcmp (os->name, ".bss") == 0)
743 hold_bss = os;
744 else if (hold_rel == NULL
745 && os->bfd_section != NULL
746 && strncmp (os->name, ".rel", 4) == 0)
747 hold_rel = os;
750 static char *
751 gldelf32ebmip_get_script(isfile)
752 int *isfile;
754 *isfile = 0;
756 if (link_info.relocateable == true && config.build_constructors == true)
757 return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
758 \"elf32-littlemips\")\n\
759 OUTPUT_ARCH(mips)\n\
760 ENTRY(_start)\n\
761 /* For some reason, the Solaris linker makes bad executables\n\
762 if gld -r is used and the intermediate file has sections starting\n\
763 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld\n\
764 bug. But for now assigning the zero vmas works. */\n\
765 SECTIONS\n\
766 {\n\
767 /* Read-only sections, merged into text segment: */\n\
768 .interp 0 : { *(.interp) }\n\
769 .reginfo 0 : { *(.reginfo) }\n\
770 .dynamic 0 : { *(.dynamic) }\n\
771 .dynstr 0 : { *(.dynstr) }\n\
772 .dynsym 0 : { *(.dynsym) }\n\
773 .hash 0 : { *(.hash) }\n\
774 .rel.text 0 : { *(.rel.text) }\n\
775 .rela.text 0 : { *(.rela.text) }\n\
776 .rel.data 0 : { *(.rel.data) }\n\
777 .rela.data 0 : { *(.rela.data) }\n\
778 .rel.rodata 0 : { *(.rel.rodata) }\n\
779 .rela.rodata 0 : { *(.rela.rodata) }\n\
780 .rel.got 0 : { *(.rel.got) }\n\
781 .rela.got 0 : { *(.rela.got) }\n\
782 .rel.ctors 0 : { *(.rel.ctors) }\n\
783 .rela.ctors 0 : { *(.rela.ctors) }\n\
784 .rel.dtors 0 : { *(.rel.dtors) }\n\
785 .rela.dtors 0 : { *(.rela.dtors) }\n\
786 .rel.init 0 : { *(.rel.init) }\n\
787 .rela.init 0 : { *(.rela.init) }\n\
788 .rel.fini 0 : { *(.rel.fini) }\n\
789 .rela.fini 0 : { *(.rela.fini) }\n\
790 .rel.bss 0 : { *(.rel.bss) }\n\
791 .rela.bss 0 : { *(.rela.bss) }\n\
792 .rel.plt 0 : { *(.rel.plt) }\n\
793 .rela.plt 0 : { *(.rela.plt) }\n\
794 .rodata 0 : { *(.rodata) }\n\
795 .rodata1 0 : { *(.rodata1) }\n\
796 .init 0 : { *(.init) } =0\n\
797 .text 0 :\n\
798 {\n\
799 *(.text)\n\
800 *(.stub)\n\
801 /* .gnu.warning sections are handled specially by elf32.em. */\n\
802 *(.gnu.warning)\n\
803 } =0\n\
804 .fini 0 : { *(.fini) } =0\n\
805 /* Adjust the address for the data segment. We want to adjust up to\n\
806 the same address within the page on the next page up. It would\n\
807 be more correct to do this:\n\
808 The current expression does not correctly handle the case of a\n\
809 text segment ending precisely at the end of a page; it causes the\n\
810 data segment to skip a page. The above expression does not have\n\
811 this problem, but it will currently (2/95) cause BFD to allocate\n\
812 a single segment, combining both text and data, for this case.\n\
813 This will prevent the text segment from being shared among\n\
814 multiple executions of the program; I think that is more\n\
815 important than losing a page of the virtual address space (note\n\
816 that no actual memory is lost; the page which is skipped can not\n\
817 be referenced). */\n\
818 .data 0 :\n\
819 {\n\
820 *(.data)\n\
821 CONSTRUCTORS\n\
822 }\n\
823 .data1 0 : { *(.data1) }\n\
824 .ctors 0 : { *(.ctors) }\n\
825 .dtors 0 : { *(.dtors) }\n\
826 .got 0 :\n\
827 {\n\
828 *(.got.plt) *(.got)\n\
829 }\n\
830 /* We want the small data sections together, so single-instruction offsets\n\
831 can access them all, and initialized data all before uninitialized, so\n\
832 we can shorten the on-disk segment size. */\n\
833 .sdata 0 : { *(.sdata) }\n\
834 .sbss 0 : { *(.sbss) *(.scommon) }\n\
835 .bss 0 :\n\
836 {\n\
837 *(.dynbss)\n\
838 *(.bss)\n\
839 *(COMMON)\n\
840 }\n\
841 /* These are needed for ELF backends which have not yet been\n\
842 converted to the new style linker. */\n\
843 .stab 0 : { *(.stab) }\n\
844 .stabstr 0 : { *(.stabstr) }\n\
845 /* DWARF debug sections.\n\
846 Symbols in the .debug DWARF section are relative to the beginning of the\n\
847 section so we begin .debug at 0. It's not clear yet what needs to happen\n\
848 for the others. */\n\
849 .debug 0 : { *(.debug) }\n\
850 .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
851 .debug_aranges 0 : { *(.debug_aranges) }\n\
852 .debug_pubnames 0 : { *(.debug_pubnames) }\n\
853 .debug_sfnames 0 : { *(.debug_sfnames) }\n\
854 .line 0 : { *(.line) }\n\
855 /* These must appear regardless of . */\n\
856 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
857 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
858 }\n\n";
859 else if (link_info.relocateable == true)
860 return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
861 \"elf32-littlemips\")\n\
862 OUTPUT_ARCH(mips)\n\
863 ENTRY(_start)\n\
864 /* For some reason, the Solaris linker makes bad executables\n\
865 if gld -r is used and the intermediate file has sections starting\n\
866 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld\n\
867 bug. But for now assigning the zero vmas works. */\n\
868 SECTIONS\n\
869 {\n\
870 /* Read-only sections, merged into text segment: */\n\
871 .interp 0 : { *(.interp) }\n\
872 .reginfo 0 : { *(.reginfo) }\n\
873 .dynamic 0 : { *(.dynamic) }\n\
874 .dynstr 0 : { *(.dynstr) }\n\
875 .dynsym 0 : { *(.dynsym) }\n\
876 .hash 0 : { *(.hash) }\n\
877 .rel.text 0 : { *(.rel.text) }\n\
878 .rela.text 0 : { *(.rela.text) }\n\
879 .rel.data 0 : { *(.rel.data) }\n\
880 .rela.data 0 : { *(.rela.data) }\n\
881 .rel.rodata 0 : { *(.rel.rodata) }\n\
882 .rela.rodata 0 : { *(.rela.rodata) }\n\
883 .rel.got 0 : { *(.rel.got) }\n\
884 .rela.got 0 : { *(.rela.got) }\n\
885 .rel.ctors 0 : { *(.rel.ctors) }\n\
886 .rela.ctors 0 : { *(.rela.ctors) }\n\
887 .rel.dtors 0 : { *(.rel.dtors) }\n\
888 .rela.dtors 0 : { *(.rela.dtors) }\n\
889 .rel.init 0 : { *(.rel.init) }\n\
890 .rela.init 0 : { *(.rela.init) }\n\
891 .rel.fini 0 : { *(.rel.fini) }\n\
892 .rela.fini 0 : { *(.rela.fini) }\n\
893 .rel.bss 0 : { *(.rel.bss) }\n\
894 .rela.bss 0 : { *(.rela.bss) }\n\
895 .rel.plt 0 : { *(.rel.plt) }\n\
896 .rela.plt 0 : { *(.rela.plt) }\n\
897 .rodata 0 : { *(.rodata) }\n\
898 .rodata1 0 : { *(.rodata1) }\n\
899 .init 0 : { *(.init) } =0\n\
900 .text 0 :\n\
901 {\n\
902 *(.text)\n\
903 *(.stub)\n\
904 /* .gnu.warning sections are handled specially by elf32.em. */\n\
905 *(.gnu.warning)\n\
906 } =0\n\
907 .fini 0 : { *(.fini) } =0\n\
908 /* Adjust the address for the data segment. We want to adjust up to\n\
909 the same address within the page on the next page up. It would\n\
910 be more correct to do this:\n\
911 The current expression does not correctly handle the case of a\n\
912 text segment ending precisely at the end of a page; it causes the\n\
913 data segment to skip a page. The above expression does not have\n\
914 this problem, but it will currently (2/95) cause BFD to allocate\n\
915 a single segment, combining both text and data, for this case.\n\
916 This will prevent the text segment from being shared among\n\
917 multiple executions of the program; I think that is more\n\
918 important than losing a page of the virtual address space (note\n\
919 that no actual memory is lost; the page which is skipped can not\n\
920 be referenced). */\n\
921 .data 0 :\n\
922 {\n\
923 *(.data)\n\
924 }\n\
925 .data1 0 : { *(.data1) }\n\
926 .ctors 0 : { *(.ctors) }\n\
927 .dtors 0 : { *(.dtors) }\n\
928 .got 0 :\n\
929 {\n\
930 *(.got.plt) *(.got)\n\
931 }\n\
932 /* We want the small data sections together, so single-instruction offsets\n\
933 can access them all, and initialized data all before uninitialized, so\n\
934 we can shorten the on-disk segment size. */\n\
935 .sdata 0 : { *(.sdata) }\n\
936 .sbss 0 : { *(.sbss) *(.scommon) }\n\
937 .bss 0 :\n\
938 {\n\
939 *(.dynbss)\n\
940 *(.bss)\n\
941 *(COMMON)\n\
942 }\n\
943 /* These are needed for ELF backends which have not yet been\n\
944 converted to the new style linker. */\n\
945 .stab 0 : { *(.stab) }\n\
946 .stabstr 0 : { *(.stabstr) }\n\
947 /* DWARF debug sections.\n\
948 Symbols in the .debug DWARF section are relative to the beginning of the\n\
949 section so we begin .debug at 0. It's not clear yet what needs to happen\n\
950 for the others. */\n\
951 .debug 0 : { *(.debug) }\n\
952 .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
953 .debug_aranges 0 : { *(.debug_aranges) }\n\
954 .debug_pubnames 0 : { *(.debug_pubnames) }\n\
955 .debug_sfnames 0 : { *(.debug_sfnames) }\n\
956 .line 0 : { *(.line) }\n\
957 /* These must appear regardless of . */\n\
958 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
959 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
960 }\n\n";
961 else if (!config.text_read_only)
962 return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
963 \"elf32-littlemips\")\n\
964 OUTPUT_ARCH(mips)\n\
965 ENTRY(_start)\n\
966 SEARCH_DIR(/usr/local/mips-elf/lib);\n\
967 /* Do we need any of these for elf?\n\
968 __DYNAMIC = 0; */\n\
969 SECTIONS\n\
970 {\n\
971 /* Read-only sections, merged into text segment: */\n\
972 . = 0x0400000;\n\
973 .interp : { *(.interp) }\n\
974 .reginfo : { *(.reginfo) }\n\
975 .dynamic : { *(.dynamic) }\n\
976 .dynstr : { *(.dynstr) }\n\
977 .dynsym : { *(.dynsym) }\n\
978 .hash : { *(.hash) }\n\
979 .rel.text : { *(.rel.text) }\n\
980 .rela.text : { *(.rela.text) }\n\
981 .rel.data : { *(.rel.data) }\n\
982 .rela.data : { *(.rela.data) }\n\
983 .rel.rodata : { *(.rel.rodata) }\n\
984 .rela.rodata : { *(.rela.rodata) }\n\
985 .rel.got : { *(.rel.got) }\n\
986 .rela.got : { *(.rela.got) }\n\
987 .rel.ctors : { *(.rel.ctors) }\n\
988 .rela.ctors : { *(.rela.ctors) }\n\
989 .rel.dtors : { *(.rel.dtors) }\n\
990 .rela.dtors : { *(.rela.dtors) }\n\
991 .rel.init : { *(.rel.init) }\n\
992 .rela.init : { *(.rela.init) }\n\
993 .rel.fini : { *(.rel.fini) }\n\
994 .rela.fini : { *(.rela.fini) }\n\
995 .rel.bss : { *(.rel.bss) }\n\
996 .rela.bss : { *(.rela.bss) }\n\
997 .rel.plt : { *(.rel.plt) }\n\
998 .rela.plt : { *(.rela.plt) }\n\
999 .rodata : { *(.rodata) }\n\
1000 .rodata1 : { *(.rodata1) }\n\
1001 .init : { *(.init) } =0\n\
1002 .text :\n\
1003 {\n\
1004 _ftext = . ;\n\
1005 *(.text)\n\
1006 *(.stub)\n\
1007 /* .gnu.warning sections are handled specially by elf32.em. */\n\
1008 *(.gnu.warning)\n\
1009 } =0\n\
1010 _etext = .;\n\
1011 PROVIDE (etext = .);\n\
1012 .fini : { *(.fini) } =0\n\
1013 /* Adjust the address for the data segment. We want to adjust up to\n\
1014 the same address within the page on the next page up. It would\n\
1015 be more correct to do this:\n\
1016 . = .;\n\
1017 The current expression does not correctly handle the case of a\n\
1018 text segment ending precisely at the end of a page; it causes the\n\
1019 data segment to skip a page. The above expression does not have\n\
1020 this problem, but it will currently (2/95) cause BFD to allocate\n\
1021 a single segment, combining both text and data, for this case.\n\
1022 This will prevent the text segment from being shared among\n\
1023 multiple executions of the program; I think that is more\n\
1024 important than losing a page of the virtual address space (note\n\
1025 that no actual memory is lost; the page which is skipped can not\n\
1026 be referenced). */\n\
1027 . += . - 0x0400000;\n\
1028 .data :\n\
1029 {\n\
1030 _fdata = . ;\n\
1031 *(.data)\n\
1032 CONSTRUCTORS\n\
1033 }\n\
1034 .data1 : { *(.data1) }\n\
1035 .ctors : { *(.ctors) }\n\
1036 .dtors : { *(.dtors) }\n\
1037 _gp = ALIGN(16) + 0x7ff0;\n\
1038 .got :\n\
1039 {\n\
1040 *(.got.plt) *(.got)\n\
1041 }\n\
1042 /* We want the small data sections together, so single-instruction offsets\n\
1043 can access them all, and initialized data all before uninitialized, so\n\
1044 we can shorten the on-disk segment size. */\n\
1045 .sdata : { *(.sdata) }\n\
1046 .lit8 : { *(.lit8) }\n\
1047 .lit4 : { *(.lit4) }\n\
1048 _edata = .;\n\
1049 PROVIDE (edata = .);\n\
1050 __bss_start = .;\n\
1051 _fbss = .;\n\
1052 .sbss : { *(.sbss) *(.scommon) }\n\
1053 .bss :\n\
1054 {\n\
1055 *(.dynbss)\n\
1056 *(.bss)\n\
1057 *(COMMON)\n\
1058 }\n\
1059 _end = . ;\n\
1060 PROVIDE (end = .);\n\
1061 /* These are needed for ELF backends which have not yet been\n\
1062 converted to the new style linker. */\n\
1063 .stab 0 : { *(.stab) }\n\
1064 .stabstr 0 : { *(.stabstr) }\n\
1065 /* DWARF debug sections.\n\
1066 Symbols in the .debug DWARF section are relative to the beginning of the\n\
1067 section so we begin .debug at 0. It's not clear yet what needs to happen\n\
1068 for the others. */\n\
1069 .debug 0 : { *(.debug) }\n\
1070 .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
1071 .debug_aranges 0 : { *(.debug_aranges) }\n\
1072 .debug_pubnames 0 : { *(.debug_pubnames) }\n\
1073 .debug_sfnames 0 : { *(.debug_sfnames) }\n\
1074 .line 0 : { *(.line) }\n\
1075 /* These must appear regardless of . */\n\
1076 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
1077 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
1078 }\n\n";
1079 else if (!config.magic_demand_paged)
1080 return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
1081 \"elf32-littlemips\")\n\
1082 OUTPUT_ARCH(mips)\n\
1083 ENTRY(_start)\n\
1084 SEARCH_DIR(/usr/local/mips-elf/lib);\n\
1085 /* Do we need any of these for elf?\n\
1086 __DYNAMIC = 0; */\n\
1087 SECTIONS\n\
1088 {\n\
1089 /* Read-only sections, merged into text segment: */\n\
1090 . = 0x0400000;\n\
1091 .interp : { *(.interp) }\n\
1092 .reginfo : { *(.reginfo) }\n\
1093 .dynamic : { *(.dynamic) }\n\
1094 .dynstr : { *(.dynstr) }\n\
1095 .dynsym : { *(.dynsym) }\n\
1096 .hash : { *(.hash) }\n\
1097 .rel.text : { *(.rel.text) }\n\
1098 .rela.text : { *(.rela.text) }\n\
1099 .rel.data : { *(.rel.data) }\n\
1100 .rela.data : { *(.rela.data) }\n\
1101 .rel.rodata : { *(.rel.rodata) }\n\
1102 .rela.rodata : { *(.rela.rodata) }\n\
1103 .rel.got : { *(.rel.got) }\n\
1104 .rela.got : { *(.rela.got) }\n\
1105 .rel.ctors : { *(.rel.ctors) }\n\
1106 .rela.ctors : { *(.rela.ctors) }\n\
1107 .rel.dtors : { *(.rel.dtors) }\n\
1108 .rela.dtors : { *(.rela.dtors) }\n\
1109 .rel.init : { *(.rel.init) }\n\
1110 .rela.init : { *(.rela.init) }\n\
1111 .rel.fini : { *(.rel.fini) }\n\
1112 .rela.fini : { *(.rela.fini) }\n\
1113 .rel.bss : { *(.rel.bss) }\n\
1114 .rela.bss : { *(.rela.bss) }\n\
1115 .rel.plt : { *(.rel.plt) }\n\
1116 .rela.plt : { *(.rela.plt) }\n\
1117 .rodata : { *(.rodata) }\n\
1118 .rodata1 : { *(.rodata1) }\n\
1119 .init : { *(.init) } =0\n\
1120 .text :\n\
1121 {\n\
1122 _ftext = . ;\n\
1123 *(.text)\n\
1124 *(.stub)\n\
1125 /* .gnu.warning sections are handled specially by elf32.em. */\n\
1126 *(.gnu.warning)\n\
1127 } =0\n\
1128 _etext = .;\n\
1129 PROVIDE (etext = .);\n\
1130 .fini : { *(.fini) } =0\n\
1131 /* Adjust the address for the data segment. We want to adjust up to\n\
1132 the same address within the page on the next page up. It would\n\
1133 be more correct to do this:\n\
1134 . = 0x10000000;\n\
1135 The current expression does not correctly handle the case of a\n\
1136 text segment ending precisely at the end of a page; it causes the\n\
1137 data segment to skip a page. The above expression does not have\n\
1138 this problem, but it will currently (2/95) cause BFD to allocate\n\
1139 a single segment, combining both text and data, for this case.\n\
1140 This will prevent the text segment from being shared among\n\
1141 multiple executions of the program; I think that is more\n\
1142 important than losing a page of the virtual address space (note\n\
1143 that no actual memory is lost; the page which is skipped can not\n\
1144 be referenced). */\n\
1145 . += 0x10000000 - 0x0400000;\n\
1146 .data :\n\
1147 {\n\
1148 _fdata = . ;\n\
1149 *(.data)\n\
1150 CONSTRUCTORS\n\
1151 }\n\
1152 .data1 : { *(.data1) }\n\
1153 .ctors : { *(.ctors) }\n\
1154 .dtors : { *(.dtors) }\n\
1155 _gp = ALIGN(16) + 0x7ff0;\n\
1156 .got :\n\
1157 {\n\
1158 *(.got.plt) *(.got)\n\
1159 }\n\
1160 /* We want the small data sections together, so single-instruction offsets\n\
1161 can access them all, and initialized data all before uninitialized, so\n\
1162 we can shorten the on-disk segment size. */\n\
1163 .sdata : { *(.sdata) }\n\
1164 .lit8 : { *(.lit8) }\n\
1165 .lit4 : { *(.lit4) }\n\
1166 _edata = .;\n\
1167 PROVIDE (edata = .);\n\
1168 __bss_start = .;\n\
1169 _fbss = .;\n\
1170 .sbss : { *(.sbss) *(.scommon) }\n\
1171 .bss :\n\
1172 {\n\
1173 *(.dynbss)\n\
1174 *(.bss)\n\
1175 *(COMMON)\n\
1176 }\n\
1177 _end = . ;\n\
1178 PROVIDE (end = .);\n\
1179 /* These are needed for ELF backends which have not yet been\n\
1180 converted to the new style linker. */\n\
1181 .stab 0 : { *(.stab) }\n\
1182 .stabstr 0 : { *(.stabstr) }\n\
1183 /* DWARF debug sections.\n\
1184 Symbols in the .debug DWARF section are relative to the beginning of the\n\
1185 section so we begin .debug at 0. It's not clear yet what needs to happen\n\
1186 for the others. */\n\
1187 .debug 0 : { *(.debug) }\n\
1188 .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
1189 .debug_aranges 0 : { *(.debug_aranges) }\n\
1190 .debug_pubnames 0 : { *(.debug_pubnames) }\n\
1191 .debug_sfnames 0 : { *(.debug_sfnames) }\n\
1192 .line 0 : { *(.line) }\n\
1193 /* These must appear regardless of . */\n\
1194 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
1195 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
1196 }\n\n";
1197 else if (link_info.shared)
1198 return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
1199 \"elf32-littlemips\")\n\
1200 OUTPUT_ARCH(mips)\n\
1201 ENTRY(_start)\n\
1202 SEARCH_DIR(/usr/local/mips-elf/lib);\n\
1203 /* Do we need any of these for elf?\n\
1204 __DYNAMIC = 0; */\n\
1205 SECTIONS\n\
1206 {\n\
1207 /* Read-only sections, merged into text segment: */\n\
1208 . = 0x5ffe0000 + SIZEOF_HEADERS;\n\
1209 .reginfo : { *(.reginfo) }\n\
1210 .dynamic : { *(.dynamic) }\n\
1211 .dynstr : { *(.dynstr) }\n\
1212 .dynsym : { *(.dynsym) }\n\
1213 .hash : { *(.hash) }\n\
1214 .rel.text : { *(.rel.text) }\n\
1215 .rela.text : { *(.rela.text) }\n\
1216 .rel.data : { *(.rel.data) }\n\
1217 .rela.data : { *(.rela.data) }\n\
1218 .rel.rodata : { *(.rel.rodata) }\n\
1219 .rela.rodata : { *(.rela.rodata) }\n\
1220 .rel.got : { *(.rel.got) }\n\
1221 .rela.got : { *(.rela.got) }\n\
1222 .rel.ctors : { *(.rel.ctors) }\n\
1223 .rela.ctors : { *(.rela.ctors) }\n\
1224 .rel.dtors : { *(.rel.dtors) }\n\
1225 .rela.dtors : { *(.rela.dtors) }\n\
1226 .rel.init : { *(.rel.init) }\n\
1227 .rela.init : { *(.rela.init) }\n\
1228 .rel.fini : { *(.rel.fini) }\n\
1229 .rela.fini : { *(.rela.fini) }\n\
1230 .rel.bss : { *(.rel.bss) }\n\
1231 .rela.bss : { *(.rela.bss) }\n\
1232 .rel.plt : { *(.rel.plt) }\n\
1233 .rela.plt : { *(.rela.plt) }\n\
1234 .rodata : { *(.rodata) }\n\
1235 .rodata1 : { *(.rodata1) }\n\
1236 .init : { *(.init) } =0\n\
1237 .text :\n\
1238 {\n\
1239 *(.text)\n\
1240 *(.stub)\n\
1241 /* .gnu.warning sections are handled specially by elf32.em. */\n\
1242 *(.gnu.warning)\n\
1243 } =0\n\
1244 .fini : { *(.fini) } =0\n\
1245 /* Adjust the address for the data segment. We want to adjust up to\n\
1246 the same address within the page on the next page up. It would\n\
1247 be more correct to do this:\n\
1248 . = 0x10000000;\n\
1249 The current expression does not correctly handle the case of a\n\
1250 text segment ending precisely at the end of a page; it causes the\n\
1251 data segment to skip a page. The above expression does not have\n\
1252 this problem, but it will currently (2/95) cause BFD to allocate\n\
1253 a single segment, combining both text and data, for this case.\n\
1254 This will prevent the text segment from being shared among\n\
1255 multiple executions of the program; I think that is more\n\
1256 important than losing a page of the virtual address space (note\n\
1257 that no actual memory is lost; the page which is skipped can not\n\
1258 be referenced). */\n\
1259 . += 0x10000;\n\
1260 .data :\n\
1261 {\n\
1262 *(.data)\n\
1263 CONSTRUCTORS\n\
1264 }\n\
1265 .data1 : { *(.data1) }\n\
1266 .ctors : { *(.ctors) }\n\
1267 .dtors : { *(.dtors) }\n\
1268 _gp = ALIGN(16) + 0x7ff0;\n\
1269 .got :\n\
1270 {\n\
1271 *(.got.plt) *(.got)\n\
1272 }\n\
1273 /* We want the small data sections together, so single-instruction offsets\n\
1274 can access them all, and initialized data all before uninitialized, so\n\
1275 we can shorten the on-disk segment size. */\n\
1276 .sdata : { *(.sdata) }\n\
1277 .lit8 : { *(.lit8) }\n\
1278 .lit4 : { *(.lit4) }\n\
1279 .sbss : { *(.sbss) *(.scommon) }\n\
1280 .bss :\n\
1281 {\n\
1282 *(.dynbss)\n\
1283 *(.bss)\n\
1284 *(COMMON)\n\
1285 }\n\
1286 /* These are needed for ELF backends which have not yet been\n\
1287 converted to the new style linker. */\n\
1288 .stab 0 : { *(.stab) }\n\
1289 .stabstr 0 : { *(.stabstr) }\n\
1290 /* DWARF debug sections.\n\
1291 Symbols in the .debug DWARF section are relative to the beginning of the\n\
1292 section so we begin .debug at 0. It's not clear yet what needs to happen\n\
1293 for the others. */\n\
1294 .debug 0 : { *(.debug) }\n\
1295 .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
1296 .debug_aranges 0 : { *(.debug_aranges) }\n\
1297 .debug_pubnames 0 : { *(.debug_pubnames) }\n\
1298 .debug_sfnames 0 : { *(.debug_sfnames) }\n\
1299 .line 0 : { *(.line) }\n\
1300 /* These must appear regardless of . */\n\
1301 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
1302 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
1303 }\n\n";
1304 else
1305 return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
1306 \"elf32-littlemips\")\n\
1307 OUTPUT_ARCH(mips)\n\
1308 ENTRY(_start)\n\
1309 SEARCH_DIR(/usr/local/mips-elf/lib);\n\
1310 /* Do we need any of these for elf?\n\
1311 __DYNAMIC = 0; */\n\
1312 SECTIONS\n\
1313 {\n\
1314 /* Read-only sections, merged into text segment: */\n\
1315 . = 0x0400000;\n\
1316 .interp : { *(.interp) }\n\
1317 .reginfo : { *(.reginfo) }\n\
1318 .dynamic : { *(.dynamic) }\n\
1319 .dynstr : { *(.dynstr) }\n\
1320 .dynsym : { *(.dynsym) }\n\
1321 .hash : { *(.hash) }\n\
1322 .rel.text : { *(.rel.text) }\n\
1323 .rela.text : { *(.rela.text) }\n\
1324 .rel.data : { *(.rel.data) }\n\
1325 .rela.data : { *(.rela.data) }\n\
1326 .rel.rodata : { *(.rel.rodata) }\n\
1327 .rela.rodata : { *(.rela.rodata) }\n\
1328 .rel.got : { *(.rel.got) }\n\
1329 .rela.got : { *(.rela.got) }\n\
1330 .rel.ctors : { *(.rel.ctors) }\n\
1331 .rela.ctors : { *(.rela.ctors) }\n\
1332 .rel.dtors : { *(.rel.dtors) }\n\
1333 .rela.dtors : { *(.rela.dtors) }\n\
1334 .rel.init : { *(.rel.init) }\n\
1335 .rela.init : { *(.rela.init) }\n\
1336 .rel.fini : { *(.rel.fini) }\n\
1337 .rela.fini : { *(.rela.fini) }\n\
1338 .rel.bss : { *(.rel.bss) }\n\
1339 .rela.bss : { *(.rela.bss) }\n\
1340 .rel.plt : { *(.rel.plt) }\n\
1341 .rela.plt : { *(.rela.plt) }\n\
1342 .rodata : { *(.rodata) }\n\
1343 .rodata1 : { *(.rodata1) }\n\
1344 .init : { *(.init) } =0\n\
1345 .text :\n\
1346 {\n\
1347 _ftext = . ;\n\
1348 *(.text)\n\
1349 *(.stub)\n\
1350 /* .gnu.warning sections are handled specially by elf32.em. */\n\
1351 *(.gnu.warning)\n\
1352 } =0\n\
1353 _etext = .;\n\
1354 PROVIDE (etext = .);\n\
1355 .fini : { *(.fini) } =0\n\
1356 /* Adjust the address for the data segment. We want to adjust up to\n\
1357 the same address within the page on the next page up. It would\n\
1358 be more correct to do this:\n\
1359 . = 0x10000000;\n\
1360 The current expression does not correctly handle the case of a\n\
1361 text segment ending precisely at the end of a page; it causes the\n\
1362 data segment to skip a page. The above expression does not have\n\
1363 this problem, but it will currently (2/95) cause BFD to allocate\n\
1364 a single segment, combining both text and data, for this case.\n\
1365 This will prevent the text segment from being shared among\n\
1366 multiple executions of the program; I think that is more\n\
1367 important than losing a page of the virtual address space (note\n\
1368 that no actual memory is lost; the page which is skipped can not\n\
1369 be referenced). */\n\
1370 . += 0x10000000 - 0x0400000;\n\
1371 .data :\n\
1372 {\n\
1373 _fdata = . ;\n\
1374 *(.data)\n\
1375 CONSTRUCTORS\n\
1376 }\n\
1377 .data1 : { *(.data1) }\n\
1378 .ctors : { *(.ctors) }\n\
1379 .dtors : { *(.dtors) }\n\
1380 _gp = ALIGN(16) + 0x7ff0;\n\
1381 .got :\n\
1382 {\n\
1383 *(.got.plt) *(.got)\n\
1384 }\n\
1385 /* We want the small data sections together, so single-instruction offsets\n\
1386 can access them all, and initialized data all before uninitialized, so\n\
1387 we can shorten the on-disk segment size. */\n\
1388 .sdata : { *(.sdata) }\n\
1389 .lit8 : { *(.lit8) }\n\
1390 .lit4 : { *(.lit4) }\n\
1391 _edata = .;\n\
1392 PROVIDE (edata = .);\n\
1393 __bss_start = .;\n\
1394 _fbss = .;\n\
1395 .sbss : { *(.sbss) *(.scommon) }\n\
1396 .bss :\n\
1397 {\n\
1398 *(.dynbss)\n\
1399 *(.bss)\n\
1400 *(COMMON)\n\
1401 }\n\
1402 _end = . ;\n\
1403 PROVIDE (end = .);\n\
1404 /* These are needed for ELF backends which have not yet been\n\
1405 converted to the new style linker. */\n\
1406 .stab 0 : { *(.stab) }\n\
1407 .stabstr 0 : { *(.stabstr) }\n\
1408 /* DWARF debug sections.\n\
1409 Symbols in the .debug DWARF section are relative to the beginning of the\n\
1410 section so we begin .debug at 0. It's not clear yet what needs to happen\n\
1411 for the others. */\n\
1412 .debug 0 : { *(.debug) }\n\
1413 .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
1414 .debug_aranges 0 : { *(.debug_aranges) }\n\
1415 .debug_pubnames 0 : { *(.debug_pubnames) }\n\
1416 .debug_sfnames 0 : { *(.debug_sfnames) }\n\
1417 .line 0 : { *(.line) }\n\
1418 /* These must appear regardless of . */\n\
1419 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
1420 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
1421 }\n\n";
1424 struct ld_emulation_xfer_struct ld_elf32ebmip_emulation =
1426 gldelf32ebmip_before_parse,
1427 syslib_default,
1428 hll_default,
1429 after_parse_default,
1430 gldelf32ebmip_after_open,
1431 after_allocation_default,
1432 set_output_arch_default,
1433 ldemul_default_target,
1434 gldelf32ebmip_before_allocation,
1435 gldelf32ebmip_get_script,
1436 "elf32ebmip",
1437 "elf32-bigmips",
1438 NULL,
1439 NULL,
1440 gldelf32ebmip_open_dynamic_archive,
1441 gldelf32ebmip_place_orphan