aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-04-28 12:05:07 +0000
committerAlan Modra <amodra@gmail.com>2002-04-28 12:05:07 +0000
commit596dafeba1d6ceb806e44de11b3a0d2800d81465 (patch)
tree983eaeb6a89b5ade3eda58c321cf4715194b13da /ld
parent2f2f1ad1fe8522e90d082262eec02d17b9db67d3 (diff)
downloadgdb-596dafeba1d6ceb806e44de11b3a0d2800d81465.zip
gdb-596dafeba1d6ceb806e44de11b3a0d2800d81465.tar.gz
gdb-596dafeba1d6ceb806e44de11b3a0d2800d81465.tar.bz2
* Makefile.am (mpw): New maintainer mode rule to make mpw-*.c files.
* Makefile.in: Regenerate. * mpw-elfmips.c: Delete. * mpw-eppcmac.c: Delete. * mpw-esh.c: Delete. * mpw-idtmips.c: Delete.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/Makefile.am23
-rw-r--r--ld/Makefile.in23
-rw-r--r--ld/mpw-elfmips.c1441
-rw-r--r--ld/mpw-eppcmac.c1224
-rw-r--r--ld/mpw-esh.c318
-rw-r--r--ld/mpw-idtmips.c433
7 files changed, 55 insertions, 3416 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 9ec7c8e..f074b07 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2002-04-28 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (mpw): New maintainer mode rule to make mpw-*.c files.
+ * Makefile.in: Regenerate.
+ * mpw-elfmips.c: Delete.
+ * mpw-eppcmac.c: Delete.
+ * mpw-esh.c: Delete.
+ * mpw-idtmips.c: Delete.
+
Wed Apr 17 19:23:14 2002 J"orn Rennecke <joern.rennecke@superh.com>
* emulparams/shelf32.sh (MACHINE): Now sh5.
diff --git a/ld/Makefile.am b/ld/Makefile.am
index a8486af..4dbc1f4 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -1202,6 +1202,29 @@ dep-am: DEP
.PHONY: dep dep-in dep-am
+@MAINT@.PHONY: mpw
+@MAINT@mpw: $(srcdir)/mpw-ei386go32.c $(srcdir)/mpw-elfmips.c \
+@MAINT@ $(srcdir)/mpw-em68kcoff.c $(srcdir)/mpw-eppcmac.c \
+@MAINT@ $(srcdir)/mpw-esh.c $(srcdir)/mpw-idtmips.c
+@MAINT@
+@MAINT@$(srcdir)/mpw-ei386go32.c: ei386go32.c
+@MAINT@ $(srcdir)/../move-if-change $< $@
+@MAINT@
+@MAINT@$(srcdir)/mpw-elfmips.c: eelf32ebmip.c
+@MAINT@ $(srcdir)/../move-if-change $< $@
+@MAINT@
+@MAINT@$(srcdir)/mpw-em68kcoff.c: em68kcoff.c
+@MAINT@ $(srcdir)/../move-if-change $< $@
+@MAINT@
+@MAINT@$(srcdir)/mpw-eppcmac.c: eppcmacos.c
+@MAINT@ $(srcdir)/../move-if-change $< $@
+@MAINT@
+@MAINT@$(srcdir)/mpw-esh.c: esh.c
+@MAINT@ $(srcdir)/../move-if-change $< $@
+@MAINT@
+@MAINT@$(srcdir)/mpw-idtmips.c: emipsidt.c
+@MAINT@ $(srcdir)/../move-if-change $< $@
+
# What appears below is generated by a hacked mkdep using gcc -MM.
# DO NOT DELETE THIS LINE -- mkdep uses it.
diff --git a/ld/Makefile.in b/ld/Makefile.in
index b4b1597..213628b 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -1897,6 +1897,29 @@ dep-am: DEP
.PHONY: dep dep-in dep-am
+@MAINT@.PHONY: mpw
+@MAINT@mpw: $(srcdir)/mpw-ei386go32.c $(srcdir)/mpw-elfmips.c \
+@MAINT@ $(srcdir)/mpw-em68kcoff.c $(srcdir)/mpw-eppcmac.c \
+@MAINT@ $(srcdir)/mpw-esh.c $(srcdir)/mpw-idtmips.c
+@MAINT@
+@MAINT@$(srcdir)/mpw-ei386go32.c: ei386go32.c
+@MAINT@ $(srcdir)/../move-if-change $< $@
+@MAINT@
+@MAINT@$(srcdir)/mpw-elfmips.c: eelf32ebmip.c
+@MAINT@ $(srcdir)/../move-if-change $< $@
+@MAINT@
+@MAINT@$(srcdir)/mpw-em68kcoff.c: em68kcoff.c
+@MAINT@ $(srcdir)/../move-if-change $< $@
+@MAINT@
+@MAINT@$(srcdir)/mpw-eppcmac.c: eppcmacos.c
+@MAINT@ $(srcdir)/../move-if-change $< $@
+@MAINT@
+@MAINT@$(srcdir)/mpw-esh.c: esh.c
+@MAINT@ $(srcdir)/../move-if-change $< $@
+@MAINT@
+@MAINT@$(srcdir)/mpw-idtmips.c: emipsidt.c
+@MAINT@ $(srcdir)/../move-if-change $< $@
+
# What appears below is generated by a hacked mkdep using gcc -MM.
# DO NOT DELETE THIS LINE -- mkdep uses it.
diff --git a/ld/mpw-elfmips.c b/ld/mpw-elfmips.c
deleted file mode 100644
index 70ceecd..0000000
--- a/ld/mpw-elfmips.c
+++ /dev/null
@@ -1,1441 +0,0 @@
-/* This file is is generated by a shell script. DO NOT EDIT! */
-
-/* 32 bit ELF emulation code for elf32ebmip
- Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001
- Free Software Foundation, Inc.
- Written by Steve Chamberlain <sac@cygnus.com>
- ELF support by Ian Lance Taylor <ian@cygnus.com>
-
-This file is part of GLD, the Gnu Linker.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGET_IS_elf32ebmip
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "safe-ctype.h"
-
-#include "bfdlink.h"
-
-#include "ld.h"
-#include "ldmain.h"
-#include "ldmisc.h"
-#include "ldexp.h"
-#include "ldlang.h"
-#include "ldgram.h"
-#include "ldfile.h"
-#include "ldemul.h"
-
-static void gldelf32ebmip_before_parse PARAMS ((void));
-static boolean gldelf32ebmip_open_dynamic_archive
- PARAMS ((const char *, search_dirs_type *, lang_input_statement_type *));
-static void gldelf32ebmip_after_open PARAMS ((void));
-static void gldelf32ebmip_check_needed
- PARAMS ((lang_input_statement_type *));
-static void gldelf32ebmip_stat_needed
- PARAMS ((lang_input_statement_type *));
-static boolean gldelf32ebmip_search_needed
- PARAMS ((const char *, const char *));
-static boolean gldelf32ebmip_try_needed PARAMS ((const char *));
-static void gldelf32ebmip_before_allocation PARAMS ((void));
-static void gldelf32ebmip_find_statement_assignment
- PARAMS ((lang_statement_union_type *));
-static void gldelf32ebmip_find_exp_assignment PARAMS ((etree_type *));
-static boolean gldelf32ebmip_place_orphan
- PARAMS ((lang_input_statement_type *, asection *));
-static void gldelf32ebmip_place_section
- PARAMS ((lang_statement_union_type *));
-static char *gldelf32ebmip_get_script PARAMS ((int *isfile));
-
-static void
-gldelf32ebmip_before_parse()
-{
- ldfile_output_architecture = bfd_arch_mips;
- config.dynamic_link = true;
-}
-
-/* Try to open a dynamic archive. This is where we know that ELF
- dynamic libraries have an extension of .so. */
-
-static boolean
-gldelf32ebmip_open_dynamic_archive (arch, search, entry)
- const char *arch;
- search_dirs_type *search;
- lang_input_statement_type *entry;
-{
- const char *filename;
- char *string;
-
- if (! entry->is_archive)
- return false;
-
- filename = entry->filename;
-
- string = (char *) xmalloc (strlen (search->name)
- + strlen (filename)
- + strlen (arch)
- + sizeof "/lib.so");
-
- sprintf (string, "%s/lib%s%s.so", search->name, filename, arch);
-
- if (! ldfile_try_open_bfd (string, entry))
- {
- free (string);
- return false;
- }
-
- entry->filename = string;
-
- /* We have found a dynamic object to include in the link. The ELF
- backend linker will create a DT_NEEDED entry in the .dynamic
- section naming this file. If this file includes a DT_SONAME
- entry, it will be used. Otherwise, the ELF linker will just use
- the name of the file. For an archive found by searching, like
- this one, the DT_NEEDED entry should consist of just the name of
- the file, without the path information used to find it. Note
- that we only need to do this if we have a dynamic object; an
- archive will never be referenced by a DT_NEEDED entry.
-
- FIXME: This approach--using bfd_elf_set_dt_needed_name--is not
- very pretty. I haven't been able to think of anything that is
- pretty, though. */
- if (bfd_check_format (entry->the_bfd, bfd_object)
- && (entry->the_bfd->flags & DYNAMIC) != 0)
- {
- char *needed_name;
-
- ASSERT (entry->is_archive && entry->search_dirs_flag);
- needed_name = (char *) xmalloc (strlen (filename)
- + strlen (arch)
- + sizeof "lib.so");
- sprintf (needed_name, "lib%s%s.so", filename, arch);
- bfd_elf_set_dt_needed_name (entry->the_bfd, needed_name);
- }
-
- return true;
-}
-
-
-/* These variables are required to pass information back and forth
- between after_open and check_needed and stat_needed. */
-
-static struct bfd_link_needed_list *global_needed;
-static struct stat global_stat;
-static boolean global_found;
-
-/* This is called after all the input files have been opened. */
-
-static void
-gldelf32ebmip_after_open ()
-{
- struct bfd_link_needed_list *needed, *l;
-
- /* We only need to worry about this when doing a final link. */
- if (link_info.relocateable || link_info.shared)
- return;
-
- /* Get the list of files which appear in DT_NEEDED entries in
- dynamic objects included in the link (often there will be none).
- For each such file, we want to track down the corresponding
- library, and include the symbol table in the link. This is what
- the runtime dynamic linker will do. Tracking the files down here
- permits one dynamic object to include another without requiring
- special action by the person doing the link. Note that the
- needed list can actually grow while we are stepping through this
- loop. */
- needed = bfd_elf_get_needed_list (output_bfd, &link_info);
- for (l = needed; l != NULL; l = l->next)
- {
- struct bfd_link_needed_list *ll;
- const char *lib_path;
- size_t len;
- search_dirs_type *search;
-
- /* If we've already seen this file, skip it. */
- for (ll = needed; ll != l; ll = ll->next)
- if (strcmp (ll->name, l->name) == 0)
- break;
- if (ll != l)
- continue;
-
- /* See if this file was included in the link explicitly. */
- global_needed = l;
- global_found = false;
- lang_for_each_input_file (gldelf32ebmip_check_needed);
- if (global_found)
- continue;
-
- /* We need to find this file and include the symbol table. We
- want to search for the file in the same way that the dynamic
- linker will search. That means that we want to use
- rpath_link, rpath, then the environment variable
- LD_LIBRARY_PATH (native only), then the linker script
- LIB_SEARCH_DIRS. We do not search using the -L arguments. */
- if (gldelf32ebmip_search_needed (command_line.rpath_link,
- l->name))
- continue;
- if (gldelf32ebmip_search_needed (command_line.rpath, l->name))
- continue;
- if (command_line.rpath_link == NULL
- && command_line.rpath == NULL)
- {
- lib_path = (const char *) getenv ("LD_RUN_PATH");
- if (gldelf32ebmip_search_needed (lib_path, l->name))
- continue;
- }
- len = strlen (l->name);
- for (search = search_head; search != NULL; search = search->next)
- {
- char *filename;
-
- if (search->cmdline)
- continue;
- filename = (char *) xmalloc (strlen (search->name) + len + 2);
- sprintf (filename, "%s/%s", search->name, l->name);
- if (gldelf32ebmip_try_needed (filename))
- break;
- free (filename);
- }
- if (search != NULL)
- continue;
-
- einfo (_("%P: warning: %s, needed by %B, not found\n"),
- l->name, l->by);
- }
-}
-
-/* Search for a needed file in a path. */
-
-static boolean
-gldelf32ebmip_search_needed (path, name)
- const char *path;
- const char *name;
-{
- const char *s;
- size_t len;
-
- if (path == NULL || *path == '\0')
- return false;
- len = strlen (name);
- while (1)
- {
- char *filename, *sset;
-
- s = strchr (path, ':');
- if (s == NULL)
- s = path + strlen (path);
-
- filename = (char *) xmalloc (s - path + len + 2);
- if (s == path)
- sset = filename;
- else
- {
- memcpy (filename, path, s - path);
- filename[s - path] = '/';
- sset = filename + (s - path) + 1;
- }
- strcpy (sset, name);
-
- if (gldelf32ebmip_try_needed (filename))
- return true;
-
- free (filename);
-
- if (*s == '\0')
- break;
- path = s + 1;
- }
-
- return false;
-}
-
-/* This function is called for each possible name for a dynamic object
- named by a DT_NEEDED entry. */
-
-static boolean
-gldelf32ebmip_try_needed (name)
- const char *name;
-{
- bfd *abfd;
-
- abfd = bfd_openr (name, bfd_get_target (output_bfd));
- if (abfd == NULL)
- return false;
- if (! bfd_check_format (abfd, bfd_object))
- {
- (void) bfd_close (abfd);
- return false;
- }
- if ((bfd_get_file_flags (abfd) & DYNAMIC) == 0)
- {
- (void) bfd_close (abfd);
- return false;
- }
-
- /* We've found a dynamic object matching the DT_NEEDED entry. */
-
- /* We have already checked that there is no other input file of the
- same name. We must now check again that we are not including the
- same file twice. We need to do this because on many systems
- libc.so is a symlink to, e.g., libc.so.1. The SONAME entry will
- reference libc.so.1. If we have already included libc.so, we
- don't want to include libc.so.1 if they are the same file, and we
- can only check that using stat. */
-
- if (bfd_stat (abfd, &global_stat) != 0)
- einfo (_("%F%P:%B: bfd_stat failed: %E\n"), abfd);
- global_found = false;
- lang_for_each_input_file (gldelf32ebmip_stat_needed);
- if (global_found)
- {
- /* Return true to indicate that we found the file, even though
- we aren't going to do anything with it. */
- return true;
- }
-
- /* Tell the ELF backend that don't want the output file to have a
- DT_NEEDED entry for this file. */
- bfd_elf_set_dt_needed_name (abfd, "");
-
- /* Add this file into the symbol table. */
- if (! bfd_link_add_symbols (abfd, &link_info))
- einfo (_("%F%B: could not read symbols: %E\n"), abfd);
-
- return true;
-}
-
-/* See if an input file matches a DT_NEEDED entry by name. */
-
-static void
-gldelf32ebmip_check_needed (s)
- lang_input_statement_type *s;
-{
- if (global_found)
- return;
-
- if (s->filename != NULL
- && strcmp (s->filename, global_needed->name) == 0)
- {
- global_found = true;
- return;
- }
-
- if (s->the_bfd != NULL)
- {
- const char *soname;
-
- soname = bfd_elf_get_dt_soname (s->the_bfd);
- if (soname != NULL
- && strcmp (soname, global_needed->name) == 0)
- {
- global_found = true;
- return;
- }
- }
-
- if (s->search_dirs_flag
- && s->filename != NULL
- && strchr (global_needed->name, '/') == NULL)
- {
- const char *f;
-
- f = strrchr (s->filename, '/');
- if (f != NULL
- && strcmp (f + 1, global_needed->name) == 0)
- {
- global_found = true;
- return;
- }
- }
-}
-
-/* See if an input file matches a DT_NEEDED entry by running stat on
- the file. */
-
-static void
-gldelf32ebmip_stat_needed (s)
- lang_input_statement_type *s;
-{
- struct stat st;
- const char *suffix;
- const char *soname;
- const char *f;
-
- if (global_found)
- return;
- if (s->the_bfd == NULL)
- return;
-
- if (bfd_stat (s->the_bfd, &st) != 0)
- {
- einfo (_("%P:%B: bfd_stat failed: %E\n"), s->the_bfd);
- return;
- }
-
- if (st.st_dev == global_stat.st_dev
- && st.st_ino == global_stat.st_ino)
- {
- global_found = true;
- return;
- }
-
- /* We issue a warning if it looks like we are including two
- different versions of the same shared library. For example,
- there may be a problem if -lc picks up libc.so.6 but some other
- shared library has a DT_NEEDED entry of libc.so.5. This is a
- hueristic test, and it will only work if the name looks like
- NAME.so.VERSION. FIXME: Depending on file names is error-prone.
- If we really want to issue warnings about mixing version numbers
- of shared libraries, we need to find a better way. */
-
- if (strchr (global_needed->name, '/') != NULL)
- return;
- suffix = strstr (global_needed->name, ".so.");
- if (suffix == NULL)
- return;
- suffix += sizeof ".so." - 1;
-
- soname = bfd_elf_get_dt_soname (s->the_bfd);
- if (soname == NULL)
- soname = s->filename;
-
- f = strrchr (soname, '/');
- if (f != NULL)
- ++f;
- else
- f = soname;
-
- if (strncmp (f, global_needed->name, suffix - global_needed->name) == 0)
- einfo (_("%P: warning: %s, needed by %B, may conflict with %s\n"),
- global_needed->name, global_needed->by, f);
-}
-
-/* This is called after the sections have been attached to output
- sections, but before any sizes or addresses have been set. */
-
-static void
-gldelf32ebmip_before_allocation ()
-{
- const char *rpath;
- asection *sinterp;
-
- /* If we are going to make any variable assignments, we need to let
- the ELF backend know about them in case the variables are
- referred to by dynamic objects. */
- lang_for_each_statement (gldelf32ebmip_find_statement_assignment);
-
- /* Let the ELF backend work out the sizes of any sections required
- by dynamic linking. */
- rpath = command_line.rpath;
- if (rpath == NULL)
- rpath = (const char *) getenv ("LD_RUN_PATH");
- if (! (bfd_elf32_size_dynamic_sections
- (output_bfd, command_line.soname, rpath,
- command_line.filter_shlib,
- (const char * const *) command_line.auxiliary_filters,
- &link_info, &sinterp, lang_elf_version_info)))
- einfo (_("%P%F: failed to set dynamic section sizes: %E\n"));
-
- /* Let the user override the dynamic linker we are using. */
- if (command_line.interpreter != NULL
- && sinterp != NULL)
- {
- sinterp->contents = (bfd_byte *) command_line.interpreter;
- sinterp->_raw_size = strlen (command_line.interpreter) + 1;
- }
-
- /* Look for any sections named .gnu.warning. As a GNU extensions,
- we treat such sections as containing warning messages. We print
- out the warning message, and then zero out the section size so
- that it does not get copied into the output file. */
-
- {
- LANG_FOR_EACH_INPUT_STATEMENT (is)
- {
- asection *s;
- bfd_size_type sz;
- char *msg;
- boolean ret;
-
- if (is->just_syms_flag)
- continue;
-
- s = bfd_get_section_by_name (is->the_bfd, ".gnu.warning");
- if (s == NULL)
- continue;
-
- sz = bfd_section_size (is->the_bfd, s);
- msg = xmalloc ((size_t) sz + 1);
- if (! bfd_get_section_contents (is->the_bfd, s, msg, (file_ptr) 0, sz))
- einfo (_("%F%B: Can't read contents of section .gnu.warning: %E\n"),
- is->the_bfd);
- msg[sz] = '\0';
- ret = link_info.callbacks->warning (&link_info, msg,
- (const char *) NULL,
- is->the_bfd, (asection *) NULL,
- (bfd_vma) 0);
- ASSERT (ret);
- free (msg);
-
- /* Clobber the section size, so that we don't waste copying the
- warning into the output file. */
- s->_raw_size = 0;
- }
- }
-}
-
-/* This is called by the before_allocation routine via
- lang_for_each_statement. It locates any assignment statements, and
- tells the ELF backend about them, in case they are assignments to
- symbols which are referred to by dynamic objects. */
-
-static void
-gldelf32ebmip_find_statement_assignment (s)
- lang_statement_union_type *s;
-{
- if (s->header.type == lang_assignment_statement_enum)
- gldelf32ebmip_find_exp_assignment (s->assignment_statement.exp);
-}
-
-/* Look through an expression for an assignment statement. */
-
-static void
-gldelf32ebmip_find_exp_assignment (exp)
- etree_type *exp;
-{
- struct bfd_link_hash_entry *h;
-
- switch (exp->type.node_class)
- {
- case etree_provide:
- case etree_provided:
- h = bfd_link_hash_lookup (link_info.hash, exp->assign.dst,
- false, false, false);
- if (h == NULL)
- break;
-
- /* We call record_link_assignment even if the symbol is defined.
- This is because if it is defined by a dynamic object, we
- actually want to use the value defined by the linker script,
- not the value from the dynamic object (because we are setting
- symbols like etext). If the symbol is defined by a regular
- object, then, as it happens, calling record_link_assignment
- will do no harm. */
-
- /* Fall through. */
- case etree_assign:
- if (strcmp (exp->assign.dst, ".") != 0)
- {
- if (! (bfd_elf32_record_link_assignment
- (output_bfd, &link_info, exp->assign.dst,
- exp->type.node_class != etree_assign ? true : false)))
- einfo (_("%P%F: failed to record assignment to %s: %E\n"),
- exp->assign.dst);
- }
- gldelf32ebmip_find_exp_assignment (exp->assign.src);
- break;
-
- case etree_binary:
- gldelf32ebmip_find_exp_assignment (exp->binary.lhs);
- gldelf32ebmip_find_exp_assignment (exp->binary.rhs);
- break;
-
- case etree_trinary:
- gldelf32ebmip_find_exp_assignment (exp->trinary.cond);
- gldelf32ebmip_find_exp_assignment (exp->trinary.lhs);
- gldelf32ebmip_find_exp_assignment (exp->trinary.rhs);
- break;
-
- case etree_unary:
- gldelf32ebmip_find_exp_assignment (exp->unary.child);
- break;
-
- default:
- break;
- }
-}
-
-/* Place an orphan section. We use this to put random SHF_ALLOC
- sections in the right segment. */
-
-static asection *hold_section;
-static lang_output_section_statement_type *hold_use;
-static lang_output_section_statement_type *hold_text;
-static lang_output_section_statement_type *hold_rodata;
-static lang_output_section_statement_type *hold_data;
-static lang_output_section_statement_type *hold_bss;
-static lang_output_section_statement_type *hold_rel;
-
-/*ARGSUSED*/
-static boolean
-gldelf32ebmip_place_orphan (file, s)
- lang_input_statement_type *file;
- asection *s;
-{
- lang_output_section_statement_type *place;
- asection *snew, **pps;
- lang_statement_list_type *old;
- lang_statement_list_type add;
- etree_type *address;
- const char *secname, *ps;
- lang_output_section_statement_type *os;
-
- if ((s->flags & SEC_ALLOC) == 0)
- return false;
-
- /* Look through the script to see where to place this section. */
- hold_section = s;
- hold_use = NULL;
- lang_for_each_statement (gldelf32ebmip_place_section);
-
- if (hold_use != NULL)
- {
- /* We have already placed a section with this name. */
- lang_add_section (&hold_use->children, s, hold_use, file);
- return true;
- }
-
- secname = bfd_get_section_name (s->owner, s);
-
- /* If this is a final link, then always put .gnu.warning.SYMBOL
- sections into the .text section to get them out of the way. */
- if (! link_info.shared
- && ! link_info.relocateable
- && strncmp (secname, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0
- && hold_text != NULL)
- {
- lang_add_section (&hold_text->children, s, hold_text, file);
- return true;
- }
-
- /* Decide which segment the section should go in based on the
- section name and section flags. */
- place = NULL;
- if ((s->flags & SEC_HAS_CONTENTS) == 0
- && hold_bss != NULL)
- place = hold_bss;
- else if ((s->flags & SEC_READONLY) == 0
- && hold_data != NULL)
- place = hold_data;
- else if (strncmp (secname, ".rel", 4) == 0
- && hold_rel != NULL)
- place = hold_rel;
- else if ((s->flags & SEC_CODE) == 0
- && (s->flags & SEC_READONLY) != 0
- && hold_rodata != NULL)
- place = hold_rodata;
- else if ((s->flags & SEC_READONLY) != 0
- && hold_text != NULL)
- place = hold_text;
- if (place == NULL)
- return false;
-
- /* Create the section in the output file, and put it in the right
- place. This shuffling is to make the output file look neater. */
- snew = bfd_make_section (output_bfd, secname);
- if (snew == NULL)
- einfo (_("%P%F: output format %s cannot represent section called %s\n"),
- output_bfd->xvec->name, secname);
- if (place->bfd_section != NULL)
- {
- for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next)
- ;
- *pps = snew->next;
- snew->next = place->bfd_section->next;
- place->bfd_section->next = snew;
- }
-
- /* Start building a list of statements for this section. */
- old = stat_ptr;
- stat_ptr = &add;
- lang_list_init (stat_ptr);
-
- /* If the name of the section is representable in C, then create
- symbols to mark the start and the end of the section. */
- for (ps = secname; *ps != '\0'; ps++)
- if (! ISALNUM (*ps) && *ps != '_')
- break;
- if (*ps == '\0' && config.build_constructors)
- {
- char *symname;
-
- symname = (char *) xmalloc (ps - secname + sizeof "__start_");
- sprintf (symname, "__start_%s", secname);
- lang_add_assignment (exp_assop ('=', symname,
- exp_unop (ALIGN_K,
- exp_intop ((bfd_vma) 1
- << s->alignment_power))));
- }
-
- if (! link_info.relocateable)
- address = NULL;
- else
- address = exp_intop ((bfd_vma) 0);
-
- lang_enter_output_section_statement (secname, address, 0,
- (bfd_vma) 0,
- (etree_type *) NULL,
- (etree_type *) NULL,
- (etree_type *) NULL);
-
- os = lang_output_section_statement_lookup (secname);
- lang_add_section (&os->children, s, os, file);
-
- lang_leave_output_section_statement
- ((bfd_vma) 0, "*default*",
- (struct lang_output_section_phdr_list *) NULL, "*default*");
- stat_ptr = &add;
-
- if (*ps == '\0' && config.build_constructors)
- {
- char *symname;
-
- symname = (char *) xmalloc (ps - secname + sizeof "__stop_");
- sprintf (symname, "__stop_%s", secname);
- lang_add_assignment (exp_assop ('=', symname,
- exp_nameop (NAME, ".")));
- }
-
- /* Now stick the new statement list right after PLACE. */
- *add.tail = place->header.next;
- place->header.next = add.head;
-
- stat_ptr = old;
-
- return true;
-}
-
-static void
-gldelf32ebmip_place_section (s)
- lang_statement_union_type *s;
-{
- lang_output_section_statement_type *os;
-
- if (s->header.type != lang_output_section_statement_enum)
- return;
-
- os = &s->output_section_statement;
-
- if (strcmp (os->name, hold_section->name) == 0)
- hold_use = os;
-
- if (strcmp (os->name, ".text") == 0)
- hold_text = os;
- else if (strcmp (os->name, ".rodata") == 0)
- hold_rodata = os;
- else if (strcmp (os->name, ".data") == 0)
- hold_data = os;
- else if (strcmp (os->name, ".bss") == 0)
- hold_bss = os;
- else if (hold_rel == NULL
- && os->bfd_section != NULL
- && strncmp (os->name, ".rel", 4) == 0)
- hold_rel = os;
-}
-
-static char *
-gldelf32ebmip_get_script(isfile)
- int *isfile;
-{
- *isfile = 0;
-
- if (link_info.relocateable == true && config.build_constructors == true)
- return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
- \"elf32-littlemips\")\n\
-OUTPUT_ARCH(mips)\n\
-ENTRY(_start)\n\
- /* For some reason, the Solaris linker makes bad executables\n\
- if gld -r is used and the intermediate file has sections starting\n\
- at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld\n\
- bug. But for now assigning the zero vmas works. */\n\
-SECTIONS\n\
-{\n\
- /* Read-only sections, merged into text segment: */\n\
- .interp 0 : { *(.interp) }\n\
- .reginfo 0 : { *(.reginfo) }\n\
- .dynamic 0 : { *(.dynamic) }\n\
- .dynstr 0 : { *(.dynstr) }\n\
- .dynsym 0 : { *(.dynsym) }\n\
- .hash 0 : { *(.hash) }\n\
- .rel.text 0 : { *(.rel.text) }\n\
- .rela.text 0 : { *(.rela.text) }\n\
- .rel.data 0 : { *(.rel.data) }\n\
- .rela.data 0 : { *(.rela.data) }\n\
- .rel.rodata 0 : { *(.rel.rodata) }\n\
- .rela.rodata 0 : { *(.rela.rodata) }\n\
- .rel.got 0 : { *(.rel.got) }\n\
- .rela.got 0 : { *(.rela.got) }\n\
- .rel.ctors 0 : { *(.rel.ctors) }\n\
- .rela.ctors 0 : { *(.rela.ctors) }\n\
- .rel.dtors 0 : { *(.rel.dtors) }\n\
- .rela.dtors 0 : { *(.rela.dtors) }\n\
- .rel.init 0 : { *(.rel.init) }\n\
- .rela.init 0 : { *(.rela.init) }\n\
- .rel.fini 0 : { *(.rel.fini) }\n\
- .rela.fini 0 : { *(.rela.fini) }\n\
- .rel.bss 0 : { *(.rel.bss) }\n\
- .rela.bss 0 : { *(.rela.bss) }\n\
- .rel.plt 0 : { *(.rel.plt) }\n\
- .rela.plt 0 : { *(.rela.plt) }\n\
- .rodata 0 : { *(.rodata) }\n\
- .rodata1 0 : { *(.rodata1) }\n\
- .init 0 : { *(.init) } =0\n\
- .text 0 :\n\
- {\n\
- *(.text)\n\
- *(.stub)\n\
- /* .gnu.warning sections are handled specially by elf32.em. */\n\
- *(.gnu.warning)\n\
- } =0\n\
- .fini 0 : { *(.fini) } =0\n\
- /* Adjust the address for the data segment. We want to adjust up to\n\
- the same address within the page on the next page up. It would\n\
- be more correct to do this:\n\
- The current expression does not correctly handle the case of a\n\
- text segment ending precisely at the end of a page; it causes the\n\
- data segment to skip a page. The above expression does not have\n\
- this problem, but it will currently (2/95) cause BFD to allocate\n\
- a single segment, combining both text and data, for this case.\n\
- This will prevent the text segment from being shared among\n\
- multiple executions of the program; I think that is more\n\
- important than losing a page of the virtual address space (note\n\
- that no actual memory is lost; the page which is skipped can not\n\
- be referenced). */\n\
- .data 0 :\n\
- {\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- .data1 0 : { *(.data1) }\n\
- .ctors 0 : { *(.ctors) }\n\
- .dtors 0 : { *(.dtors) }\n\
- .got 0 :\n\
- {\n\
- *(.got.plt) *(.got)\n\
- }\n\
- /* We want the small data sections together, so single-instruction offsets\n\
- can access them all, and initialized data all before uninitialized, so\n\
- we can shorten the on-disk segment size. */\n\
- .sdata 0 : { *(.sdata) }\n\
- .sbss 0 : { *(.sbss) *(.scommon) }\n\
- .bss 0 :\n\
- {\n\
- *(.dynbss)\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- /* These are needed for ELF backends which have not yet been\n\
- converted to the new style linker. */\n\
- .stab 0 : { *(.stab) }\n\
- .stabstr 0 : { *(.stabstr) }\n\
- /* DWARF debug sections.\n\
- Symbols in the .debug DWARF section are relative to the beginning of the\n\
- section so we begin .debug at 0. It's not clear yet what needs to happen\n\
- for the others. */\n\
- .debug 0 : { *(.debug) }\n\
- .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
- .debug_aranges 0 : { *(.debug_aranges) }\n\
- .debug_pubnames 0 : { *(.debug_pubnames) }\n\
- .debug_sfnames 0 : { *(.debug_sfnames) }\n\
- .line 0 : { *(.line) }\n\
- /* These must appear regardless of . */\n\
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
-}\n\n";
- else if (link_info.relocateable == true)
- return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
- \"elf32-littlemips\")\n\
-OUTPUT_ARCH(mips)\n\
-ENTRY(_start)\n\
- /* For some reason, the Solaris linker makes bad executables\n\
- if gld -r is used and the intermediate file has sections starting\n\
- at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld\n\
- bug. But for now assigning the zero vmas works. */\n\
-SECTIONS\n\
-{\n\
- /* Read-only sections, merged into text segment: */\n\
- .interp 0 : { *(.interp) }\n\
- .reginfo 0 : { *(.reginfo) }\n\
- .dynamic 0 : { *(.dynamic) }\n\
- .dynstr 0 : { *(.dynstr) }\n\
- .dynsym 0 : { *(.dynsym) }\n\
- .hash 0 : { *(.hash) }\n\
- .rel.text 0 : { *(.rel.text) }\n\
- .rela.text 0 : { *(.rela.text) }\n\
- .rel.data 0 : { *(.rel.data) }\n\
- .rela.data 0 : { *(.rela.data) }\n\
- .rel.rodata 0 : { *(.rel.rodata) }\n\
- .rela.rodata 0 : { *(.rela.rodata) }\n\
- .rel.got 0 : { *(.rel.got) }\n\
- .rela.got 0 : { *(.rela.got) }\n\
- .rel.ctors 0 : { *(.rel.ctors) }\n\
- .rela.ctors 0 : { *(.rela.ctors) }\n\
- .rel.dtors 0 : { *(.rel.dtors) }\n\
- .rela.dtors 0 : { *(.rela.dtors) }\n\
- .rel.init 0 : { *(.rel.init) }\n\
- .rela.init 0 : { *(.rela.init) }\n\
- .rel.fini 0 : { *(.rel.fini) }\n\
- .rela.fini 0 : { *(.rela.fini) }\n\
- .rel.bss 0 : { *(.rel.bss) }\n\
- .rela.bss 0 : { *(.rela.bss) }\n\
- .rel.plt 0 : { *(.rel.plt) }\n\
- .rela.plt 0 : { *(.rela.plt) }\n\
- .rodata 0 : { *(.rodata) }\n\
- .rodata1 0 : { *(.rodata1) }\n\
- .init 0 : { *(.init) } =0\n\
- .text 0 :\n\
- {\n\
- *(.text)\n\
- *(.stub)\n\
- /* .gnu.warning sections are handled specially by elf32.em. */\n\
- *(.gnu.warning)\n\
- } =0\n\
- .fini 0 : { *(.fini) } =0\n\
- /* Adjust the address for the data segment. We want to adjust up to\n\
- the same address within the page on the next page up. It would\n\
- be more correct to do this:\n\
- The current expression does not correctly handle the case of a\n\
- text segment ending precisely at the end of a page; it causes the\n\
- data segment to skip a page. The above expression does not have\n\
- this problem, but it will currently (2/95) cause BFD to allocate\n\
- a single segment, combining both text and data, for this case.\n\
- This will prevent the text segment from being shared among\n\
- multiple executions of the program; I think that is more\n\
- important than losing a page of the virtual address space (note\n\
- that no actual memory is lost; the page which is skipped can not\n\
- be referenced). */\n\
- .data 0 :\n\
- {\n\
- *(.data)\n\
- }\n\
- .data1 0 : { *(.data1) }\n\
- .ctors 0 : { *(.ctors) }\n\
- .dtors 0 : { *(.dtors) }\n\
- .got 0 :\n\
- {\n\
- *(.got.plt) *(.got)\n\
- }\n\
- /* We want the small data sections together, so single-instruction offsets\n\
- can access them all, and initialized data all before uninitialized, so\n\
- we can shorten the on-disk segment size. */\n\
- .sdata 0 : { *(.sdata) }\n\
- .sbss 0 : { *(.sbss) *(.scommon) }\n\
- .bss 0 :\n\
- {\n\
- *(.dynbss)\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- /* These are needed for ELF backends which have not yet been\n\
- converted to the new style linker. */\n\
- .stab 0 : { *(.stab) }\n\
- .stabstr 0 : { *(.stabstr) }\n\
- /* DWARF debug sections.\n\
- Symbols in the .debug DWARF section are relative to the beginning of the\n\
- section so we begin .debug at 0. It's not clear yet what needs to happen\n\
- for the others. */\n\
- .debug 0 : { *(.debug) }\n\
- .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
- .debug_aranges 0 : { *(.debug_aranges) }\n\
- .debug_pubnames 0 : { *(.debug_pubnames) }\n\
- .debug_sfnames 0 : { *(.debug_sfnames) }\n\
- .line 0 : { *(.line) }\n\
- /* These must appear regardless of . */\n\
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
-}\n\n";
- else if (!config.text_read_only)
- return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
- \"elf32-littlemips\")\n\
-OUTPUT_ARCH(mips)\n\
-ENTRY(_start)\n\
- SEARCH_DIR(/usr/local/mips-elf/lib);\n\
-/* Do we need any of these for elf?\n\
- __DYNAMIC = 0; */\n\
-SECTIONS\n\
-{\n\
- /* Read-only sections, merged into text segment: */\n\
- . = 0x0400000;\n\
- .interp : { *(.interp) }\n\
- .reginfo : { *(.reginfo) }\n\
- .dynamic : { *(.dynamic) }\n\
- .dynstr : { *(.dynstr) }\n\
- .dynsym : { *(.dynsym) }\n\
- .hash : { *(.hash) }\n\
- .rel.text : { *(.rel.text) }\n\
- .rela.text : { *(.rela.text) }\n\
- .rel.data : { *(.rel.data) }\n\
- .rela.data : { *(.rela.data) }\n\
- .rel.rodata : { *(.rel.rodata) }\n\
- .rela.rodata : { *(.rela.rodata) }\n\
- .rel.got : { *(.rel.got) }\n\
- .rela.got : { *(.rela.got) }\n\
- .rel.ctors : { *(.rel.ctors) }\n\
- .rela.ctors : { *(.rela.ctors) }\n\
- .rel.dtors : { *(.rel.dtors) }\n\
- .rela.dtors : { *(.rela.dtors) }\n\
- .rel.init : { *(.rel.init) }\n\
- .rela.init : { *(.rela.init) }\n\
- .rel.fini : { *(.rel.fini) }\n\
- .rela.fini : { *(.rela.fini) }\n\
- .rel.bss : { *(.rel.bss) }\n\
- .rela.bss : { *(.rela.bss) }\n\
- .rel.plt : { *(.rel.plt) }\n\
- .rela.plt : { *(.rela.plt) }\n\
- .rodata : { *(.rodata) }\n\
- .rodata1 : { *(.rodata1) }\n\
- .init : { *(.init) } =0\n\
- .text :\n\
- {\n\
- _ftext = . ;\n\
- *(.text)\n\
- *(.stub)\n\
- /* .gnu.warning sections are handled specially by elf32.em. */\n\
- *(.gnu.warning)\n\
- } =0\n\
- _etext = .;\n\
- PROVIDE (etext = .);\n\
- .fini : { *(.fini) } =0\n\
- /* Adjust the address for the data segment. We want to adjust up to\n\
- the same address within the page on the next page up. It would\n\
- be more correct to do this:\n\
- . = .;\n\
- The current expression does not correctly handle the case of a\n\
- text segment ending precisely at the end of a page; it causes the\n\
- data segment to skip a page. The above expression does not have\n\
- this problem, but it will currently (2/95) cause BFD to allocate\n\
- a single segment, combining both text and data, for this case.\n\
- This will prevent the text segment from being shared among\n\
- multiple executions of the program; I think that is more\n\
- important than losing a page of the virtual address space (note\n\
- that no actual memory is lost; the page which is skipped can not\n\
- be referenced). */\n\
- . += . - 0x0400000;\n\
- .data :\n\
- {\n\
- _fdata = . ;\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- .data1 : { *(.data1) }\n\
- .ctors : { *(.ctors) }\n\
- .dtors : { *(.dtors) }\n\
- _gp = ALIGN(16) + 0x7ff0;\n\
- .got :\n\
- {\n\
- *(.got.plt) *(.got)\n\
- }\n\
- /* We want the small data sections together, so single-instruction offsets\n\
- can access them all, and initialized data all before uninitialized, so\n\
- we can shorten the on-disk segment size. */\n\
- .sdata : { *(.sdata) }\n\
- .lit8 : { *(.lit8) }\n\
- .lit4 : { *(.lit4) }\n\
- _edata = .;\n\
- PROVIDE (edata = .);\n\
- __bss_start = .;\n\
- _fbss = .;\n\
- .sbss : { *(.sbss) *(.scommon) }\n\
- .bss :\n\
- {\n\
- *(.dynbss)\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- _end = . ;\n\
- PROVIDE (end = .);\n\
- /* These are needed for ELF backends which have not yet been\n\
- converted to the new style linker. */\n\
- .stab 0 : { *(.stab) }\n\
- .stabstr 0 : { *(.stabstr) }\n\
- /* DWARF debug sections.\n\
- Symbols in the .debug DWARF section are relative to the beginning of the\n\
- section so we begin .debug at 0. It's not clear yet what needs to happen\n\
- for the others. */\n\
- .debug 0 : { *(.debug) }\n\
- .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
- .debug_aranges 0 : { *(.debug_aranges) }\n\
- .debug_pubnames 0 : { *(.debug_pubnames) }\n\
- .debug_sfnames 0 : { *(.debug_sfnames) }\n\
- .line 0 : { *(.line) }\n\
- /* These must appear regardless of . */\n\
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
-}\n\n";
- else if (!config.magic_demand_paged)
- return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
- \"elf32-littlemips\")\n\
-OUTPUT_ARCH(mips)\n\
-ENTRY(_start)\n\
- SEARCH_DIR(/usr/local/mips-elf/lib);\n\
-/* Do we need any of these for elf?\n\
- __DYNAMIC = 0; */\n\
-SECTIONS\n\
-{\n\
- /* Read-only sections, merged into text segment: */\n\
- . = 0x0400000;\n\
- .interp : { *(.interp) }\n\
- .reginfo : { *(.reginfo) }\n\
- .dynamic : { *(.dynamic) }\n\
- .dynstr : { *(.dynstr) }\n\
- .dynsym : { *(.dynsym) }\n\
- .hash : { *(.hash) }\n\
- .rel.text : { *(.rel.text) }\n\
- .rela.text : { *(.rela.text) }\n\
- .rel.data : { *(.rel.data) }\n\
- .rela.data : { *(.rela.data) }\n\
- .rel.rodata : { *(.rel.rodata) }\n\
- .rela.rodata : { *(.rela.rodata) }\n\
- .rel.got : { *(.rel.got) }\n\
- .rela.got : { *(.rela.got) }\n\
- .rel.ctors : { *(.rel.ctors) }\n\
- .rela.ctors : { *(.rela.ctors) }\n\
- .rel.dtors : { *(.rel.dtors) }\n\
- .rela.dtors : { *(.rela.dtors) }\n\
- .rel.init : { *(.rel.init) }\n\
- .rela.init : { *(.rela.init) }\n\
- .rel.fini : { *(.rel.fini) }\n\
- .rela.fini : { *(.rela.fini) }\n\
- .rel.bss : { *(.rel.bss) }\n\
- .rela.bss : { *(.rela.bss) }\n\
- .rel.plt : { *(.rel.plt) }\n\
- .rela.plt : { *(.rela.plt) }\n\
- .rodata : { *(.rodata) }\n\
- .rodata1 : { *(.rodata1) }\n\
- .init : { *(.init) } =0\n\
- .text :\n\
- {\n\
- _ftext = . ;\n\
- *(.text)\n\
- *(.stub)\n\
- /* .gnu.warning sections are handled specially by elf32.em. */\n\
- *(.gnu.warning)\n\
- } =0\n\
- _etext = .;\n\
- PROVIDE (etext = .);\n\
- .fini : { *(.fini) } =0\n\
- /* Adjust the address for the data segment. We want to adjust up to\n\
- the same address within the page on the next page up. It would\n\
- be more correct to do this:\n\
- . = 0x10000000;\n\
- The current expression does not correctly handle the case of a\n\
- text segment ending precisely at the end of a page; it causes the\n\
- data segment to skip a page. The above expression does not have\n\
- this problem, but it will currently (2/95) cause BFD to allocate\n\
- a single segment, combining both text and data, for this case.\n\
- This will prevent the text segment from being shared among\n\
- multiple executions of the program; I think that is more\n\
- important than losing a page of the virtual address space (note\n\
- that no actual memory is lost; the page which is skipped can not\n\
- be referenced). */\n\
- . += 0x10000000 - 0x0400000;\n\
- .data :\n\
- {\n\
- _fdata = . ;\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- .data1 : { *(.data1) }\n\
- .ctors : { *(.ctors) }\n\
- .dtors : { *(.dtors) }\n\
- _gp = ALIGN(16) + 0x7ff0;\n\
- .got :\n\
- {\n\
- *(.got.plt) *(.got)\n\
- }\n\
- /* We want the small data sections together, so single-instruction offsets\n\
- can access them all, and initialized data all before uninitialized, so\n\
- we can shorten the on-disk segment size. */\n\
- .sdata : { *(.sdata) }\n\
- .lit8 : { *(.lit8) }\n\
- .lit4 : { *(.lit4) }\n\
- _edata = .;\n\
- PROVIDE (edata = .);\n\
- __bss_start = .;\n\
- _fbss = .;\n\
- .sbss : { *(.sbss) *(.scommon) }\n\
- .bss :\n\
- {\n\
- *(.dynbss)\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- _end = . ;\n\
- PROVIDE (end = .);\n\
- /* These are needed for ELF backends which have not yet been\n\
- converted to the new style linker. */\n\
- .stab 0 : { *(.stab) }\n\
- .stabstr 0 : { *(.stabstr) }\n\
- /* DWARF debug sections.\n\
- Symbols in the .debug DWARF section are relative to the beginning of the\n\
- section so we begin .debug at 0. It's not clear yet what needs to happen\n\
- for the others. */\n\
- .debug 0 : { *(.debug) }\n\
- .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
- .debug_aranges 0 : { *(.debug_aranges) }\n\
- .debug_pubnames 0 : { *(.debug_pubnames) }\n\
- .debug_sfnames 0 : { *(.debug_sfnames) }\n\
- .line 0 : { *(.line) }\n\
- /* These must appear regardless of . */\n\
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
-}\n\n";
- else if (link_info.shared)
- return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
- \"elf32-littlemips\")\n\
-OUTPUT_ARCH(mips)\n\
-ENTRY(_start)\n\
- SEARCH_DIR(/usr/local/mips-elf/lib);\n\
-/* Do we need any of these for elf?\n\
- __DYNAMIC = 0; */\n\
-SECTIONS\n\
-{\n\
- /* Read-only sections, merged into text segment: */\n\
- . = 0x5ffe0000 + SIZEOF_HEADERS;\n\
- .reginfo : { *(.reginfo) }\n\
- .dynamic : { *(.dynamic) }\n\
- .dynstr : { *(.dynstr) }\n\
- .dynsym : { *(.dynsym) }\n\
- .hash : { *(.hash) }\n\
- .rel.text : { *(.rel.text) }\n\
- .rela.text : { *(.rela.text) }\n\
- .rel.data : { *(.rel.data) }\n\
- .rela.data : { *(.rela.data) }\n\
- .rel.rodata : { *(.rel.rodata) }\n\
- .rela.rodata : { *(.rela.rodata) }\n\
- .rel.got : { *(.rel.got) }\n\
- .rela.got : { *(.rela.got) }\n\
- .rel.ctors : { *(.rel.ctors) }\n\
- .rela.ctors : { *(.rela.ctors) }\n\
- .rel.dtors : { *(.rel.dtors) }\n\
- .rela.dtors : { *(.rela.dtors) }\n\
- .rel.init : { *(.rel.init) }\n\
- .rela.init : { *(.rela.init) }\n\
- .rel.fini : { *(.rel.fini) }\n\
- .rela.fini : { *(.rela.fini) }\n\
- .rel.bss : { *(.rel.bss) }\n\
- .rela.bss : { *(.rela.bss) }\n\
- .rel.plt : { *(.rel.plt) }\n\
- .rela.plt : { *(.rela.plt) }\n\
- .rodata : { *(.rodata) }\n\
- .rodata1 : { *(.rodata1) }\n\
- .init : { *(.init) } =0\n\
- .text :\n\
- {\n\
- *(.text)\n\
- *(.stub)\n\
- /* .gnu.warning sections are handled specially by elf32.em. */\n\
- *(.gnu.warning)\n\
- } =0\n\
- .fini : { *(.fini) } =0\n\
- /* Adjust the address for the data segment. We want to adjust up to\n\
- the same address within the page on the next page up. It would\n\
- be more correct to do this:\n\
- . = 0x10000000;\n\
- The current expression does not correctly handle the case of a\n\
- text segment ending precisely at the end of a page; it causes the\n\
- data segment to skip a page. The above expression does not have\n\
- this problem, but it will currently (2/95) cause BFD to allocate\n\
- a single segment, combining both text and data, for this case.\n\
- This will prevent the text segment from being shared among\n\
- multiple executions of the program; I think that is more\n\
- important than losing a page of the virtual address space (note\n\
- that no actual memory is lost; the page which is skipped can not\n\
- be referenced). */\n\
- . += 0x10000;\n\
- .data :\n\
- {\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- .data1 : { *(.data1) }\n\
- .ctors : { *(.ctors) }\n\
- .dtors : { *(.dtors) }\n\
- _gp = ALIGN(16) + 0x7ff0;\n\
- .got :\n\
- {\n\
- *(.got.plt) *(.got)\n\
- }\n\
- /* We want the small data sections together, so single-instruction offsets\n\
- can access them all, and initialized data all before uninitialized, so\n\
- we can shorten the on-disk segment size. */\n\
- .sdata : { *(.sdata) }\n\
- .lit8 : { *(.lit8) }\n\
- .lit4 : { *(.lit4) }\n\
- .sbss : { *(.sbss) *(.scommon) }\n\
- .bss :\n\
- {\n\
- *(.dynbss)\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- /* These are needed for ELF backends which have not yet been\n\
- converted to the new style linker. */\n\
- .stab 0 : { *(.stab) }\n\
- .stabstr 0 : { *(.stabstr) }\n\
- /* DWARF debug sections.\n\
- Symbols in the .debug DWARF section are relative to the beginning of the\n\
- section so we begin .debug at 0. It's not clear yet what needs to happen\n\
- for the others. */\n\
- .debug 0 : { *(.debug) }\n\
- .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
- .debug_aranges 0 : { *(.debug_aranges) }\n\
- .debug_pubnames 0 : { *(.debug_pubnames) }\n\
- .debug_sfnames 0 : { *(.debug_sfnames) }\n\
- .line 0 : { *(.line) }\n\
- /* These must appear regardless of . */\n\
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
-}\n\n";
- else
- return "OUTPUT_FORMAT(\"elf32-bigmips\", \"elf32-bigmips\",\n\
- \"elf32-littlemips\")\n\
-OUTPUT_ARCH(mips)\n\
-ENTRY(_start)\n\
- SEARCH_DIR(/usr/local/mips-elf/lib);\n\
-/* Do we need any of these for elf?\n\
- __DYNAMIC = 0; */\n\
-SECTIONS\n\
-{\n\
- /* Read-only sections, merged into text segment: */\n\
- . = 0x0400000;\n\
- .interp : { *(.interp) }\n\
- .reginfo : { *(.reginfo) }\n\
- .dynamic : { *(.dynamic) }\n\
- .dynstr : { *(.dynstr) }\n\
- .dynsym : { *(.dynsym) }\n\
- .hash : { *(.hash) }\n\
- .rel.text : { *(.rel.text) }\n\
- .rela.text : { *(.rela.text) }\n\
- .rel.data : { *(.rel.data) }\n\
- .rela.data : { *(.rela.data) }\n\
- .rel.rodata : { *(.rel.rodata) }\n\
- .rela.rodata : { *(.rela.rodata) }\n\
- .rel.got : { *(.rel.got) }\n\
- .rela.got : { *(.rela.got) }\n\
- .rel.ctors : { *(.rel.ctors) }\n\
- .rela.ctors : { *(.rela.ctors) }\n\
- .rel.dtors : { *(.rel.dtors) }\n\
- .rela.dtors : { *(.rela.dtors) }\n\
- .rel.init : { *(.rel.init) }\n\
- .rela.init : { *(.rela.init) }\n\
- .rel.fini : { *(.rel.fini) }\n\
- .rela.fini : { *(.rela.fini) }\n\
- .rel.bss : { *(.rel.bss) }\n\
- .rela.bss : { *(.rela.bss) }\n\
- .rel.plt : { *(.rel.plt) }\n\
- .rela.plt : { *(.rela.plt) }\n\
- .rodata : { *(.rodata) }\n\
- .rodata1 : { *(.rodata1) }\n\
- .init : { *(.init) } =0\n\
- .text :\n\
- {\n\
- _ftext = . ;\n\
- *(.text)\n\
- *(.stub)\n\
- /* .gnu.warning sections are handled specially by elf32.em. */\n\
- *(.gnu.warning)\n\
- } =0\n\
- _etext = .;\n\
- PROVIDE (etext = .);\n\
- .fini : { *(.fini) } =0\n\
- /* Adjust the address for the data segment. We want to adjust up to\n\
- the same address within the page on the next page up. It would\n\
- be more correct to do this:\n\
- . = 0x10000000;\n\
- The current expression does not correctly handle the case of a\n\
- text segment ending precisely at the end of a page; it causes the\n\
- data segment to skip a page. The above expression does not have\n\
- this problem, but it will currently (2/95) cause BFD to allocate\n\
- a single segment, combining both text and data, for this case.\n\
- This will prevent the text segment from being shared among\n\
- multiple executions of the program; I think that is more\n\
- important than losing a page of the virtual address space (note\n\
- that no actual memory is lost; the page which is skipped can not\n\
- be referenced). */\n\
- . += 0x10000000 - 0x0400000;\n\
- .data :\n\
- {\n\
- _fdata = . ;\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- .data1 : { *(.data1) }\n\
- .ctors : { *(.ctors) }\n\
- .dtors : { *(.dtors) }\n\
- _gp = ALIGN(16) + 0x7ff0;\n\
- .got :\n\
- {\n\
- *(.got.plt) *(.got)\n\
- }\n\
- /* We want the small data sections together, so single-instruction offsets\n\
- can access them all, and initialized data all before uninitialized, so\n\
- we can shorten the on-disk segment size. */\n\
- .sdata : { *(.sdata) }\n\
- .lit8 : { *(.lit8) }\n\
- .lit4 : { *(.lit4) }\n\
- _edata = .;\n\
- PROVIDE (edata = .);\n\
- __bss_start = .;\n\
- _fbss = .;\n\
- .sbss : { *(.sbss) *(.scommon) }\n\
- .bss :\n\
- {\n\
- *(.dynbss)\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- _end = . ;\n\
- PROVIDE (end = .);\n\
- /* These are needed for ELF backends which have not yet been\n\
- converted to the new style linker. */\n\
- .stab 0 : { *(.stab) }\n\
- .stabstr 0 : { *(.stabstr) }\n\
- /* DWARF debug sections.\n\
- Symbols in the .debug DWARF section are relative to the beginning of the\n\
- section so we begin .debug at 0. It's not clear yet what needs to happen\n\
- for the others. */\n\
- .debug 0 : { *(.debug) }\n\
- .debug_srcinfo 0 : { *(.debug_srcinfo) }\n\
- .debug_aranges 0 : { *(.debug_aranges) }\n\
- .debug_pubnames 0 : { *(.debug_pubnames) }\n\
- .debug_sfnames 0 : { *(.debug_sfnames) }\n\
- .line 0 : { *(.line) }\n\
- /* These must appear regardless of . */\n\
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }\n\
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }\n\
-}\n\n";
-}
-
-struct ld_emulation_xfer_struct ld_elf32ebmip_emulation =
-{
- gldelf32ebmip_before_parse,
- syslib_default,
- hll_default,
- after_parse_default,
- gldelf32ebmip_after_open,
- after_allocation_default,
- set_output_arch_default,
- ldemul_default_target,
- gldelf32ebmip_before_allocation,
- gldelf32ebmip_get_script,
- "elf32ebmip",
- "elf32-bigmips",
- NULL,
- NULL,
- gldelf32ebmip_open_dynamic_archive,
- gldelf32ebmip_place_orphan
-};
diff --git a/ld/mpw-eppcmac.c b/ld/mpw-eppcmac.c
deleted file mode 100644
index 1278097..0000000
--- a/ld/mpw-eppcmac.c
+++ /dev/null
@@ -1,1224 +0,0 @@
-/* This file is is generated by a shell script. DO NOT EDIT! */
-
-/* AIX emulation code for ppcmacos
- Copyright 1991, 1993, 1995, 1996, 1997, 2000, 2001
- Free Software Foundation, Inc.
- Written by Steve Chamberlain <sac@cygnus.com>
- AIX support by Ian Lance Taylor <ian@cygnus.com>
-
-This file is part of GLD, the Gnu Linker.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGET_IS_ppcmacos
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libiberty.h"
-#include "safe-ctype.h"
-#include "getopt.h"
-#include "bfdlink.h"
-
-#include "ld.h"
-#include "ldmain.h"
-#include "ldmisc.h"
-#include "ldexp.h"
-#include "ldlang.h"
-#include "ldctor.h"
-#include "ldgram.h"
-#include "ldfile.h"
-#include "ldemul.h"
-
-static void gldppcmacos_before_parse PARAMS ((void));
-static int gldppcmacos_parse_args PARAMS ((int, char **));
-static void gldppcmacos_after_open PARAMS ((void));
-static void gldppcmacos_before_allocation PARAMS ((void));
-static void gldppcmacos_read_file PARAMS ((const char *, boolean));
-static void gldppcmacos_free PARAMS ((PTR));
-static void gldppcmacos_find_relocs
- PARAMS ((lang_statement_union_type *));
-static void gldppcmacos_find_exp_assignment PARAMS ((etree_type *));
-static char *gldppcmacos_get_script PARAMS ((int *isfile));
-
-/* The file alignment required for each section. */
-static unsigned long file_align;
-
-/* The maximum size the stack is permitted to grow. This is stored in
- the a.out header. */
-static unsigned long maxstack;
-
-/* The maximum data size. This is stored in the a.out header. */
-static unsigned long maxdata;
-
-/* Whether to perform garbage collection. */
-static int gc = 1;
-
-/* The module type to use. */
-static unsigned short modtype = ('1' << 8) | 'L';
-
-/* Whether the .text section must be read-only (i.e., no relocs
- permitted). */
-static int textro;
-
-/* Whether to implement Unix like linker semantics. */
-static int unix_ld;
-
-/* Structure used to hold import file list. */
-
-struct filelist
-{
- struct filelist *next;
- const char *name;
-};
-
-/* List of import files. */
-static struct filelist *import_files;
-
-/* List of export symbols read from the export files. */
-
-struct export_symbol_list
-{
- struct export_symbol_list *next;
- const char *name;
- boolean syscall;
-};
-
-static struct export_symbol_list *export_symbols;
-
-/* This routine is called before anything else is done. */
-
-static void
-gldppcmacos_before_parse()
-{
-#ifndef TARGET_ /* I.e., if not generic. */
- ldfile_output_architecture = bfd_arch_powerpc;
-#endif /* not TARGET_ */
-}
-
-/* Handle AIX specific options. */
-
-static int
-gldppcmacos_parse_args (argc, argv)
- int argc;
- char **argv;
-{
- int prevoptind = optind;
- int prevopterr = opterr;
- int indx;
- int longind;
- int optc;
- long val;
- char *end;
-
-#define OPTION_IGNORE (300)
-#define OPTION_AUTOIMP (OPTION_IGNORE + 1)
-#define OPTION_ERNOTOK (OPTION_AUTOIMP + 1)
-#define OPTION_EROK (OPTION_ERNOTOK + 1)
-#define OPTION_EXPORT (OPTION_EROK + 1)
-#define OPTION_IMPORT (OPTION_EXPORT + 1)
-#define OPTION_LOADMAP (OPTION_IMPORT + 1)
-#define OPTION_MAXDATA (OPTION_LOADMAP + 1)
-#define OPTION_MAXSTACK (OPTION_MAXDATA + 1)
-#define OPTION_MODTYPE (OPTION_MAXSTACK + 1)
-#define OPTION_NOAUTOIMP (OPTION_MODTYPE + 1)
-#define OPTION_NOSTRCMPCT (OPTION_NOAUTOIMP + 1)
-#define OPTION_PD (OPTION_NOSTRCMPCT + 1)
-#define OPTION_PT (OPTION_PD + 1)
-#define OPTION_STRCMPCT (OPTION_PT + 1)
-#define OPTION_UNIX (OPTION_STRCMPCT + 1)
-
- static struct option longopts[] = {
- {"basis", no_argument, NULL, OPTION_IGNORE},
- {"bautoimp", no_argument, NULL, OPTION_AUTOIMP},
- {"bcomprld", no_argument, NULL, OPTION_IGNORE},
- {"bcrld", no_argument, NULL, OPTION_IGNORE},
- {"bcror31", no_argument, NULL, OPTION_IGNORE},
- {"bD", required_argument, NULL, OPTION_MAXDATA},
- {"bE", required_argument, NULL, OPTION_EXPORT},
- {"bernotok", no_argument, NULL, OPTION_ERNOTOK},
- {"berok", no_argument, NULL, OPTION_EROK},
- {"berrmsg", no_argument, NULL, OPTION_IGNORE},
- {"bexport", required_argument, NULL, OPTION_EXPORT},
- {"bf", no_argument, NULL, OPTION_ERNOTOK},
- {"bgc", no_argument, &gc, 1},
- {"bh", required_argument, NULL, OPTION_IGNORE},
- {"bhalt", required_argument, NULL, OPTION_IGNORE},
- {"bI", required_argument, NULL, OPTION_IMPORT},
- {"bimport", required_argument, NULL, OPTION_IMPORT},
- {"bl", required_argument, NULL, OPTION_LOADMAP},
- {"bloadmap", required_argument, NULL, OPTION_LOADMAP},
- {"bmaxdata", required_argument, NULL, OPTION_MAXDATA},
- {"bmaxstack", required_argument, NULL, OPTION_MAXSTACK},
- {"bM", required_argument, NULL, OPTION_MODTYPE},
- {"bmodtype", required_argument, NULL, OPTION_MODTYPE},
- {"bnoautoimp", no_argument, NULL, OPTION_NOAUTOIMP},
- {"bnodelcsect", no_argument, NULL, OPTION_IGNORE},
- {"bnoentry", no_argument, NULL, OPTION_IGNORE},
- {"bnogc", no_argument, &gc, 0},
- {"bnso", no_argument, NULL, OPTION_NOAUTOIMP},
- {"bnostrcmpct", no_argument, NULL, OPTION_NOSTRCMPCT},
- {"bnotextro", no_argument, &textro, 0},
- {"bnro", no_argument, &textro, 0},
- {"bpD", required_argument, NULL, OPTION_PD},
- {"bpT", required_argument, NULL, OPTION_PT},
- {"bro", no_argument, &textro, 1},
- {"bS", required_argument, NULL, OPTION_MAXSTACK},
- {"bso", no_argument, NULL, OPTION_AUTOIMP},
- {"bstrcmpct", no_argument, NULL, OPTION_STRCMPCT},
- {"btextro", no_argument, &textro, 1},
- {"static", no_argument, NULL, OPTION_NOAUTOIMP},
- {"unix", no_argument, NULL, OPTION_UNIX},
- {NULL, no_argument, NULL, 0}
- };
-
- /* Options supported by the AIX linker which we do not support: -f,
- -S, -v, -Z, -bbindcmds, -bbinder, -bbindopts, -bcalls, -bcaps,
- -bcror15, -bdebugopt, -bdbg, -bdelcsect, -bex?, -bfilelist, -bfl,
- -bgcbypass, -bglink, -binsert, -bi, -bloadmap, -bl, -bmap, -bnl,
- -bnobind, -bnocomprld, -bnocrld, -bnoerrmsg, -bnoglink,
- -bnoloadmap, -bnl, -bnoobjreorder, -bnoquiet, -bnoreorder,
- -bnotypchk, -bnox, -bquiet, -bR, -brename, -breorder, -btypchk,
- -bx, -bX, -bxref. */
-
- /* If the current option starts with -b, change the first : to an =.
- The AIX linker uses : to separate the option from the argument;
- changing it to = lets us treat it as a getopt option. */
- indx = optind;
- if (indx == 0)
- indx = 1;
- if (indx < argc && strncmp (argv[indx], "-b", 2) == 0)
- {
- char *s;
-
- for (s = argv[indx]; *s != '\0'; s++)
- {
- if (*s == ':')
- {
- *s = '=';
- break;
- }
- }
- }
-
- opterr = 0;
- optc = getopt_long_only (argc, argv, "-D:H:KT:z", longopts, &longind);
- opterr = prevopterr;
-
- switch (optc)
- {
- default:
- optind = prevoptind;
- return 0;
-
- case 0:
- /* Long option which just sets a flag. */
- break;
-
- case 'D':
- val = strtol (optarg, &end, 0);
- if (*end != '\0')
- einfo (_("%P: warning: ignoring invalid -D number %s\n"), optarg);
- else if (val != -1)
- lang_section_start (".data", exp_intop (val));
- break;
-
- case 'H':
- val = strtoul (optarg, &end, 0);
- if (*end != '\0'
- || (val & (val - 1)) != 0)
- einfo (_("%P: warning: ignoring invalid -H number %s\n"), optarg);
- else
- file_align = val;
- break;
-
- case 'K':
- case 'z':
- /* FIXME: This should use the page size for the target system. */
- file_align = 4096;
- break;
-
- case 'T':
- /* On AIX this is the same as GNU ld -Ttext. When we see -T
- number, we assume the AIX option is intended. Otherwise, we
- assume the usual GNU ld -T option is intended. We can't just
- ignore the AIX option, because gcc passes it to the linker. */
- val = strtoul (optarg, &end, 0);
- if (*end != '\0')
- {
- optind = prevoptind;
- return 0;
- }
- lang_section_start (".text", exp_intop (val));
- break;
-
- case OPTION_IGNORE:
- break;
-
- case OPTION_AUTOIMP:
- link_info.static_link = false;
- break;
-
- case OPTION_ERNOTOK:
- force_make_executable = false;
- break;
-
- case OPTION_EROK:
- force_make_executable = true;
- break;
-
- case OPTION_EXPORT:
- gldppcmacos_read_file (optarg, false);
- break;
-
- case OPTION_IMPORT:
- {
- struct filelist *n;
- struct filelist **flpp;
-
- n = (struct filelist *) xmalloc (sizeof (struct filelist));
- n->next = NULL;
- n->name = optarg;
- flpp = &import_files;
- while (*flpp != NULL)
- flpp = &(*flpp)->next;
- *flpp = n;
- }
- break;
-
- case OPTION_LOADMAP:
- config.map_filename = optarg;
- break;
-
- case OPTION_MAXDATA:
- val = strtoul (optarg, &end, 0);
- if (*end != '\0')
- einfo (_("%P: warning: ignoring invalid -bmaxdata number %s\n"),
- optarg);
- else
- maxdata = val;
- break;
-
- case OPTION_MAXSTACK:
- val = strtoul (optarg, &end, 0);
- if (*end != '\0')
- einfo (_("%P: warning: ignoring invalid -bmaxstack number %s\n"),
- optarg);
- else
- maxstack = val;
- break;
-
- case OPTION_MODTYPE:
- if (*optarg == 'S')
- {
- link_info.shared = true;
- ++optarg;
- }
- if (*optarg == '\0' || optarg[1] == '\0')
- einfo (_("%P: warning: ignoring invalid module type %s\n"), optarg);
- else
- modtype = (*optarg << 8) | optarg[1];
- break;
-
- case OPTION_NOAUTOIMP:
- link_info.static_link = true;
- break;
-
- case OPTION_NOSTRCMPCT:
- link_info.traditional_format = true;
- break;
-
- case OPTION_PD:
- /* This sets the page that the .data section is supposed to
- start on. The offset within the page should still be the
- offset within the file, so we need to build an appropriate
- expression. */
- val = strtoul (optarg, &end, 0);
- if (*end != '\0')
- einfo (_("%P: warning: ignoring invalid -pD number %s\n"), optarg);
- else
- {
- etree_type *t;
-
- t = exp_binop ('+',
- exp_intop (val),
- exp_binop ('&',
- exp_nameop (NAME, "."),
- exp_intop (0xfff)));
- t = exp_binop ('&',
- exp_binop ('+', t, exp_intop (7)),
- exp_intop (~ (bfd_vma) 7));
- lang_section_start (".data", t);
- }
- break;
-
- case OPTION_PT:
- /* This set the page that the .text section is supposed to start
- on. The offset within the page should still be the offset
- within the file. */
- val = strtoul (optarg, &end, 0);
- if (*end != '\0')
- einfo (_("%P: warning: ignoring invalid -pT number %s\n"), optarg);
- else
- {
- etree_type *t;
-
- t = exp_binop ('+',
- exp_intop (val),
- exp_nameop (SIZEOF_HEADERS, NULL));
- t = exp_binop ('&',
- exp_binop ('+', t, exp_intop (7)),
- exp_intop (~ (bfd_vma) 7));
- lang_section_start (".text", t);
- }
- break;
-
- case OPTION_STRCMPCT:
- link_info.traditional_format = false;
- break;
-
- case OPTION_UNIX:
- unix_ld = true;
- break;
- }
-
- return 1;
-}
-
-/* This is called when an input file can not be recognized as a BFD
- object or an archive. If the file starts with #!, we must treat it
- as an import file. This is for AIX compatibility. */
-
-static boolean
-gldppcmacos_unrecognized_file (entry)
- lang_input_statement_type *entry;
-{
- FILE *e;
- boolean ret;
-
- e = fopen (entry->filename, FOPEN_RT);
- if (e == NULL)
- return false;
-
- ret = false;
-
- if (getc (e) == '#' && getc (e) == '!')
- {
- struct filelist *n;
- struct filelist **flpp;
-
- n = (struct filelist *) xmalloc (sizeof (struct filelist));
- n->next = NULL;
- n->name = entry->filename;
- flpp = &import_files;
- while (*flpp != NULL)
- flpp = &(*flpp)->next;
- *flpp = n;
-
- ret = true;
- entry->loaded = true;
- }
-
- fclose (e);
-
- return ret;
-}
-
-/* This is called after the input files have been opened. */
-
-static void
-gldppcmacos_after_open ()
-{
- boolean r;
- struct set_info *p;
-
- /* Call ldctor_build_sets, after pretending that this is a
- relocateable link. We do this because AIX requires relocation
- entries for all references to symbols, even in a final
- executable. Of course, we only want to do this if we are
- producing an XCOFF output file. */
- r = link_info.relocateable;
- if (strstr (bfd_get_target (output_bfd), "xcoff") != NULL)
- link_info.relocateable = true;
- ldctor_build_sets ();
- link_info.relocateable = r;
-
- /* For each set, record the size, so that the XCOFF backend can
- output the correct csect length. */
- for (p = sets; p != (struct set_info *) NULL; p = p->next)
- {
- bfd_size_type size;
-
- /* If the symbol is defined, we may have been invoked from
- collect, and the sets may already have been built, so we do
- not do anything. */
- if (p->h->type == bfd_link_hash_defined
- || p->h->type == bfd_link_hash_defweak)
- continue;
-
- if (p->reloc != BFD_RELOC_CTOR)
- {
- /* Handle this if we need to. */
- abort ();
- }
-
- size = (p->count + 2) * 4;
- if (! bfd_xcoff_link_record_set (output_bfd, &link_info, p->h, size))
- einfo (_("%F%P: bfd_xcoff_link_record_set failed: %E\n"));
- }
-}
-
-/* This is called after the sections have been attached to output
- sections, but before any sizes or addresses have been set. */
-
-static void
-gldppcmacos_before_allocation ()
-{
- struct filelist *fl;
- struct export_symbol_list *el;
- char *libpath;
- asection *special_sections[6];
- int i;
-
- /* Handle the import and export files, if any. */
- for (fl = import_files; fl != NULL; fl = fl->next)
- gldppcmacos_read_file (fl->name, true);
- for (el = export_symbols; el != NULL; el = el->next)
- {
- struct bfd_link_hash_entry *h;
-
- h = bfd_link_hash_lookup (link_info.hash, el->name, false, false, false);
- if (h == NULL)
- einfo (_("%P%F: bfd_link_hash_lookup of export symbol failed: %E\n"));
- if (! bfd_xcoff_export_symbol (output_bfd, &link_info, h, el->syscall))
- einfo (_("%P%F: bfd_xcoff_export_symbol failed: %E\n"));
- }
-
- /* Track down all relocations called for by the linker script (these
- are typically constructor/destructor entries created by
- CONSTRUCTORS) and let the backend know it will need to create
- .loader relocs for them. */
- lang_for_each_statement (gldppcmacos_find_relocs);
-
- /* We need to build LIBPATH from the -L arguments. If any -rpath
- arguments were used, though, we use -rpath instead, as a GNU
- extension. */
- if (command_line.rpath != NULL)
- libpath = command_line.rpath;
- else if (search_head == NULL)
- libpath = (char *) "";
- else
- {
- size_t len;
- search_dirs_type *search;
-
- len = strlen (search_head->name);
- libpath = xmalloc (len + 1);
- strcpy (libpath, search_head->name);
- for (search = search_head->next; search != NULL; search = search->next)
- {
- size_t nlen;
-
- nlen = strlen (search->name);
- libpath = xrealloc (libpath, len + nlen + 2);
- libpath[len] = ':';
- strcpy (libpath + len + 1, search->name);
- len += nlen + 1;
- }
- }
-
- /* Let the XCOFF backend set up the .loader section. */
- if (! bfd_xcoff_size_dynamic_sections (output_bfd, &link_info, libpath,
- entry_symbol, file_align,
- maxstack, maxdata,
- gc && ! unix_ld ? true : false,
- modtype,
- textro ? true : false,
- unix_ld,
- special_sections))
- einfo (_("%P%F: failed to set dynamic section sizes: %E\n"));
-
- /* Look through the special sections, and put them in the right
- place in the link ordering. This is especially magic. */
- for (i = 0; i < 6; i++)
- {
- asection *sec;
- lang_output_section_statement_type *os;
- lang_statement_union_type **pls;
- lang_input_section_type *is;
- const char *oname;
- boolean start;
-
- sec = special_sections[i];
- if (sec == NULL)
- continue;
-
- /* Remove this section from the list of the output section.
- This assumes we know what the script looks like. */
- is = NULL;
- os = lang_output_section_find (sec->output_section->name);
- if (os == NULL)
- einfo (_("%P%F: can't find output section %s\n"),
- sec->output_section->name);
- for (pls = &os->children.head; *pls != NULL; pls = &(*pls)->header.next)
- {
- if ((*pls)->header.type == lang_input_section_enum
- && (*pls)->input_section.section == sec)
- {
- is = (lang_input_section_type *) *pls;
- *pls = (*pls)->header.next;
- break;
- }
- if ((*pls)->header.type == lang_wild_statement_enum)
- {
- lang_statement_union_type **pwls;
-
- for (pwls = &(*pls)->wild_statement.children.head;
- *pwls != NULL;
- pwls = &(*pwls)->header.next)
- {
- if ((*pwls)->header.type == lang_input_section_enum
- && (*pwls)->input_section.section == sec)
- {
- is = (lang_input_section_type *) *pwls;
- *pwls = (*pwls)->header.next;
- break;
- }
- }
- if (is != NULL)
- break;
- }
- }
-
- if (is == NULL)
- einfo (_("%P%F: can't find %s in output section\n"),
- bfd_get_section_name (sec->owner, sec));
-
- /* Now figure out where the section should go. */
- switch (i)
- {
- default: /* to avoid warnings */
- case 0:
- /* _text */
- oname = ".text";
- start = true;
- break;
- case 1:
- /* _etext */
- oname = ".text";
- start = false;
- break;
- case 2:
- /* _data */
- oname = ".data";
- start = true;
- break;
- case 3:
- /* _edata */
- oname = ".data";
- start = false;
- break;
- case 4:
- case 5:
- /* _end and end */
- oname = ".bss";
- start = false;
- break;
- }
-
- os = lang_output_section_find (oname);
-
- if (start)
- {
- is->header.next = os->children.head;
- os->children.head = (lang_statement_union_type *) is;
- }
- else
- {
- is->header.next = NULL;
- lang_statement_append (&os->children,
- (lang_statement_union_type *) is,
- &is->header.next);
- }
- }
-}
-
-/* Read an import or export file. For an import file, this is called
- by the before_allocation emulation routine. For an export file,
- this is called by the parse_args emulation routine. */
-
-static void
-gldppcmacos_read_file (filename, import)
- const char *filename;
- boolean import;
-{
- struct obstack *o;
- FILE *f;
- int lineno;
- int c;
- boolean keep;
- const char *imppath;
- const char *impfile;
- const char *impmember;
-
- o = (struct obstack *) xmalloc (sizeof (struct obstack));
- obstack_specify_allocation (o, 0, 0, xmalloc, gldppcmacos_free);
-
- f = fopen (filename, FOPEN_RT);
- if (f == NULL)
- {
- bfd_set_error (bfd_error_system_call);
- einfo ("%F%s: %E\n", filename);
- }
-
- keep = false;
-
- imppath = NULL;
- impfile = NULL;
- impmember = NULL;
-
- lineno = 0;
- while ((c = getc (f)) != EOF)
- {
- char *s;
- char *symname;
- boolean syscall;
- bfd_vma address;
- struct bfd_link_hash_entry *h;
-
- if (c != '\n')
- {
- obstack_1grow (o, c);
- continue;
- }
-
- obstack_1grow (o, '\0');
- ++lineno;
-
- s = (char *) obstack_base (o);
- while (ISSPACE (*s))
- ++s;
- if (*s == '\0'
- || *s == '*'
- || (*s == '#' && s[1] == ' ')
- || (! import && *s == '#' && s[1] == '!'))
- {
- obstack_free (o, obstack_base (o));
- continue;
- }
-
- if (*s == '#' && s[1] == '!')
- {
- s += 2;
- while (ISSPACE (*s))
- ++s;
- if (*s == '\0')
- {
- imppath = NULL;
- impfile = NULL;
- impmember = NULL;
- obstack_free (o, obstack_base (o));
- }
- else if (*s == '(')
- einfo (_("%F%s%d: #! ([member]) is not supported in import files\n"),
- filename, lineno);
- else
- {
- char cs;
- char *file;
-
- (void) obstack_finish (o);
- keep = true;
- imppath = s;
- file = NULL;
- while (! ISSPACE (*s) && *s != '(' && *s != '\0')
- {
- if (*s == '/')
- file = s + 1;
- ++s;
- }
- if (file != NULL)
- {
- file[-1] = '\0';
- impfile = file;
- if (imppath == file - 1)
- imppath = "/";
- }
- else
- {
- impfile = imppath;
- imppath = "";
- }
- cs = *s;
- *s = '\0';
- while (ISSPACE (cs))
- {
- ++s;
- cs = *s;
- }
- if (cs != '(')
- {
- impmember = "";
- if (cs != '\0')
- einfo (_("%s:%d: warning: syntax error in import file\n"),
- filename, lineno);
- }
- else
- {
- ++s;
- impmember = s;
- while (*s != ')' && *s != '\0')
- ++s;
- if (*s == ')')
- *s = '\0';
- else
- einfo (_("%s:%d: warning: syntax error in import file\n"),
- filename, lineno);
- }
- }
-
- continue;
- }
-
- /* This is a symbol to be imported or exported. */
- symname = s;
- syscall = false;
- address = (bfd_vma) -1;
-
- while (! ISSPACE (*s) && *s != '\0')
- ++s;
- if (*s != '\0')
- {
- char *se;
-
- *s++ = '\0';
-
- while (ISSPACE (*s))
- ++s;
-
- se = s;
- while (! ISSPACE (*se) && *se != '\0')
- ++se;
- if (*se != '\0')
- {
- *se++ = '\0';
- while (ISSPACE (*se))
- ++se;
- if (*se != '\0')
- einfo (_("%s%d: warning: syntax error in import/export file\n"),
- filename, lineno);
- }
-
- if (strcasecmp (s, "svc") == 0
- || strcasecmp (s, "syscall") == 0)
- syscall = true;
- else
- {
- char *end;
-
- address = strtoul (s, &end, 0);
- if (*end != '\0')
- einfo (_("%s:%d: warning: syntax error in import/export file\n"),
- filename, lineno);
- }
- }
-
- if (! import)
- {
- struct export_symbol_list *n;
-
- ldlang_add_undef (symname);
- n = ((struct export_symbol_list *)
- xmalloc (sizeof (struct export_symbol_list)));
- n->next = export_symbols;
- n->name = xstrdup (symname);
- n->syscall = syscall;
- export_symbols = n;
- }
- else
- {
- h = bfd_link_hash_lookup (link_info.hash, symname, false, false,
- true);
- if (h == NULL || h->type == bfd_link_hash_new)
- {
- /* We can just ignore attempts to import an unreferenced
- symbol. */
- }
- else
- {
- if (! bfd_xcoff_import_symbol (output_bfd, &link_info, h,
- address, imppath, impfile,
- impmember))
- einfo (_("%X%s:%d: failed to import symbol %s: %E\n"),
- filename, lineno, symname);
- }
- }
-
- obstack_free (o, obstack_base (o));
- }
-
- if (obstack_object_size (o) > 0)
- {
- einfo (_("%s:%d: warning: ignoring unterminated last line\n"),
- filename, lineno);
- obstack_free (o, obstack_base (o));
- }
-
- if (! keep)
- {
- obstack_free (o, NULL);
- free (o);
- }
-}
-
-/* This routine saves us from worrying about declaring free. */
-
-static void
-gldppcmacos_free (p)
- PTR p;
-{
- free (p);
-}
-
-/* This is called by the before_allocation routine via
- lang_for_each_statement. It looks for relocations and assignments
- to symbols. */
-
-static void
-gldppcmacos_find_relocs (s)
- lang_statement_union_type *s;
-{
- if (s->header.type == lang_reloc_statement_enum)
- {
- lang_reloc_statement_type *rs;
-
- rs = &s->reloc_statement;
- if (rs->name == NULL)
- einfo (_("%F%P: only relocations against symbols are permitted\n"));
- if (! bfd_xcoff_link_count_reloc (output_bfd, &link_info, rs->name))
- einfo (_("%F%P: bfd_xcoff_link_count_reloc failed: %E\n"));
- }
-
- if (s->header.type == lang_assignment_statement_enum)
- gldppcmacos_find_exp_assignment (s->assignment_statement.exp);
-}
-
-/* Look through an expression for an assignment statement. */
-
-static void
-gldppcmacos_find_exp_assignment (exp)
- etree_type *exp;
-{
- struct bfd_link_hash_entry *h;
-
- switch (exp->type.node_class)
- {
- case etree_provide:
- h = bfd_link_hash_lookup (link_info.hash, exp->assign.dst,
- false, false, false);
- if (h == NULL)
- break;
- /* Fall through. */
- case etree_assign:
- if (strcmp (exp->assign.dst, ".") != 0)
- {
- if (! bfd_xcoff_record_link_assignment (output_bfd, &link_info,
- exp->assign.dst))
- einfo (_("%P%F: failed to record assignment to %s: %E\n"),
- exp->assign.dst);
- }
- gldppcmacos_find_exp_assignment (exp->assign.src);
- break;
-
- case etree_binary:
- gldppcmacos_find_exp_assignment (exp->binary.lhs);
- gldppcmacos_find_exp_assignment (exp->binary.rhs);
- break;
-
- case etree_trinary:
- gldppcmacos_find_exp_assignment (exp->trinary.cond);
- gldppcmacos_find_exp_assignment (exp->trinary.lhs);
- gldppcmacos_find_exp_assignment (exp->trinary.rhs);
- break;
-
- case etree_unary:
- gldppcmacos_find_exp_assignment (exp->unary.child);
- break;
-
- default:
- break;
- }
-}
-
-static char *
-gldppcmacos_get_script(isfile)
- int *isfile;
-{
- *isfile = 0;
-
- if (link_info.relocateable == true && config.build_constructors == true)
- return
-"OUTPUT_FORMAT(\"xcoff-powermac\")\n\
-OUTPUT_ARCH(powerpc)\n\
-ENTRY(__start)\n\
-SECTIONS\n\
-{\n\
- .pad 0 : { *(.pad) }\n\
- .text 0 : {\n\
- *(.text)\n\
- *(.pr)\n\
- *(.ro)\n\
- *(.db)\n\
- *(.gl)\n\
- *(.xo)\n\
- *(.ti)\n\
- *(.tb)\n\
- }\n\
- .data 0 : {\n\
- *(.data)\n\
- *(.rw)\n\
- *(.sv)\n\
- *(.ua)\n\
- . = ALIGN(4);\n\
- CONSTRUCTORS\n\
- *(.ds)\n\
- *(.tc0)\n\
- *(.tc)\n\
- *(.td)\n\
- }\n\
- .bss : {\n\
- *(.bss)\n\
- *(.bs)\n\
- *(.uc)\n\
- *(COMMON)\n\
- }\n\
- .loader 0 : {\n\
- *(.loader)\n\
- }\n\
- .debug 0 : {\n\
- *(.debug)\n\
- }\n\
-}\n\n"
- ; else if (link_info.relocateable == true) return
-"OUTPUT_FORMAT(\"xcoff-powermac\")\n\
-OUTPUT_ARCH(powerpc)\n\
-ENTRY(__start)\n\
-SECTIONS\n\
-{\n\
- .pad 0 : { *(.pad) }\n\
- .text 0 : {\n\
- *(.text)\n\
- *(.pr)\n\
- *(.ro)\n\
- *(.db)\n\
- *(.gl)\n\
- *(.xo)\n\
- *(.ti)\n\
- *(.tb)\n\
- }\n\
- .data 0 : {\n\
- *(.data)\n\
- *(.rw)\n\
- *(.sv)\n\
- *(.ua)\n\
- . = ALIGN(4);\n\
- *(.ds)\n\
- *(.tc0)\n\
- *(.tc)\n\
- *(.td)\n\
- }\n\
- .bss : {\n\
- *(.bss)\n\
- *(.bs)\n\
- *(.uc)\n\
- *(COMMON)\n\
- }\n\
- .loader 0 : {\n\
- *(.loader)\n\
- }\n\
- .debug 0 : {\n\
- *(.debug)\n\
- }\n\
-}\n\n"
- ; else if (!config.text_read_only) return
-"OUTPUT_FORMAT(\"xcoff-powermac\")\n\
-OUTPUT_ARCH(powerpc)\n\
- SEARCH_DIR(/usr/local/powerpc-apple-macos/lib);\n\
-ENTRY(__start)\n\
-SECTIONS\n\
-{\n\
- .pad 0 : { *(.pad) }\n\
- .text : {\n\
- PROVIDE (_text = .);\n\
- *(.text)\n\
- *(.pr)\n\
- *(.ro)\n\
- *(.db)\n\
- *(.gl)\n\
- *(.xo)\n\
- *(.ti)\n\
- *(.tb)\n\
- PROVIDE (_etext = .);\n\
- }\n\
- .data 0 : {\n\
- PROVIDE (_data = .);\n\
- *(.data)\n\
- *(.rw)\n\
- *(.sv)\n\
- *(.ua)\n\
- . = ALIGN(4);\n\
- CONSTRUCTORS\n\
- *(.ds)\n\
- *(.tc0)\n\
- *(.tc)\n\
- *(.td)\n\
- PROVIDE (_edata = .);\n\
- }\n\
- .bss : {\n\
- *(.bss)\n\
- *(.bs)\n\
- *(.uc)\n\
- *(COMMON)\n\
- PROVIDE (_end = .);\n\
- PROVIDE (end = .);\n\
- }\n\
- .loader 0 : {\n\
- *(.loader)\n\
- }\n\
- .debug 0 : {\n\
- *(.debug)\n\
- }\n\
-}\n\n"
- ; else if (!config.magic_demand_paged) return
-"OUTPUT_FORMAT(\"xcoff-powermac\")\n\
-OUTPUT_ARCH(powerpc)\n\
- SEARCH_DIR(/usr/local/powerpc-apple-macos/lib);\n\
-ENTRY(__start)\n\
-SECTIONS\n\
-{\n\
- .pad 0 : { *(.pad) }\n\
- .text : {\n\
- PROVIDE (_text = .);\n\
- *(.text)\n\
- *(.pr)\n\
- *(.ro)\n\
- *(.db)\n\
- *(.gl)\n\
- *(.xo)\n\
- *(.ti)\n\
- *(.tb)\n\
- PROVIDE (_etext = .);\n\
- }\n\
- .data 0 : {\n\
- PROVIDE (_data = .);\n\
- *(.data)\n\
- *(.rw)\n\
- *(.sv)\n\
- *(.ua)\n\
- . = ALIGN(4);\n\
- CONSTRUCTORS\n\
- *(.ds)\n\
- *(.tc0)\n\
- *(.tc)\n\
- *(.td)\n\
- PROVIDE (_edata = .);\n\
- }\n\
- .bss : {\n\
- *(.bss)\n\
- *(.bs)\n\
- *(.uc)\n\
- *(COMMON)\n\
- PROVIDE (_end = .);\n\
- PROVIDE (end = .);\n\
- }\n\
- .loader 0 : {\n\
- *(.loader)\n\
- }\n\
- .debug 0 : {\n\
- *(.debug)\n\
- }\n\
-}\n\n"
- ; else return
-"OUTPUT_FORMAT(\"xcoff-powermac\")\n\
-OUTPUT_ARCH(powerpc)\n\
- SEARCH_DIR(/usr/local/powerpc-apple-macos/lib);\n\
-ENTRY(__start)\n\
-SECTIONS\n\
-{\n\
- .pad 0 : { *(.pad) }\n\
- .text : {\n\
- PROVIDE (_text = .);\n\
- *(.text)\n\
- *(.pr)\n\
- *(.ro)\n\
- *(.db)\n\
- *(.gl)\n\
- *(.xo)\n\
- *(.ti)\n\
- *(.tb)\n\
- PROVIDE (_etext = .);\n\
- }\n\
- .data 0 : {\n\
- PROVIDE (_data = .);\n\
- *(.data)\n\
- *(.rw)\n\
- *(.sv)\n\
- *(.ua)\n\
- . = ALIGN(4);\n\
- CONSTRUCTORS\n\
- *(.ds)\n\
- *(.tc0)\n\
- *(.tc)\n\
- *(.td)\n\
- PROVIDE (_edata = .);\n\
- }\n\
- .bss : {\n\
- *(.bss)\n\
- *(.bs)\n\
- *(.uc)\n\
- *(COMMON)\n\
- PROVIDE (_end = .);\n\
- PROVIDE (end = .);\n\
- }\n\
- .loader 0 : {\n\
- *(.loader)\n\
- }\n\
- .debug 0 : {\n\
- *(.debug)\n\
- }\n\
-}\n\n"
-; }
-
-struct ld_emulation_xfer_struct ld_ppcmacos_emulation =
-{
- gldppcmacos_before_parse,
- syslib_default,
- hll_default,
- after_parse_default,
- gldppcmacos_after_open,
- after_allocation_default,
- set_output_arch_default,
- ldemul_default_target,
- gldppcmacos_before_allocation,
- gldppcmacos_get_script,
- "ppcmacos",
- "xcoff-powermac",
- 0, /* finish */
- 0, /* create_output_section_statements */
- 0, /* open_dynamic_archive */
- 0, /* place_orphan */
- 0, /* set_symbols */
- gldppcmacos_parse_args,
- gldppcmacos_unrecognized_file
-};
diff --git a/ld/mpw-esh.c b/ld/mpw-esh.c
deleted file mode 100644
index 2a0302c..0000000
--- a/ld/mpw-esh.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/* This file is is generated by a shell script. DO NOT EDIT! */
-
-/* emulate the original gld for the given sh
- Copyright 1991, 1993, 1995, 2000 Free Software Foundation, Inc.
- Written by Steve Chamberlain steve@cygnus.com
-
-This file is part of GLD, the Gnu Linker.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGET_IS_sh
-
-#include "libiberty.h"
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-
-#include "ld.h"
-#include "ldmain.h"
-#include "ldmisc.h"
-
-#include "ldexp.h"
-#include "ldlang.h"
-#include "ldfile.h"
-#include "ldemul.h"
-
-static void gldsh_before_parse PARAMS ((void));
-static char *gldsh_get_script PARAMS ((int *isfile));
-
-static void
-gldsh_before_parse()
-{
-#ifndef TARGET_ /* I.e., if not generic. */
- ldfile_output_architecture = bfd_arch_sh;
-#endif /* not TARGET_ */
-}
-
-static char *
-gldsh_get_script(isfile)
- int *isfile;
-{
- *isfile = 0;
-
- if (link_info.relocateable == true && config.build_constructors == true)
- return
-concat(
-"OUTPUT_FORMAT(\"coff-sh\")\n\
-OUTPUT_ARCH(sh)\n\
-MEMORY\n\
-{\n\
- ram : o = 0x1000, l = 512k\n\
-}\n\
- "," SECTIONS\n\
-{\n\
- "," .text :\n\
- {\n\
- *(.text)\n\
- *(.strings)\n\
- } \n\
- .tors :\n\
- {\n\
- ___ctors = . ;\n\
- *(.ctors)\n\
- ___ctors_end = . ;\n\
- ___dtors = . ;\n\
- *(.dtors)\n\
- ___dtors_end = . ;\n\
- } \n\
- "," .data :\n\
- {\n\
- *(.data)\n\
- } \n\
- "," .bss :\n\
- {\n\
- *(.bss)\n\
- *(COMMON)\n\
- } \n\
- "," .stack :\n\
- {\n\
- *(.stack)\n\
- } \n\
- "," .stab 0 :\n\
- {\n\
- *(.stab)\n\
- }\n\
- "," .stabstr 0 :\n\
- {\n\
- *(.stabstr)\n\
- }\n\
-}\n\n", NULL)
- ; else if (link_info.relocateable == true) return
-concat (
-"OUTPUT_FORMAT(\"coff-sh\")\n\
-OUTPUT_ARCH(sh)\n\
- "," MEMORY\n\
-{\n\
- ram : o = 0x1000, l = 512k\n\
-}\n\
- "," SECTIONS\n\
-{\n\
- "," .text :\n\
- {\n\
- *(.text)\n\
- *(.strings)\n\
- } \n\
- "," .tors :\n\
- {\n\
- ___ctors = . ;\n\
- *(.ctors)\n\
- ___ctors_end = . ;\n\
- ___dtors = . ;\n\
- *(.dtors)\n\
- ___dtors_end = . ;\n\
- } \n\
- "," .data :\n\
- {\n\
- *(.data)\n\
- } \n\
- "," .bss :\n\
- {\n\
- *(.bss)\n\
- *(COMMON)\n\
- } \n\
- "," .stack :\n\
- {\n\
- *(.stack)\n\
- } \n\
- "," .stab 0 :\n\
- {\n\
- *(.stab)\n\
- }\n\
- "," .stabstr 0 :\n\
- {\n\
- *(.stabstr)\n\
- }\n\
-}\n\n", NULL)
- ; else if (!config.text_read_only) return
-concat (
-"OUTPUT_FORMAT(\"coff-sh\")\n\
-OUTPUT_ARCH(sh)\n\
-MEMORY\n\
-{\n\
- ram : o = 0x1000, l = 512k\n\
-}\n\
-SECTIONS\n\
-{\n\
- "," .text :\n\
- {\n\
- *(.text)\n\
- *(.strings)\n\
- _etext = . ; \n\
- } > ram\n\
- "," .tors :\n\
- {\n\
- ___ctors = . ;\n\
- *(.ctors)\n\
- ___ctors_end = . ;\n\
- ___dtors = . ;\n\
- *(.dtors)\n\
- ___dtors_end = . ;\n\
- } > ram\n\
- "," .data :\n\
- {\n\
- *(.data)\n\
- _edata = . ; \n\
- } > ram\n\
- "," .bss :\n\
- {\n\
- _bss_start = . ; \n\
- *(.bss)\n\
- *(COMMON)\n\
- _end = . ; \n\
- } > ram\n\
- "," .stack 0x30000 :\n\
- {\n\
- _stack = . ; \n\
- *(.stack)\n\
- } > ram\n\
- "," .stab 0 (NOLOAD) :\n\
- {\n\
- *(.stab)\n\
- }\n\
- "," .stabstr 0 (NOLOAD) :\n\
- {\n\
- *(.stabstr)\n\
- }\n\
-}\n\n", NULL)
- ; else if (!config.magic_demand_paged) return
-concat (
-"OUTPUT_FORMAT(\"coff-sh\")\n\
-OUTPUT_ARCH(sh)\n\
-MEMORY\n\
-{\n\
- ram : o = 0x1000, l = 512k\n\
-}\n\
-SECTIONS\n\
-{\n\
- "," .text :\n\
- {\n\
- *(.text)\n\
- *(.strings)\n\
- _etext = . ; \n\
- } > ram\n\
- "," .tors :\n\
- {\n\
- ___ctors = . ;\n\
- *(.ctors)\n\
- ___ctors_end = . ;\n\
- ___dtors = . ;\n\
- *(.dtors)\n\
- ___dtors_end = . ;\n\
- } > ram\n\
- "," .data :\n\
- {\n\
- *(.data)\n\
- _edata = . ; \n\
- } > ram\n\
- "," .bss :\n\
- {\n\
- _bss_start = . ; \n\
- *(.bss)\n\
- *(COMMON)\n\
- _end = . ; \n\
- } > ram\n\
- "," .stack 0x30000 :\n\
- {\n\
- _stack = . ; \n\
- *(.stack)\n\
- } > ram\n\
- "," .stab 0 (NOLOAD) :\n\
- {\n\
- *(.stab)\n\
- }\n\
- "," .stabstr 0 (NOLOAD) :\n\
- {\n\
- *(.stabstr)\n\
- }\n\
-}\n\n", NULL)
- ; else return
-concat (
-"OUTPUT_FORMAT(\"coff-sh\")\n\
-OUTPUT_ARCH(sh)\n\
-MEMORY\n\
-{\n\
- ram : o = 0x1000, l = 512k\n\
-}\n\
-SECTIONS\n\
-{\n\
- "," .text :\n\
- {\n\
- *(.text)\n\
- *(.strings)\n\
- _etext = . ; \n\
- } > ram\n\
- "," .tors :\n\
- {\n\
- ___ctors = . ;\n\
- *(.ctors)\n\
- ___ctors_end = . ;\n\
- ___dtors = . ;\n\
- *(.dtors)\n\
- ___dtors_end = . ;\n\
- } > ram\n\
- "," .data :\n\
- {\n\
- *(.data)\n\
- _edata = . ; \n\
- } > ram\n\
- "," .bss :\n\
- {\n\
- _bss_start = . ; \n\
- *(.bss)\n\
- *(COMMON)\n\
- _end = . ; \n\
- } > ram\n\
- "," .stack 0x30000 :\n\
- {\n\
- _stack = . ; \n\
- *(.stack)\n\
- } > ram\n\
- "," .stab 0 (NOLOAD) :\n\
- {\n\
- *(.stab)\n\
- }\n\
- "," .stabstr 0 (NOLOAD) :\n\
- {\n\
- *(.stabstr)\n\
- }\n\
-}\n\n", NULL)
-; }
-
-struct ld_emulation_xfer_struct ld_sh_emulation =
-{
- gldsh_before_parse,
- syslib_default,
- hll_default,
- after_parse_default,
- after_open_default,
- after_allocation_default,
- set_output_arch_default,
- ldemul_default_target,
- before_allocation_default,
- gldsh_get_script,
- "sh",
- "coff-sh"
-};
diff --git a/ld/mpw-idtmips.c b/ld/mpw-idtmips.c
deleted file mode 100644
index a602397..0000000
--- a/ld/mpw-idtmips.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/* This file is is generated by a shell script. DO NOT EDIT! */
-
-/* Handle embedded relocs for MIPS.
- Copyright 1994, 1997, 2000 Free Software Foundation, Inc.
- Written by Ian Lance Taylor <ian@cygnus.com> based on generic.em.
-
-This file is part of GLD, the Gnu Linker.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#define TARGET_IS_mipsidt
-
-#include "libiberty.h"
-#include "bfd.h"
-#include "sysdep.h"
-#include "bfdlink.h"
-
-#include "ld.h"
-#include "ldmain.h"
-#include "ldmisc.h"
-
-#include "ldexp.h"
-#include "ldlang.h"
-#include "ldfile.h"
-#include "ldemul.h"
-
-static void gldmipsidt_before_parse PARAMS ((void));
-static void gldmipsidt_after_open PARAMS ((void));
-static void check_sections PARAMS ((bfd *, asection *, PTR));
-static void gldmipsidt_after_allocation PARAMS ((void));
-static char *gldmipsidt_get_script PARAMS ((int *isfile));
-
-static void
-gldmipsidt_before_parse()
-{
-#ifndef TARGET_ /* I.e., if not generic. */
- ldfile_output_architecture = bfd_arch_mips;
-#endif /* not TARGET_ */
-}
-
-/* This function is run after all the input files have been opened.
- We create a .rel.sdata section for each input file with a non zero
- .sdata section. The BFD backend will fill in these sections with
- magic numbers which can be used to relocate the data section at run
- time. This will only do the right thing if all the input files
- have been compiled using -membedded-pic. */
-
-static void
-gldmipsidt_after_open ()
-{
- bfd *abfd;
-
- if (! command_line.embedded_relocs
- || link_info.relocateable)
- return;
-
- for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next)
- {
- asection *datasec;
-
- datasec = bfd_get_section_by_name (abfd, ".sdata");
-
- /* Note that we assume that the reloc_count field has already
- been set up. We could call bfd_get_reloc_upper_bound, but
- that returns the size of a memory buffer rather than a reloc
- count. We do not want to call bfd_canonicalize_reloc,
- because although it would always work it would force us to
- read in the relocs into BFD canonical form, which would waste
- a significant amount of time and memory. */
- if (datasec != NULL && datasec->reloc_count > 0)
- {
- asection *relsec;
-
- relsec = bfd_make_section (abfd, ".rel.sdata");
- if (relsec == NULL
- || ! bfd_set_section_flags (abfd, relsec,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY))
- || ! bfd_set_section_alignment (abfd, relsec, 2)
- || ! bfd_set_section_size (abfd, relsec,
- datasec->reloc_count * 4))
- einfo (_("%F%B: can not create .rel.sdata section: %E\n"));
- }
-
- /* Double check that all other data sections are empty, as is
- required for embedded PIC code. */
- bfd_map_over_sections (abfd, check_sections, (PTR) datasec);
- }
-}
-
-/* Check that of the data sections, only the .sdata section has
- relocs. This is called via bfd_map_over_sections. */
-
-static void
-check_sections (abfd, sec, sdatasec)
- bfd *abfd;
- asection *sec;
- PTR sdatasec;
-{
- if ((bfd_get_section_flags (abfd, sec) & SEC_CODE) == 0
- && sec != (asection *) sdatasec
- && sec->reloc_count != 0)
- einfo (_("%F%X: section %s has relocs; can not use --embedded-relocs\n"),
- abfd, bfd_get_section_name (abfd, sec));
-}
-
-/* This function is called after the section sizes and offsets have
- been set. If we are generating embedded relocs, it calls a special
- BFD backend routine to do the work. */
-
-static void
-gldmipsidt_after_allocation ()
-{
- bfd *abfd;
-
- if (! command_line.embedded_relocs
- || link_info.relocateable)
- return;
-
- for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next)
- {
- asection *datasec, *relsec;
- char *errmsg;
-
- datasec = bfd_get_section_by_name (abfd, ".sdata");
-
- if (datasec == NULL || datasec->reloc_count == 0)
- continue;
-
- relsec = bfd_get_section_by_name (abfd, ".rel.sdata");
- ASSERT (relsec != NULL);
-
- if (! bfd_mips_ecoff_create_embedded_relocs (abfd, &link_info,
- datasec, relsec,
- &errmsg))
- {
- if (errmsg == NULL)
- einfo (_("%B%X: can not create runtime reloc information: %E\n"),
- abfd);
- else
- einfo (_("%X%B: can not create runtime reloc information: %s\n"),
- abfd, errmsg);
- }
- }
-}
-
-static char *
-gldmipsidt_get_script(isfile)
- int *isfile;
-{
- *isfile = 0;
-
- if (link_info.relocateable == true && config.build_constructors == true)
- return
-concat(
-"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\
- \"ecoff-littlemips\")\n\
- SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\
-ENTRY(start)\n\
-SECTIONS\n\
-{\n\
- .text : {\n\
- ;\n\
- *(.init)\n\
- ;\n\
- *(.text)\n\
- *(.rel.sdata)\n\
- *(.fini)\n\
- ;\n\
- ;\n\
- }\n\
- "," .rdata : {\n\
- *(.rdata)\n\
- }\n\
- .data : {\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- .lit8 : {\n\
- *(.lit8)\n\
- }\n\
- .lit4 : {\n\
- *(.lit4)\n\
- }\n\
- "," .sdata : {\n\
- *(.sdata)\n\
- }\n\
- .sbss : {\n\
- *(.sbss)\n\
- *(.scommon)\n\
- }\n\
- .bss : {\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
-}\n\n", NULL)
- ; else if (link_info.relocateable == true) return
-"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\
- \"ecoff-littlemips\")\n\
- SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\
-ENTRY(start)\n\
-SECTIONS\n\
-{\n\
- .text : {\n\
- ;\n\
- *(.init)\n\
- ;\n\
- *(.text)\n\
- *(.rel.sdata)\n\
- *(.fini)\n\
- ;\n\
- ;\n\
- }\n\
- .rdata : {\n\
- *(.rdata)\n\
- }\n\
- .data : {\n\
- *(.data)\n\
- }\n\
- .lit8 : {\n\
- *(.lit8)\n\
- }\n\
- .lit4 : {\n\
- *(.lit4)\n\
- }\n\
- .sdata : {\n\
- *(.sdata)\n\
- }\n\
- .sbss : {\n\
- *(.sbss)\n\
- *(.scommon)\n\
- }\n\
- .bss : {\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
-}\n\n"
- ; else if (!config.text_read_only) return
-concat(
-"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\
- \"ecoff-littlemips\")\n\
- SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\
-ENTRY(start)\n\
-SECTIONS\n\
-{\n\
- . = 0xa0012000;\n\
- .text : {\n\
- _ftext = . ;\n\
- *(.init)\n\
- eprol = .;\n\
- *(.text)\n\
- PROVIDE (__runtime_reloc_start = .);\n\
- *(.rel.sdata)\n\
- PROVIDE (__runtime_reloc_stop = .);\n\
- *(.fini)\n\
- etext = .;\n\
- _etext = .;\n\
-"," }\n\
- . = .;\n\
- .rdata : {\n\
- *(.rdata)\n\
- }\n\
- _fdata = ALIGN(16);\n\
- .data : {\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- _gp = ALIGN(16) + 0x8000;\n\
- .lit8 : {\n\
- *(.lit8)\n\
- }\n\
- .lit4 : {\n\
- *(.lit4)\n\
- }\n\
- .sdata : {\n\
- *(.sdata)\n\
- }\n\
-"," edata = .;\n\
- _edata = .;\n\
- _fbss = .;\n\
- .sbss : {\n\
- *(.sbss)\n\
- *(.scommon)\n\
- }\n\
- .bss : {\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- end = .;\n\
- _end = .;\n\
-}\n\n"
-, NULL)
- ; else if (!config.magic_demand_paged) return
-concat (
-"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\
- \"ecoff-littlemips\")\n\
- SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\
-ENTRY(start)\n\
-SECTIONS\n\
-{\n\
- . = 0xa0012000;\n\
- .text : {\n\
- _ftext = . ;\n\
- *(.init)\n\
- eprol = .;\n\
- *(.text)\n\
- PROVIDE (__runtime_reloc_start = .);\n\
- *(.rel.sdata)\n\
- PROVIDE (__runtime_reloc_stop = .);\n\
- *(.fini)\n\
- etext = .;\n\
- _etext = .;\n\
- "," }\n\
- . = .;\n\
- .rdata : {\n\
- *(.rdata)\n\
- }\n\
- _fdata = ALIGN(16);\n\
- .data : {\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- _gp = ALIGN(16) + 0x8000;\n\
- .lit8 : {\n\
- *(.lit8)\n\
- "," }\n\
- .lit4 : {\n\
- *(.lit4)\n\
- }\n\
- .sdata : {\n\
- *(.sdata)\n\
- }\n\
- edata = .;\n\
- _edata = .;\n\
- _fbss = .;\n\
- .sbss : {\n\
- *(.sbss)\n\
- *(.scommon)\n\
- "," }\n\
- .bss : {\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- end = .;\n\
- _end = .;\n\
-}\n\n"
-, NULL)
- ; else return
-concat (
-"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\
- \"ecoff-littlemips\")\n\
- SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\
-ENTRY(start)\n\
-SECTIONS\n\
-{\n\
- . = 0xa0012000;\n\
- .text : {\n\
- _ftext = . ;\n\
- *(.init)\n\
- eprol = .;\n\
- *(.text)\n\
- PROVIDE (__runtime_reloc_start = .);\n\
- *(.rel.sdata)\n\
- PROVIDE (__runtime_reloc_stop = .);\n\
- *(.fini)\n\
- etext = .;\n\
- _etext = .;\n\
- "," }\n\
- . = .;\n\
- .rdata : {\n\
- *(.rdata)\n\
- }\n\
- _fdata = ALIGN(16);\n\
- .data : {\n\
- *(.data)\n\
- CONSTRUCTORS\n\
- }\n\
- _gp = ALIGN(16) + 0x8000;\n\
- .lit8 : {\n\
- *(.lit8)\n\
- }\n\
- .lit4 : {\n\
- *(.lit4)\n\
- "," }\n\
- .sdata : {\n\
- *(.sdata)\n\
- }\n\
- edata = .;\n\
- _edata = .;\n\
- _fbss = .;\n\
- .sbss : {\n\
- *(.sbss)\n\
- *(.scommon)\n\
- }\n\
- .bss : {\n\
- *(.bss)\n\
- *(COMMON)\n\
- }\n\
- end = .;\n\
- _end = .;\n\
-}\n\n"
-, NULL)
-; }
-
-struct ld_emulation_xfer_struct ld_mipsidt_emulation =
-{
- gldmipsidt_before_parse,
- syslib_default,
- hll_default,
- after_parse_default,
- gldmipsidt_after_open,
- gldmipsidt_after_allocation,
- set_output_arch_default,
- ldemul_default_target,
- before_allocation_default,
- gldmipsidt_get_script,
- "mipsidt",
- "ecoff-bigmips"
-};