daily update
[deliverable/binutils-gdb.git] / bfd / coff-maxq.c
index a03037e5dd47757670b30fb8669d6d8e809f63e1..165d7c86a9bcee44ac7cd25c3360a0fdc439a1e4 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for MAXQ COFF binaries.
-   Copyright 2004    Free Software Foundation, Inc.
+   Copyright 2004, 2007, 2008  Free Software Foundation, Inc.
 
    Contributed by Vineet Sharma (vineets@noida.hcltech.com) Inderpreet S.
    (inderpreetb@noida.hcltech.com)
@@ -10,7 +10,7 @@
 
    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)
+   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
    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 02110-1301, USA.  */
+   with this program; if not, write to the Free Software Foundation, Inc., 
+   51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#include "bfd.h"
 #include "sysdep.h"
+#include "bfd.h"
 #include "libbfd.h"
 #include "coff/maxq.h"
 #include "coff/internal.h"
@@ -82,7 +82,6 @@ coff_maxq20_reloc (bfd *      abfd,
                   bfd *      output_bfd    ATTRIBUTE_UNUSED,
                   char **    error_message ATTRIBUTE_UNUSED)
 {
-  reloc_howto_type *howto = NULL;
   unsigned char *addr = NULL;
   unsigned long x = 0;
   long call_addr = 0;
@@ -96,7 +95,6 @@ coff_maxq20_reloc (bfd *      abfd,
 
   if (data && reloc_entry)
     {
-      howto = reloc_entry->howto;
       addr = (unsigned char *) data + reloc_entry->address;
       call_addr = call_addr - call_addr;
       call_addr = get_symbol_value (symbol_in);
@@ -374,74 +372,65 @@ static reloc_howto_type howto_table[] =
   EMPTY_HOWTO (10),
 };
 
-/* Map BFD reloc types to MAXQ COFF reloc types.  */
-
-typedef struct maxq_reloc_map
-{
-  bfd_reloc_code_real_type  bfd_reloc_val;
-  unsigned int              maxq_reloc_val;
-  reloc_howto_type *        table;
-}
-reloc_map;
-
-static const reloc_map maxq_reloc_map[] =
-{
-  {BFD_RELOC_16_PCREL_S2, SHORT_JUMP, howto_table},
-  {BFD_RELOC_16,          LONG_JUMP,  howto_table},
-};
-
 static reloc_howto_type *
 maxq_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
                        bfd_reloc_code_real_type code)
 {
-  unsigned int i;
-
-  for (i = 0; i < ARRAY_SIZE (maxq_reloc_map); i++)
+  switch (code)
     {
-      const reloc_map *entry;
-
-      entry = maxq_reloc_map + i;
-
-      switch (code)
-       {
-         /* SHORT JUMP */
-       case BFD_RELOC_16_PCREL_S2:
-         return howto_table + 3;
-
-         /* INTERSEGMENT JUMP */
-       case BFD_RELOC_24:
-         return howto_table + 4;
-
-         /* BYTE RELOC */
-       case BFD_RELOC_8:
-         return howto_table + 7;
-
-         /* WORD RELOC */
-       case BFD_RELOC_16:
-         return howto_table + 5;
-
-         /* LONG RELOC */
-       case BFD_RELOC_32:
-         return howto_table + 2;
+      /* SHORT JUMP */
+    case BFD_RELOC_16_PCREL_S2:
+      return howto_table + 3;
+      
+      /* INTERSEGMENT JUMP */
+    case BFD_RELOC_24:
+      return howto_table + 4;
+      
+      /* BYTE RELOC */
+    case BFD_RELOC_8:
+      return howto_table + 7;
+      
+      /* WORD RELOC */
+    case BFD_RELOC_16:
+      return howto_table + 5;
+      
+      /* LONG RELOC */
+    case BFD_RELOC_32:
+      return howto_table + 2;
+      
+      /* LONG JUMP */
+    case BFD_RELOC_14:
+      return howto_table + 6;
+      
+    default:
+      return NULL;
+    }
+}
 
-         /* LONG JUMP */
-       case BFD_RELOC_14:
-         return howto_table + 6;
+static reloc_howto_type *
+maxq_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
+{
+  unsigned int i;
 
-       default:
-         return NULL;
-       }
-    }
+  for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++)
+    if (howto_table[i].name != NULL
+       && strcasecmp (howto_table[i].name, r_name) == 0)
+      return &howto_table[i];
 
   return NULL;
 }
 
 #define coff_bfd_reloc_type_lookup maxq_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup maxq_reloc_name_lookup
 
 /* Perform any necessary magic to the addend in a reloc entry.  */
 #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
  cache_ptr->addend =  ext_reloc.r_offset;
 
+#ifndef bfd_pe_print_pdata
+#define bfd_pe_print_pdata     NULL
+#endif
+
 #include "coffcode.h"
 
 #ifndef TARGET_UNDERSCORE
This page took 0.02977 seconds and 4 git commands to generate.