OSDN Git Service

daily update
[pf3gnuchains/pf3gnuchains3x.git] / bfd / coff-i960.c
index e4dc053..d0374d2 100644 (file)
@@ -1,33 +1,39 @@
 /* BFD back-end for Intel 960 COFF files.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001,
-   2002 Free Software Foundation, Inc.
+   2002, 2003, 2004, 2005, 2007, 2008  Free Software Foundation, Inc.
    Written by Cygnus Support.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-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 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 3 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.
+   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.  */
+   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., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #define I960 1
 #define BADMAG(x) I960BADMAG(x)
 
-#include "bfd.h"
 #include "sysdep.h"
+#include "bfd.h"
 #include "libbfd.h"
 #include "coff/i960.h"
 #include "coff/internal.h"
-#include "libcoff.h"           /* to allow easier abstraction-breaking */
+
+#ifndef bfd_pe_print_pdata
+#define bfd_pe_print_pdata     NULL
+#endif
+
+#include "libcoff.h"           /* To allow easier abstraction-breaking.  */
 
 static bfd_boolean coff_i960_is_local_label_name
   PARAMS ((bfd *, const char *));
@@ -180,12 +186,12 @@ optcall_callback (abfd, reloc_entry, symbol_in, data,
    same object file.  It appears to simply discard such relocs, rather
    than adding their values into the object file.  We handle this here
    by converting all relocs against defined symbols into relocs
-   against the section symbol, when generating a relocateable output
+   against the section symbol, when generating a relocatable output
    file.
 
    Note that this function is only called if we are not using the COFF
    specific backend linker.  It only does something when doing a
-   relocateable link, which will almost certainly fail when not
+   relocatable link, which will almost certainly fail when not
    generating COFF i960 output, so this function is actually no longer
    useful.  It was used before this target was converted to use the
    COFF specific backend linker.  */
@@ -205,7 +211,7 @@ coff_i960_relocate (abfd, reloc_entry, symbol, data, input_section,
 
   if (output_bfd == NULL)
     {
-      /* Not generating relocateable output file.  */
+      /* Not generating relocatable output file.  */
       return bfd_reloc_continue;
     }
 
@@ -296,6 +302,20 @@ coff_i960_reloc_type_lookup (abfd, code)
     }
 }
 
+static reloc_howto_type *
+coff_i960_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+                            const char *r_name)
+{
+  if (strcasecmp (howto_optcall.name, r_name) == 0)
+    return &howto_optcall;
+  if (strcasecmp (howto_rellong.name, r_name) == 0)
+    return &howto_rellong;
+  if (strcasecmp (howto_iprmed.name, r_name) == 0)
+    return &howto_iprmed;
+
+  return NULL;
+}
+
 /* The real code is in coffcode.h */
 
 #define RTYPE2HOWTO(cache_ptr, dst) \
@@ -328,7 +348,7 @@ coff_i960_start_final_link (abfd, info)
   asection *o;
   bfd_byte *esym;
 
-  if (! info->relocateable)
+  if (! info->relocatable)
     return TRUE;
 
   esym = (bfd_byte *) bfd_malloc (symesz);
@@ -455,7 +475,7 @@ coff_i960_relocate_section (output_bfd, info, input_bfd, input_section,
                     + sec->output_section->vma
                     + sec->output_offset);
            }
-         else if (! info->relocateable)
+         else if (! info->relocatable)
            {
              if (! ((*info->callbacks->undefined_symbol)
                     (info, h->root.root.string, input_bfd, input_section,
@@ -466,16 +486,16 @@ coff_i960_relocate_section (output_bfd, info, input_bfd, input_section,
 
       done = FALSE;
 
-      if (howto->type == R_OPTCALL && ! info->relocateable && symndx != -1)
+      if (howto->type == R_OPTCALL && ! info->relocatable && symndx != -1)
        {
-         int class;
+         int class_val;
 
          if (h != NULL)
-           class = h->class;
+           class_val = h->symbol_class;
          else
-           class = sym->n_sclass;
+           class_val = sym->n_sclass;
 
-         switch (class)
+         switch (class_val)
            {
            case C_NULL:
              /* This symbol is apparently not from a COFF input file.
@@ -555,7 +575,7 @@ coff_i960_relocate_section (output_bfd, info, input_bfd, input_section,
            if (symndx == -1)
              name = "*ABS*";
            else if (h != NULL)
-             name = h->root.root.string;
+             name = NULL;
            else
              {
                name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
@@ -564,8 +584,9 @@ coff_i960_relocate_section (output_bfd, info, input_bfd, input_section,
              }
 
            if (! ((*info->callbacks->reloc_overflow)
-                  (info, name, howto->name, (bfd_vma) 0, input_bfd,
-                   input_section, rel->r_vaddr - input_section->vma)))
+                  (info, (h ? &h->root : NULL), name, howto->name,
+                   (bfd_vma) 0, input_bfd, input_section,
+                   rel->r_vaddr - input_section->vma)))
              return FALSE;
          }
        }
@@ -612,6 +633,7 @@ coff_i960_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
 #define coff_adjust_symndx coff_i960_adjust_symndx
 
 #define coff_bfd_reloc_type_lookup coff_i960_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup coff_i960_reloc_name_lookup
 
 #include "coffcode.h"