Back to index

cell-binutils  2.17cvs20070401
coff-aux.c
Go to the documentation of this file.
00001 /* BFD back-end for Apple M68K COFF A/UX 3.x files.
00002    Copyright 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
00003    Written by Richard Henderson <rth@tamu.edu>.
00004 
00005 This file is part of BFD, the Binary File Descriptor library.
00006 
00007 This program is free software; you can redistribute it and/or modify
00008 it under the terms of the GNU General Public License as published by
00009 the Free Software Foundation; either version 2 of the License, or
00010 (at your option) any later version.
00011 
00012 This program is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with this program; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00020 
00021 #define TARGET_SYM   m68kaux_coff_vec
00022 #define TARGET_NAME  "coff-m68k-aux"
00023 
00024 #ifndef TARG_AUX
00025 #define TARG_AUX
00026 #endif
00027 
00028 #define COFF_LONG_FILENAMES
00029 
00030 /* 4k pages */
00031 #define COFF_PAGE_SIZE 0x1000
00032 
00033 /* On AUX, a STYP_NOLOAD|STYP_BSS section is part of a shared library.  */
00034 #define BSS_NOLOAD_IS_SHARED_LIBRARY
00035 
00036 #define STATIC_RELOCS
00037 
00038 #define COFF_COMMON_ADDEND
00039 
00040 #include "bfd.h"
00041 #include "sysdep.h"
00042 
00043 static bfd_boolean coff_m68k_aux_link_add_one_symbol
00044   PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
00045            asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
00046            struct bfd_link_hash_entry **));
00047 
00048 #define coff_link_add_one_symbol coff_m68k_aux_link_add_one_symbol
00049 
00050 #include "coff/aux-coff.h"  /* override coff/internal.h and coff/m68k.h */
00051 #include "coff-m68k.c"
00052 
00053 /* We need non-absolute symbols to override absolute symbols.  This
00054    mirrors Apple's "solution" to let a static library symbol override
00055    a shared library symbol.  On the whole not a good thing, given how
00056    shared libraries work here, but can work if you are careful with
00057    what you include in the shared object.  */
00058 
00059 static bfd_boolean
00060 coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value,
00061                                string, copy, collect, hashp)
00062      struct bfd_link_info *info;
00063      bfd *abfd;
00064      const char *name;
00065      flagword flags;
00066      asection *section;
00067      bfd_vma value;
00068      const char *string;
00069      bfd_boolean copy;
00070      bfd_boolean collect;
00071      struct bfd_link_hash_entry **hashp;
00072 {
00073   struct bfd_link_hash_entry *h;
00074 
00075   if ((flags & (BSF_WARNING | BSF_CONSTRUCTOR | BSF_WEAK)) == 0 &&
00076       !bfd_is_und_section (section) &&
00077       !bfd_is_com_section (section))
00078     {
00079       /* The new symbol is a definition or an indirect definition */
00080 
00081       /* This bit copied from linker.c */
00082       if (hashp != NULL && *hashp != NULL)
00083        {
00084          h = *hashp;
00085          BFD_ASSERT (strcmp (h->root.string, name) == 0);
00086        }
00087       else
00088        {
00089          h = bfd_link_hash_lookup (info->hash, name, TRUE, copy, FALSE);
00090          if (h == NULL)
00091            {
00092              if (hashp != NULL)
00093               *hashp = NULL;
00094              return FALSE;
00095            }
00096        }
00097 
00098       if (info->notice_hash != (struct bfd_hash_table *) NULL
00099          && (bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE)
00100              != (struct bfd_hash_entry *) NULL))
00101        {
00102          if (! (*info->callbacks->notice) (info, name, abfd, section, value))
00103            return FALSE;
00104        }
00105 
00106       if (hashp != (struct bfd_link_hash_entry **) NULL)
00107        *hashp = h;
00108       /* end duplication from linker.c */
00109 
00110       if (h->type == bfd_link_hash_defined
00111          || h->type == bfd_link_hash_indirect)
00112        {
00113          asection *msec;
00114 
00115          if (h->type == bfd_link_hash_defined)
00116            msec = h->u.def.section;
00117          else
00118            msec = bfd_ind_section_ptr;
00119 
00120          if (bfd_is_abs_section (msec) && !bfd_is_abs_section (section))
00121            {
00122              h->u.def.section = section;
00123              h->u.def.value = value;
00124              return TRUE;
00125            }
00126          else if (bfd_is_abs_section (section) && !bfd_is_abs_section (msec))
00127            return TRUE;
00128        }
00129     }
00130 
00131   /* If we didn't exit early, finish processing in the generic routine */
00132   return _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
00133                                       value, string, copy, collect,
00134                                       hashp);
00135 }