1 /* This file is is generated by a shell script. DO NOT EDIT! */
3 /* 32 bit ELF emulation code for elf32ebmip
4 Copyright (C) 1991, 93, 94, 95, 1996, 1998 Free Software Foundation, Inc.
5 Written by Steve Chamberlain <sac@cygnus.com>
6 ELF support by Ian Lance Taylor <ian@cygnus.com>
8 This file is part of GLD, the Gnu Linker.
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.
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.
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. */
24 #define TARGET_IS_elf32ebmip
42 static void gldelf32ebmip_before_parse PARAMS ((void));
43 static boolean gldelf32ebmip_open_dynamic_archive
44 PARAMS ((const char *, search_dirs_type *, lang_input_statement_type *));
45 static void gldelf32ebmip_after_open PARAMS ((void));
46 static void gldelf32ebmip_check_needed
47 PARAMS ((lang_input_statement_type *));
48 static void gldelf32ebmip_stat_needed
49 PARAMS ((lang_input_statement_type *));
50 static boolean gldelf32ebmip_search_needed
51 PARAMS ((const char *, const char *));
52 static boolean gldelf32ebmip_try_needed PARAMS ((const char *));
53 static void gldelf32ebmip_before_allocation PARAMS ((void));
54 static void gldelf32ebmip_find_statement_assignment
55 PARAMS ((lang_statement_union_type *));
56 static void gldelf32ebmip_find_exp_assignment PARAMS ((etree_type *));
57 static boolean gldelf32ebmip_place_orphan
58 PARAMS ((lang_input_statement_type *, asection *));
59 static void gldelf32ebmip_place_section
60 PARAMS ((lang_statement_union_type *));
61 static char *gldelf32ebmip_get_script PARAMS ((int *isfile));
64 gldelf32ebmip_before_parse()
66 ldfile_output_architecture = bfd_arch_mips;
67 config.dynamic_link = true;
70 /* Try to open a dynamic archive. This is where we know that ELF
71 dynamic libraries have an extension of .so. */
74 gldelf32ebmip_open_dynamic_archive (arch, search, entry)
76 search_dirs_type *search;
77 lang_input_statement_type *entry;
82 if (! entry->is_archive)
85 filename = entry->filename;
87 string = (char *) xmalloc (strlen (search->name)
92 sprintf (string, "%s/lib%s%s.so", search->name, filename, arch);
94 if (! ldfile_try_open_bfd (string, entry))
100 entry->filename = string;
102 /* We have found a dynamic object to include in the link. The ELF
103 backend linker will create a DT_NEEDED entry in the .dynamic
104 section naming this file. If this file includes a DT_SONAME
105 entry, it will be used. Otherwise, the ELF linker will just use
106 the name of the file. For an archive found by searching, like
107 this one, the DT_NEEDED entry should consist of just the name of
108 the file, without the path information used to find it. Note
109 that we only need to do this if we have a dynamic object; an
110 archive will never be referenced by a DT_NEEDED entry.
112 FIXME: This approach--using bfd_elf_set_dt_needed_name--is not
113 very pretty. I haven't been able to think of anything that is
115 if (bfd_check_format (entry->the_bfd, bfd_object)
116 && (entry->the_bfd->flags & DYNAMIC) != 0)
120 ASSERT (entry->is_archive && entry->search_dirs_flag);
121 needed_name = (char *) xmalloc (strlen (filename)
124 sprintf (needed_name, "lib%s%s.so", filename, arch);
125 bfd_elf_set_dt_needed_name (entry->the_bfd, needed_name);
132 /* These variables are required to pass information back and forth
133 between after_open and check_needed and stat_needed. */
135 static struct bfd_link_needed_list *global_needed;
136 static struct stat global_stat;
137 static boolean global_found;
139 /* This is called after all the input files have been opened. */
142 gldelf32ebmip_after_open ()
144 struct bfd_link_needed_list *needed, *l;
146 /* We only need to worry about this when doing a final link. */
147 if (link_info.relocateable || link_info.shared)
150 /* Get the list of files which appear in DT_NEEDED entries in
151 dynamic objects included in the link (often there will be none).
152 For each such file, we want to track down the corresponding
153 library, and include the symbol table in the link. This is what
154 the runtime dynamic linker will do. Tracking the files down here
155 permits one dynamic object to include another without requiring
156 special action by the person doing the link. Note that the
157 needed list can actually grow while we are stepping through this
159 needed = bfd_elf_get_needed_list (output_bfd, &link_info);
160 for (l = needed; l != NULL; l = l->next)
162 struct bfd_link_needed_list *ll;
163 const char *lib_path;
165 search_dirs_type *search;
167 /* If we've already seen this file, skip it. */
168 for (ll = needed; ll != l; ll = ll->next)
169 if (strcmp (ll->name, l->name) == 0)
174 /* See if this file was included in the link explicitly. */
176 global_found = false;
177 lang_for_each_input_file (gldelf32ebmip_check_needed);
181 /* We need to find this file and include the symbol table. We
182 want to search for the file in the same way that the dynamic
183 linker will search. That means that we want to use
184 rpath_link, rpath, then the environment variable
185 LD_LIBRARY_PATH (native only), then the linker script
186 LIB_SEARCH_DIRS. We do not search using the -L arguments. */
187 if (gldelf32ebmip_search_needed (command_line.rpath_link,
190 if (gldelf32ebmip_search_needed (command_line.rpath, l->name))
192 if (command_line.rpath_link == NULL
193 && command_line.rpath == NULL)
195 lib_path = (const char *) getenv ("LD_RUN_PATH");
196 if (gldelf32ebmip_search_needed (lib_path, l->name))
199 len = strlen (l->name);
200 for (search = search_head; search != NULL; search = search->next)
206 filename = (char *) xmalloc (strlen (search->name) + len + 2);
207 sprintf (filename, "%s/%s", search->name, l->name);
208 if (gldelf32ebmip_try_needed (filename))
215 einfo (_("%P: warning: %s, needed by %B, not found\n"),
220 /* Search for a needed file in a path. */
223 gldelf32ebmip_search_needed (path, name)
230 if (path == NULL || *path == '\0')
235 char *filename, *sset;
237 s = strchr (path, ':');
239 s = path + strlen (path);
241 filename = (char *) xmalloc (s - path + len + 2);
246 memcpy (filename, path, s - path);
247 filename[s - path] = '/';
248 sset = filename + (s - path) + 1;
252 if (gldelf32ebmip_try_needed (filename))
265 /* This function is called for each possible name for a dynamic object
266 named by a DT_NEEDED entry. */
269 gldelf32ebmip_try_needed (name)
274 abfd = bfd_openr (name, bfd_get_target (output_bfd));
277 if (! bfd_check_format (abfd, bfd_object))
279 (void) bfd_close (abfd);
282 if ((bfd_get_file_flags (abfd) & DYNAMIC) == 0)
284 (void) bfd_close (abfd);
288 /* We've found a dynamic object matching the DT_NEEDED entry. */
290 /* We have already checked that there is no other input file of the
291 same name. We must now check again that we are not including the
292 same file twice. We need to do this because on many systems
293 libc.so is a symlink to, e.g., libc.so.1. The SONAME entry will
294 reference libc.so.1. If we have already included libc.so, we
295 don't want to include libc.so.1 if they are the same file, and we
296 can only check that using stat. */
298 if (bfd_stat (abfd, &global_stat) != 0)
299 einfo (_("%F%P:%B: bfd_stat failed: %E\n"), abfd);
300 global_found = false;
301 lang_for_each_input_file (gldelf32ebmip_stat_needed);
304 /* Return true to indicate that we found the file, even though
305 we aren't going to do anything with it. */
309 /* Tell the ELF backend that don't want the output file to have a
310 DT_NEEDED entry for this file. */
311 bfd_elf_set_dt_needed_name (abfd, "");
313 /* Add this file into the symbol table. */
314 if (! bfd_link_add_symbols (abfd, &link_info))
315 einfo (_("%F%B: could not read symbols: %E\n"), abfd);
320 /* See if an input file matches a DT_NEEDED entry by name. */
323 gldelf32ebmip_check_needed (s)
324 lang_input_statement_type *s;
329 if (s->filename != NULL
330 && strcmp (s->filename, global_needed->name) == 0)
336 if (s->the_bfd != NULL)
340 soname = bfd_elf_get_dt_soname (s->the_bfd);
342 && strcmp (soname, global_needed->name) == 0)
349 if (s->search_dirs_flag
350 && s->filename != NULL
351 && strchr (global_needed->name, '/') == NULL)
355 f = strrchr (s->filename, '/');
357 && strcmp (f + 1, global_needed->name) == 0)
365 /* See if an input file matches a DT_NEEDED entry by running stat on
369 gldelf32ebmip_stat_needed (s)
370 lang_input_statement_type *s;
379 if (s->the_bfd == NULL)
382 if (bfd_stat (s->the_bfd, &st) != 0)
384 einfo (_("%P:%B: bfd_stat failed: %E\n"), s->the_bfd);
388 if (st.st_dev == global_stat.st_dev
389 && st.st_ino == global_stat.st_ino)
395 /* We issue a warning if it looks like we are including two
396 different versions of the same shared library. For example,
397 there may be a problem if -lc picks up libc.so.6 but some other
398 shared library has a DT_NEEDED entry of libc.so.5. This is a
399 hueristic test, and it will only work if the name looks like
400 NAME.so.VERSION. FIXME: Depending on file names is error-prone.
401 If we really want to issue warnings about mixing version numbers
402 of shared libraries, we need to find a better way. */
404 if (strchr (global_needed->name, '/') != NULL)
406 suffix = strstr (global_needed->name, ".so.");
409 suffix += sizeof ".so." - 1;
411 soname = bfd_elf_get_dt_soname (s->the_bfd);
413 soname = s->filename;
415 f = strrchr (soname, '/');
421 if (strncmp (f, global_needed->name, suffix - global_needed->name) == 0)
422 einfo (_("%P: warning: %s, needed by %B, may conflict with %s\n"),
423 global_needed->name, global_needed->by, f);
426 /* This is called after the sections have been attached to output
427 sections, but before any sizes or addresses have been set. */
430 gldelf32ebmip_before_allocation ()
435 /* If we are going to make any variable assignments, we need to let
436 the ELF backend know about them in case the variables are
437 referred to by dynamic objects. */
438 lang_for_each_statement (gldelf32ebmip_find_statement_assignment);
440 /* Let the ELF backend work out the sizes of any sections required
441 by dynamic linking. */
442 rpath = command_line.rpath;
444 rpath = (const char *) getenv ("LD_RUN_PATH");
445 if (! bfd_elf32_size_dynamic_sections (output_bfd,
448 command_line.export_dynamic,
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
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)
474 if (is->just_syms_flag)
477 s = bfd_get_section_by_name (is->the_bfd, ".gnu.warning");
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"),
487 ret = link_info.callbacks->warning (&link_info, msg,
489 is->the_bfd, (asection *) NULL,
494 /* Clobber the section size, so that we don't waste copying the
495 warning into the output file. */
500 #if defined (TARGET_IS_elf32bmip) || defined (TARGET_IS_elf32lmip)
501 /* For MIPS ELF the .reginfo section requires special handling.
502 Each input section is 24 bytes, and the final output section must
503 also be 24 bytes. We handle this by clobbering all but the first
504 input section size to 0. The .reginfo section is handled
505 specially by the backend code anyhow. */
507 boolean found = false;
508 LANG_FOR_EACH_INPUT_STATEMENT (is)
512 if (is->just_syms_flag)
515 s = bfd_get_section_by_name (is->the_bfd, ".reginfo");
532 /* This is called by the before_allocation routine via
533 lang_for_each_statement. It locates any assignment statements, and
534 tells the ELF backend about them, in case they are assignments to
535 symbols which are referred to by dynamic objects. */
538 gldelf32ebmip_find_statement_assignment (s)
539 lang_statement_union_type *s;
541 if (s->header.type == lang_assignment_statement_enum)
542 gldelf32ebmip_find_exp_assignment (s->assignment_statement.exp);
545 /* Look through an expression for an assignment statement. */
548 gldelf32ebmip_find_exp_assignment (exp)
551 struct bfd_link_hash_entry *h;
553 switch (exp->type.node_class)
556 h = bfd_link_hash_lookup (link_info.hash, exp->assign.dst,
557 false, false, false);
561 /* We call record_link_assignment even if the symbol is defined.
562 This is because if it is defined by a dynamic object, we
563 actually want to use the value defined by the linker script,
564 not the value from the dynamic object (because we are setting
565 symbols like etext). If the symbol is defined by a regular
566 object, then, as it happens, calling record_link_assignment
571 if (strcmp (exp->assign.dst, ".") != 0)
573 if (! (bfd_elf32_record_link_assignment
574 (output_bfd, &link_info, exp->assign.dst,
575 exp->type.node_class == etree_provide ? true : false)))
576 einfo (_("%P%F: failed to record assignment to %s: %E\n"),
579 gldelf32ebmip_find_exp_assignment (exp->assign.src);
583 gldelf32ebmip_find_exp_assignment (exp->binary.lhs);
584 gldelf32ebmip_find_exp_assignment (exp->binary.rhs);
588 gldelf32ebmip_find_exp_assignment (exp->trinary.cond);
589 gldelf32ebmip_find_exp_assignment (exp->trinary.lhs);
590 gldelf32ebmip_find_exp_assignment (exp->trinary.rhs);
594 gldelf32ebmip_find_exp_assignment (exp->unary.child);
602 /* Place an orphan section. We use this to put random SHF_ALLOC
603 sections in the right segment. */
605 static asection *hold_section;
606 static lang_output_section_statement_type *hold_use;
607 static lang_output_section_statement_type *hold_text;
608 static lang_output_section_statement_type *hold_rodata;
609 static lang_output_section_statement_type *hold_data;
610 static lang_output_section_statement_type *hold_bss;
611 static lang_output_section_statement_type *hold_rel;
615 gldelf32ebmip_place_orphan (file, s)
616 lang_input_statement_type *file;
619 lang_output_section_statement_type *place;
620 asection *snew, **pps;
621 lang_statement_list_type *old;
622 lang_statement_list_type add;
624 const char *secname, *ps;
625 lang_output_section_statement_type *os;
627 if ((s->flags & SEC_ALLOC) == 0)
630 /* Look through the script to see where to place this section. */
633 lang_for_each_statement (gldelf32ebmip_place_section);
635 if (hold_use != NULL)
637 /* We have already placed a section with this name. */
638 wild_doit (&hold_use->children, s, hold_use, file);
642 secname = bfd_get_section_name (s->owner, s);
644 /* If this is a final link, then always put .gnu.warning.SYMBOL
645 sections into the .text section to get them out of the way. */
646 if (! link_info.shared
647 && ! link_info.relocateable
648 && strncmp (secname, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0
649 && hold_text != NULL)
651 wild_doit (&hold_text->children, s, hold_text, file);
655 /* Decide which segment the section should go in based on the
656 section name and section flags. */
658 if ((s->flags & SEC_HAS_CONTENTS) == 0
661 else if ((s->flags & SEC_READONLY) == 0
662 && hold_data != NULL)
664 else if (strncmp (secname, ".rel", 4) == 0
667 else if ((s->flags & SEC_CODE) == 0
668 && (s->flags & SEC_READONLY) != 0
669 && hold_rodata != NULL)
671 else if ((s->flags & SEC_READONLY) != 0
672 && hold_text != NULL)
677 /* Create the section in the output file, and put it in the right
678 place. This shuffling is to make the output file look neater. */
679 snew = bfd_make_section (output_bfd, secname);
681 einfo (_("%P%F: output format %s cannot represent section called %s\n"),
682 output_bfd->xvec->name, secname);
683 if (place->bfd_section != NULL)
685 for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next)
688 snew->next = place->bfd_section->next;
689 place->bfd_section->next = snew;
692 /* Start building a list of statements for this section. */
695 lang_list_init (stat_ptr);
697 /* If the name of the section is representable in C, then create
698 symbols to mark the start and the end of the section. */
699 for (ps = secname; *ps != '\0'; ps++)
700 if (! isalnum (*ps) && *ps != '_')
702 if (*ps == '\0' && config.build_constructors)
706 symname = (char *) xmalloc (ps - secname + sizeof "__start_");
707 sprintf (symname, "__start_%s", secname);
708 lang_add_assignment (exp_assop ('=', symname,
710 exp_intop ((bfd_vma) 1
711 << s->alignment_power))));
714 if (! link_info.relocateable)
717 address = exp_intop ((bfd_vma) 0);
719 lang_enter_output_section_statement (secname, address, 0,
723 (etree_type *) NULL);
725 os = lang_output_section_statement_lookup (secname);
726 wild_doit (&os->children, s, os, file);
728 lang_leave_output_section_statement ((bfd_vma) 0, "*default*");
731 if (*ps == '\0' && config.build_constructors)
735 symname = (char *) xmalloc (ps - secname + sizeof "__stop_");
736 sprintf (symname, "__stop_%s", secname);
737 lang_add_assignment (exp_assop ('=', symname,
738 exp_nameop (NAME, ".")));
741 /* Now stick the new statement list right after PLACE. */
742 *add.tail = place->header.next;
743 place->header.next = add.head;
751 gldelf32ebmip_place_section (s)
752 lang_statement_union_type *s;
754 lang_output_section_statement_type *os;
756 if (s->header.type != lang_output_section_statement_enum)
759 os = &s->output_section_statement;
761 if (strcmp (os->name, hold_section->name) == 0)
764 if (strcmp (os->name, ".text") == 0)
766 else if (strcmp (os->name, ".rodata") == 0)
768 else if (strcmp (os->name, ".data") == 0)
770 else if (strcmp (os->name, ".bss") == 0)
772 else if (hold_rel == NULL
773 && os->bfd_section != NULL
774 && strncmp (os->name, ".rel", 4) == 0)
779 gldelf32ebmip_get_script(isfile)
784 if (link_info.relocateable == true && config.build_constructors == true)
785 return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
786 \"elf32-littlemips\")\n\
789 /* For some reason, the Solaris linker makes bad executables\n\
790 if gld -r is used and the intermediate file has sections starting\n\
791 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld\n\
792 bug. But for now assigning the zero vmas works. */\n\
795 /* Read-only sections, merged into text segment: */\n\
796 .interp 0 : { *(.interp) }\n\
797 .reginfo 0 : { *(.reginfo) }\n\
798 .dynamic 0 : { *(.dynamic) }\n\
799 .dynstr 0 : { *(.dynstr) }\n\
800 .dynsym 0 : { *(.dynsym) }\n\
801 .hash 0 : { *(.hash) }\n\
802 .rel.text 0 : { *(.rel.text) }\n\
803 .rela.text 0 : { *(.rela.text) }\n\
804 .rel.data 0 : { *(.rel.data) }\n\
805 .rela.data 0 : { *(.rela.data) }\n\
806 .rel.rodata 0 : { *(.rel.rodata) }\n\
807 .rela.rodata 0 : { *(.rela.rodata) }\n\
808 .rel.got 0 : { *(.rel.got) }\n\
809 .rela.got 0 : { *(.rela.got) }\n\
810 .rel.ctors 0 : { *(.rel.ctors) }\n\
811 .rela.ctors 0 : { *(.rela.ctors) }\n\
812 .rel.dtors 0 : { *(.rel.dtors) }\n\
813 .rela.dtors 0 : { *(.rela.dtors) }\n\
814 .rel.init 0 : { *(.rel.init) }\n\
815 .rela.init 0 : { *(.rela.init) }\n\
816 .rel.fini 0 : { *(.rel.fini) }\n\
817 .rela.fini 0 : { *(.rela.fini) }\n\
818 .rel.bss 0 : { *(.rel.bss) }\n\
819 .rela.bss 0 : { *(.rela.bss) }\n\
820 .rel.plt 0 : { *(.rel.plt) }\n\
821 .rela.plt 0 : { *(.rela.plt) }\n\
822 .rodata 0 : { *(.rodata) }\n\
823 .rodata1 0 : { *(.rodata1) }\n\
824 .init 0 : { *(.init) } =0\n\
829 /* .gnu.warning sections are handled specially by elf32.em. */\n\
832 .fini 0 : { *(.fini) } =0\n\
833 /* Adjust the address for the data segment. We want to adjust up to\n\
834 the same address within the page on the next page up. It would\n\
835 be more correct to do this:\n\
836 The current expression does not correctly handle the case of a\n\
837 text segment ending precisely at the end of a page; it causes the\n\
838 data segment to skip a page. The above expression does not have\n\
839 this problem, but it will currently (2/95) cause BFD to allocate\n\
840 a single segment, combining both text and data, for this case.\n\
841 This will prevent the text segment from being shared among\n\
842 multiple executions of the program; I think that is more\n\
843 important than losing a page of the virtual address space (note\n\
844 that no actual memory is lost; the page which is skipped can not\n\
845 be referenced). */\n\
851 .data1 0 : { *(.data1) }\n\
852 .ctors 0 : { *(.ctors) }\n\
853 .dtors 0 : { *(.dtors) }\n\
856 *(.got.plt) *(.got)\n\
858 /* We want the small data sections together, so single-instruction offsets\n\
859 can access them all, and initialized data all before uninitialized, so\n\
860 we can shorten the on-disk segment size. */\n\
861 .sdata 0 : { *(.sdata) }\n\
862 .sbss 0 : { *(.sbss) *(.scommon) }\n\
869 /* These are needed for ELF backends which have not yet been\n\
870 converted to the new style linker. */\n\
871 .stab 0 : { *(.stab) }\n\
872 .stabstr 0 : { *(.stabstr) }\n\
873 /* DWARF debug sections.\n\
874 Symbols in the .debug DWARF section are relative to the beginning of the\n\
875 section so we begin .debug at 0. It's not clear yet what needs to happen\n\
876 for the others. */\n\
877 .debug 0 : { *(.debug) }\n\
878 .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
879 .debug_aranges 0 : { *(.debug_aranges) }\n\
880 .debug_pubnames 0 : { *(.debug_pubnames) }\n\
881 .debug_sfnames 0 : { *(.debug_sfnames) }\n\
882 .line 0 : { *(.line) }\n\
883 /* These must appear regardless of . */\n\
884 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
885 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
887 else if (link_info.relocateable == true)
888 return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
889 \"elf32-littlemips\")\n\
892 /* For some reason, the Solaris linker makes bad executables\n\
893 if gld -r is used and the intermediate file has sections starting\n\
894 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld\n\
895 bug. But for now assigning the zero vmas works. */\n\
898 /* Read-only sections, merged into text segment: */\n\
899 .interp 0 : { *(.interp) }\n\
900 .reginfo 0 : { *(.reginfo) }\n\
901 .dynamic 0 : { *(.dynamic) }\n\
902 .dynstr 0 : { *(.dynstr) }\n\
903 .dynsym 0 : { *(.dynsym) }\n\
904 .hash 0 : { *(.hash) }\n\
905 .rel.text 0 : { *(.rel.text) }\n\
906 .rela.text 0 : { *(.rela.text) }\n\
907 .rel.data 0 : { *(.rel.data) }\n\
908 .rela.data 0 : { *(.rela.data) }\n\
909 .rel.rodata 0 : { *(.rel.rodata) }\n\
910 .rela.rodata 0 : { *(.rela.rodata) }\n\
911 .rel.got 0 : { *(.rel.got) }\n\
912 .rela.got 0 : { *(.rela.got) }\n\
913 .rel.ctors 0 : { *(.rel.ctors) }\n\
914 .rela.ctors 0 : { *(.rela.ctors) }\n\
915 .rel.dtors 0 : { *(.rel.dtors) }\n\
916 .rela.dtors 0 : { *(.rela.dtors) }\n\
917 .rel.init 0 : { *(.rel.init) }\n\
918 .rela.init 0 : { *(.rela.init) }\n\
919 .rel.fini 0 : { *(.rel.fini) }\n\
920 .rela.fini 0 : { *(.rela.fini) }\n\
921 .rel.bss 0 : { *(.rel.bss) }\n\
922 .rela.bss 0 : { *(.rela.bss) }\n\
923 .rel.plt 0 : { *(.rel.plt) }\n\
924 .rela.plt 0 : { *(.rela.plt) }\n\
925 .rodata 0 : { *(.rodata) }\n\
926 .rodata1 0 : { *(.rodata1) }\n\
927 .init 0 : { *(.init) } =0\n\
932 /* .gnu.warning sections are handled specially by elf32.em. */\n\
935 .fini 0 : { *(.fini) } =0\n\
936 /* Adjust the address for the data segment. We want to adjust up to\n\
937 the same address within the page on the next page up. It would\n\
938 be more correct to do this:\n\
939 The current expression does not correctly handle the case of a\n\
940 text segment ending precisely at the end of a page; it causes the\n\
941 data segment to skip a page. The above expression does not have\n\
942 this problem, but it will currently (2/95) cause BFD to allocate\n\
943 a single segment, combining both text and data, for this case.\n\
944 This will prevent the text segment from being shared among\n\
945 multiple executions of the program; I think that is more\n\
946 important than losing a page of the virtual address space (note\n\
947 that no actual memory is lost; the page which is skipped can not\n\
948 be referenced). */\n\
953 .data1 0 : { *(.data1) }\n\
954 .ctors 0 : { *(.ctors) }\n\
955 .dtors 0 : { *(.dtors) }\n\
958 *(.got.plt) *(.got)\n\
960 /* We want the small data sections together, so single-instruction offsets\n\
961 can access them all, and initialized data all before uninitialized, so\n\
962 we can shorten the on-disk segment size. */\n\
963 .sdata 0 : { *(.sdata) }\n\
964 .sbss 0 : { *(.sbss) *(.scommon) }\n\
971 /* These are needed for ELF backends which have not yet been\n\
972 converted to the new style linker. */\n\
973 .stab 0 : { *(.stab) }\n\
974 .stabstr 0 : { *(.stabstr) }\n\
975 /* DWARF debug sections.\n\
976 Symbols in the .debug DWARF section are relative to the beginning of the\n\
977 section so we begin .debug at 0. It's not clear yet what needs to happen\n\
978 for the others. */\n\
979 .debug 0 : { *(.debug) }\n\
980 .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
981 .debug_aranges 0 : { *(.debug_aranges) }\n\
982 .debug_pubnames 0 : { *(.debug_pubnames) }\n\
983 .debug_sfnames 0 : { *(.debug_sfnames) }\n\
984 .line 0 : { *(.line) }\n\
985 /* These must appear regardless of . */\n\
986 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
987 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
989 else if (!config.text_read_only)
990 return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
991 \"elf32-littlemips\")\n\
994 SEARCH_DIR(/usr/local/mips-elf/lib);\n\
995 /* Do we need any of these for elf?\n\
999 /* Read-only sections, merged into text segment: */\n\
1001 .interp : { *(.interp) }\n\
1002 .reginfo : { *(.reginfo) }\n\
1003 .dynamic : { *(.dynamic) }\n\
1004 .dynstr : { *(.dynstr) }\n\
1005 .dynsym : { *(.dynsym) }\n\
1006 .hash : { *(.hash) }\n\
1007 .rel.text : { *(.rel.text) }\n\
1008 .rela.text : { *(.rela.text) }\n\
1009 .rel.data : { *(.rel.data) }\n\
1010 .rela.data : { *(.rela.data) }\n\
1011 .rel.rodata : { *(.rel.rodata) }\n\
1012 .rela.rodata : { *(.rela.rodata) }\n\
1013 .rel.got : { *(.rel.got) }\n\
1014 .rela.got : { *(.rela.got) }\n\
1015 .rel.ctors : { *(.rel.ctors) }\n\
1016 .rela.ctors : { *(.rela.ctors) }\n\
1017 .rel.dtors : { *(.rel.dtors) }\n\
1018 .rela.dtors : { *(.rela.dtors) }\n\
1019 .rel.init : { *(.rel.init) }\n\
1020 .rela.init : { *(.rela.init) }\n\
1021 .rel.fini : { *(.rel.fini) }\n\
1022 .rela.fini : { *(.rela.fini) }\n\
1023 .rel.bss : { *(.rel.bss) }\n\
1024 .rela.bss : { *(.rela.bss) }\n\
1025 .rel.plt : { *(.rel.plt) }\n\
1026 .rela.plt : { *(.rela.plt) }\n\
1027 .rodata : { *(.rodata) }\n\
1028 .rodata1 : { *(.rodata1) }\n\
1029 .init : { *(.init) } =0\n\
1035 /* .gnu.warning sections are handled specially by elf32.em. */\n\
1039 PROVIDE (etext = .);\n\
1040 .fini : { *(.fini) } =0\n\
1041 /* Adjust the address for the data segment. We want to adjust up to\n\
1042 the same address within the page on the next page up. It would\n\
1043 be more correct to do this:\n\
1045 The current expression does not correctly handle the case of a\n\
1046 text segment ending precisely at the end of a page; it causes the\n\
1047 data segment to skip a page. The above expression does not have\n\
1048 this problem, but it will currently (2/95) cause BFD to allocate\n\
1049 a single segment, combining both text and data, for this case.\n\
1050 This will prevent the text segment from being shared among\n\
1051 multiple executions of the program; I think that is more\n\
1052 important than losing a page of the virtual address space (note\n\
1053 that no actual memory is lost; the page which is skipped can not\n\
1054 be referenced). */\n\
1055 . += . - 0x0400000;\n\
1062 .data1 : { *(.data1) }\n\
1063 .ctors : { *(.ctors) }\n\
1064 .dtors : { *(.dtors) }\n\
1065 _gp = ALIGN(16) + 0x7ff0;\n\
1068 *(.got.plt) *(.got)\n\
1070 /* We want the small data sections together, so single-instruction offsets\n\
1071 can access them all, and initialized data all before uninitialized, so\n\
1072 we can shorten the on-disk segment size. */\n\
1073 .sdata : { *(.sdata) }\n\
1074 .lit8 : { *(.lit8) }\n\
1075 .lit4 : { *(.lit4) }\n\
1077 PROVIDE (edata = .);\n\
1080 .sbss : { *(.sbss) *(.scommon) }\n\
1088 PROVIDE (end = .);\n\
1089 /* These are needed for ELF backends which have not yet been\n\
1090 converted to the new style linker. */\n\
1091 .stab 0 : { *(.stab) }\n\
1092 .stabstr 0 : { *(.stabstr) }\n\
1093 /* DWARF debug sections.\n\
1094 Symbols in the .debug DWARF section are relative to the beginning of the\n\
1095 section so we begin .debug at 0. It's not clear yet what needs to happen\n\
1096 for the others. */\n\
1097 .debug 0 : { *(.debug) }\n\
1098 .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
1099 .debug_aranges 0 : { *(.debug_aranges) }\n\
1100 .debug_pubnames 0 : { *(.debug_pubnames) }\n\
1101 .debug_sfnames 0 : { *(.debug_sfnames) }\n\
1102 .line 0 : { *(.line) }\n\
1103 /* These must appear regardless of . */\n\
1104 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
1105 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
1107 else if (!config.magic_demand_paged)
1108 return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
1109 \"elf32-littlemips\")\n\
1110 OUTPUT_ARCH(mips)\n\
1112 SEARCH_DIR(/usr/local/mips-elf/lib);\n\
1113 /* Do we need any of these for elf?\n\
1114 __DYNAMIC = 0; */\n\
1117 /* Read-only sections, merged into text segment: */\n\
1119 .interp : { *(.interp) }\n\
1120 .reginfo : { *(.reginfo) }\n\
1121 .dynamic : { *(.dynamic) }\n\
1122 .dynstr : { *(.dynstr) }\n\
1123 .dynsym : { *(.dynsym) }\n\
1124 .hash : { *(.hash) }\n\
1125 .rel.text : { *(.rel.text) }\n\
1126 .rela.text : { *(.rela.text) }\n\
1127 .rel.data : { *(.rel.data) }\n\
1128 .rela.data : { *(.rela.data) }\n\
1129 .rel.rodata : { *(.rel.rodata) }\n\
1130 .rela.rodata : { *(.rela.rodata) }\n\
1131 .rel.got : { *(.rel.got) }\n\
1132 .rela.got : { *(.rela.got) }\n\
1133 .rel.ctors : { *(.rel.ctors) }\n\
1134 .rela.ctors : { *(.rela.ctors) }\n\
1135 .rel.dtors : { *(.rel.dtors) }\n\
1136 .rela.dtors : { *(.rela.dtors) }\n\
1137 .rel.init : { *(.rel.init) }\n\
1138 .rela.init : { *(.rela.init) }\n\
1139 .rel.fini : { *(.rel.fini) }\n\
1140 .rela.fini : { *(.rela.fini) }\n\
1141 .rel.bss : { *(.rel.bss) }\n\
1142 .rela.bss : { *(.rela.bss) }\n\
1143 .rel.plt : { *(.rel.plt) }\n\
1144 .rela.plt : { *(.rela.plt) }\n\
1145 .rodata : { *(.rodata) }\n\
1146 .rodata1 : { *(.rodata1) }\n\
1147 .init : { *(.init) } =0\n\
1153 /* .gnu.warning sections are handled specially by elf32.em. */\n\
1157 PROVIDE (etext = .);\n\
1158 .fini : { *(.fini) } =0\n\
1159 /* Adjust the address for the data segment. We want to adjust up to\n\
1160 the same address within the page on the next page up. It would\n\
1161 be more correct to do this:\n\
1163 The current expression does not correctly handle the case of a\n\
1164 text segment ending precisely at the end of a page; it causes the\n\
1165 data segment to skip a page. The above expression does not have\n\
1166 this problem, but it will currently (2/95) cause BFD to allocate\n\
1167 a single segment, combining both text and data, for this case.\n\
1168 This will prevent the text segment from being shared among\n\
1169 multiple executions of the program; I think that is more\n\
1170 important than losing a page of the virtual address space (note\n\
1171 that no actual memory is lost; the page which is skipped can not\n\
1172 be referenced). */\n\
1173 . += 0x10000000 - 0x0400000;\n\
1180 .data1 : { *(.data1) }\n\
1181 .ctors : { *(.ctors) }\n\
1182 .dtors : { *(.dtors) }\n\
1183 _gp = ALIGN(16) + 0x7ff0;\n\
1186 *(.got.plt) *(.got)\n\
1188 /* We want the small data sections together, so single-instruction offsets\n\
1189 can access them all, and initialized data all before uninitialized, so\n\
1190 we can shorten the on-disk segment size. */\n\
1191 .sdata : { *(.sdata) }\n\
1192 .lit8 : { *(.lit8) }\n\
1193 .lit4 : { *(.lit4) }\n\
1195 PROVIDE (edata = .);\n\
1198 .sbss : { *(.sbss) *(.scommon) }\n\
1206 PROVIDE (end = .);\n\
1207 /* These are needed for ELF backends which have not yet been\n\
1208 converted to the new style linker. */\n\
1209 .stab 0 : { *(.stab) }\n\
1210 .stabstr 0 : { *(.stabstr) }\n\
1211 /* DWARF debug sections.\n\
1212 Symbols in the .debug DWARF section are relative to the beginning of the\n\
1213 section so we begin .debug at 0. It's not clear yet what needs to happen\n\
1214 for the others. */\n\
1215 .debug 0 : { *(.debug) }\n\
1216 .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
1217 .debug_aranges 0 : { *(.debug_aranges) }\n\
1218 .debug_pubnames 0 : { *(.debug_pubnames) }\n\
1219 .debug_sfnames 0 : { *(.debug_sfnames) }\n\
1220 .line 0 : { *(.line) }\n\
1221 /* These must appear regardless of . */\n\
1222 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
1223 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
1225 else if (link_info.shared)
1226 return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
1227 \"elf32-littlemips\")\n\
1228 OUTPUT_ARCH(mips)\n\
1230 SEARCH_DIR(/usr/local/mips-elf/lib);\n\
1231 /* Do we need any of these for elf?\n\
1232 __DYNAMIC = 0; */\n\
1235 /* Read-only sections, merged into text segment: */\n\
1236 . = 0x5ffe0000 + SIZEOF_HEADERS;\n\
1237 .reginfo : { *(.reginfo) }\n\
1238 .dynamic : { *(.dynamic) }\n\
1239 .dynstr : { *(.dynstr) }\n\
1240 .dynsym : { *(.dynsym) }\n\
1241 .hash : { *(.hash) }\n\
1242 .rel.text : { *(.rel.text) }\n\
1243 .rela.text : { *(.rela.text) }\n\
1244 .rel.data : { *(.rel.data) }\n\
1245 .rela.data : { *(.rela.data) }\n\
1246 .rel.rodata : { *(.rel.rodata) }\n\
1247 .rela.rodata : { *(.rela.rodata) }\n\
1248 .rel.got : { *(.rel.got) }\n\
1249 .rela.got : { *(.rela.got) }\n\
1250 .rel.ctors : { *(.rel.ctors) }\n\
1251 .rela.ctors : { *(.rela.ctors) }\n\
1252 .rel.dtors : { *(.rel.dtors) }\n\
1253 .rela.dtors : { *(.rela.dtors) }\n\
1254 .rel.init : { *(.rel.init) }\n\
1255 .rela.init : { *(.rela.init) }\n\
1256 .rel.fini : { *(.rel.fini) }\n\
1257 .rela.fini : { *(.rela.fini) }\n\
1258 .rel.bss : { *(.rel.bss) }\n\
1259 .rela.bss : { *(.rela.bss) }\n\
1260 .rel.plt : { *(.rel.plt) }\n\
1261 .rela.plt : { *(.rela.plt) }\n\
1262 .rodata : { *(.rodata) }\n\
1263 .rodata1 : { *(.rodata1) }\n\
1264 .init : { *(.init) } =0\n\
1269 /* .gnu.warning sections are handled specially by elf32.em. */\n\
1272 .fini : { *(.fini) } =0\n\
1273 /* Adjust the address for the data segment. We want to adjust up to\n\
1274 the same address within the page on the next page up. It would\n\
1275 be more correct to do this:\n\
1277 The current expression does not correctly handle the case of a\n\
1278 text segment ending precisely at the end of a page; it causes the\n\
1279 data segment to skip a page. The above expression does not have\n\
1280 this problem, but it will currently (2/95) cause BFD to allocate\n\
1281 a single segment, combining both text and data, for this case.\n\
1282 This will prevent the text segment from being shared among\n\
1283 multiple executions of the program; I think that is more\n\
1284 important than losing a page of the virtual address space (note\n\
1285 that no actual memory is lost; the page which is skipped can not\n\
1286 be referenced). */\n\
1293 .data1 : { *(.data1) }\n\
1294 .ctors : { *(.ctors) }\n\
1295 .dtors : { *(.dtors) }\n\
1296 _gp = ALIGN(16) + 0x7ff0;\n\
1299 *(.got.plt) *(.got)\n\
1301 /* We want the small data sections together, so single-instruction offsets\n\
1302 can access them all, and initialized data all before uninitialized, so\n\
1303 we can shorten the on-disk segment size. */\n\
1304 .sdata : { *(.sdata) }\n\
1305 .lit8 : { *(.lit8) }\n\
1306 .lit4 : { *(.lit4) }\n\
1307 .sbss : { *(.sbss) *(.scommon) }\n\
1314 /* These are needed for ELF backends which have not yet been\n\
1315 converted to the new style linker. */\n\
1316 .stab 0 : { *(.stab) }\n\
1317 .stabstr 0 : { *(.stabstr) }\n\
1318 /* DWARF debug sections.\n\
1319 Symbols in the .debug DWARF section are relative to the beginning of the\n\
1320 section so we begin .debug at 0. It's not clear yet what needs to happen\n\
1321 for the others. */\n\
1322 .debug 0 : { *(.debug) }\n\
1323 .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
1324 .debug_aranges 0 : { *(.debug_aranges) }\n\
1325 .debug_pubnames 0 : { *(.debug_pubnames) }\n\
1326 .debug_sfnames 0 : { *(.debug_sfnames) }\n\
1327 .line 0 : { *(.line) }\n\
1328 /* These must appear regardless of . */\n\
1329 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
1330 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
1333 return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
1334 \"elf32-littlemips\")\n\
1335 OUTPUT_ARCH(mips)\n\
1337 SEARCH_DIR(/usr/local/mips-elf/lib);\n\
1338 /* Do we need any of these for elf?\n\
1339 __DYNAMIC = 0; */\n\
1342 /* Read-only sections, merged into text segment: */\n\
1344 .interp : { *(.interp) }\n\
1345 .reginfo : { *(.reginfo) }\n\
1346 .dynamic : { *(.dynamic) }\n\
1347 .dynstr : { *(.dynstr) }\n\
1348 .dynsym : { *(.dynsym) }\n\
1349 .hash : { *(.hash) }\n\
1350 .rel.text : { *(.rel.text) }\n\
1351 .rela.text : { *(.rela.text) }\n\
1352 .rel.data : { *(.rel.data) }\n\
1353 .rela.data : { *(.rela.data) }\n\
1354 .rel.rodata : { *(.rel.rodata) }\n\
1355 .rela.rodata : { *(.rela.rodata) }\n\
1356 .rel.got : { *(.rel.got) }\n\
1357 .rela.got : { *(.rela.got) }\n\
1358 .rel.ctors : { *(.rel.ctors) }\n\
1359 .rela.ctors : { *(.rela.ctors) }\n\
1360 .rel.dtors : { *(.rel.dtors) }\n\
1361 .rela.dtors : { *(.rela.dtors) }\n\
1362 .rel.init : { *(.rel.init) }\n\
1363 .rela.init : { *(.rela.init) }\n\
1364 .rel.fini : { *(.rel.fini) }\n\
1365 .rela.fini : { *(.rela.fini) }\n\
1366 .rel.bss : { *(.rel.bss) }\n\
1367 .rela.bss : { *(.rela.bss) }\n\
1368 .rel.plt : { *(.rel.plt) }\n\
1369 .rela.plt : { *(.rela.plt) }\n\
1370 .rodata : { *(.rodata) }\n\
1371 .rodata1 : { *(.rodata1) }\n\
1372 .init : { *(.init) } =0\n\
1378 /* .gnu.warning sections are handled specially by elf32.em. */\n\
1382 PROVIDE (etext = .);\n\
1383 .fini : { *(.fini) } =0\n\
1384 /* Adjust the address for the data segment. We want to adjust up to\n\
1385 the same address within the page on the next page up. It would\n\
1386 be more correct to do this:\n\
1388 The current expression does not correctly handle the case of a\n\
1389 text segment ending precisely at the end of a page; it causes the\n\
1390 data segment to skip a page. The above expression does not have\n\
1391 this problem, but it will currently (2/95) cause BFD to allocate\n\
1392 a single segment, combining both text and data, for this case.\n\
1393 This will prevent the text segment from being shared among\n\
1394 multiple executions of the program; I think that is more\n\
1395 important than losing a page of the virtual address space (note\n\
1396 that no actual memory is lost; the page which is skipped can not\n\
1397 be referenced). */\n\
1398 . += 0x10000000 - 0x0400000;\n\
1405 .data1 : { *(.data1) }\n\
1406 .ctors : { *(.ctors) }\n\
1407 .dtors : { *(.dtors) }\n\
1408 _gp = ALIGN(16) + 0x7ff0;\n\
1411 *(.got.plt) *(.got)\n\
1413 /* We want the small data sections together, so single-instruction offsets\n\
1414 can access them all, and initialized data all before uninitialized, so\n\
1415 we can shorten the on-disk segment size. */\n\
1416 .sdata : { *(.sdata) }\n\
1417 .lit8 : { *(.lit8) }\n\
1418 .lit4 : { *(.lit4) }\n\
1420 PROVIDE (edata = .);\n\
1423 .sbss : { *(.sbss) *(.scommon) }\n\
1431 PROVIDE (end = .);\n\
1432 /* These are needed for ELF backends which have not yet been\n\
1433 converted to the new style linker. */\n\
1434 .stab 0 : { *(.stab) }\n\
1435 .stabstr 0 : { *(.stabstr) }\n\
1436 /* DWARF debug sections.\n\
1437 Symbols in the .debug DWARF section are relative to the beginning of the\n\
1438 section so we begin .debug at 0. It's not clear yet what needs to happen\n\
1439 for the others. */\n\
1440 .debug 0 : { *(.debug) }\n\
1441 .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
1442 .debug_aranges 0 : { *(.debug_aranges) }\n\
1443 .debug_pubnames 0 : { *(.debug_pubnames) }\n\
1444 .debug_sfnames 0 : { *(.debug_sfnames) }\n\
1445 .line 0 : { *(.line) }\n\
1446 /* These must appear regardless of . */\n\
1447 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
1448 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
1452 struct ld_emulation_xfer_struct ld_elf32ebmip_emulation =
1454 gldelf32ebmip_before_parse,
1457 after_parse_default,
1458 gldelf32ebmip_after_open,
1459 after_allocation_default,
1460 set_output_arch_default,
1461 ldemul_default_target,
1462 gldelf32ebmip_before_allocation,
1463 gldelf32ebmip_get_script,
1468 gldelf32ebmip_open_dynamic_archive,
1469 gldelf32ebmip_place_orphan