daily update
[deliverable/binutils-gdb.git] / bfd / elf32-mips.c
index c5e7dd45d5e2487a6749b577d86e5fd398c2efaf..3843b856e16ad3943cebaad877db048778795b20 100644 (file)
@@ -1,6 +1,6 @@
 /* MIPS-specific support for 32-bit ELF
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005 Free Software Foundation, Inc.
+   2003, 2004, 2005, 2007 Free Software Foundation, Inc.
 
    Most of the information added by Ian Lance Taylor, Cygnus Support,
    <ian@cygnus.com>.
@@ -29,8 +29,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
    different MIPS ELF from other targets.  This matters when linking.
    This file supports both, switching at runtime.  */
 
-#include "bfd.h"
 #include "sysdep.h"
+#include "bfd.h"
 #include "libbfd.h"
 #include "bfdlink.h"
 #include "genlink.h"
@@ -700,6 +700,21 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
         0x0000ffff,            /* src_mask */
         0x0000ffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
+
+  /* 32 bit relocation with no addend.  */
+  HOWTO (R_MIPS_GLOB_DAT,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        _bfd_mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_GLOB_DAT",     /* name */
+        FALSE,                 /* partial_inplace */
+        0x0,                   /* src_mask */
+        0xffffffff,            /* dst_mask */
+        FALSE),                /* pcrel_offset */
 };
 
 /* The reloc used for BFD_RELOC_CTOR when doing a 64 bit link.  This
@@ -1259,6 +1274,40 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
     }
 }
 
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+                                const char *r_name)
+{
+  unsigned int i;
+
+  for (i = 0;
+       i < (sizeof (elf_mips_howto_table_rel)
+           / sizeof (elf_mips_howto_table_rel[0]));
+       i++)
+    if (elf_mips_howto_table_rel[i].name != NULL
+       && strcasecmp (elf_mips_howto_table_rel[i].name, r_name) == 0)
+      return &elf_mips_howto_table_rel[i];
+
+  for (i = 0;
+       i < (sizeof (elf_mips16_howto_table_rel)
+           / sizeof (elf_mips16_howto_table_rel[0]));
+       i++)
+    if (elf_mips16_howto_table_rel[i].name != NULL
+       && strcasecmp (elf_mips16_howto_table_rel[i].name, r_name) == 0)
+      return &elf_mips16_howto_table_rel[i];
+
+  if (strcasecmp (elf_mips_gnu_pcrel32.name, r_name) == 0)
+    return &elf_mips_gnu_pcrel32;
+  if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0)
+    return &elf_mips_gnu_rel16_s2;
+  if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0)
+    return &elf_mips_gnu_vtinherit_howto;
+  if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0)
+    return &elf_mips_gnu_vtentry_howto;
+
+  return NULL;
+}
+
 /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure.  */
 
 static reloc_howto_type *
@@ -1649,6 +1698,17 @@ mips_vxworks_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
     }
 }
 
+static reloc_howto_type *
+mips_vxworks_bfd_reloc_name_lookup (bfd *abfd, const char *r_name)
+{
+  if (strcasecmp (mips_vxworks_copy_howto_rela.name, r_name) == 0)
+    return &mips_vxworks_copy_howto_rela;
+  if (strcasecmp (mips_vxworks_jump_slot_howto_rela.name, r_name) == 0)
+    return &mips_vxworks_jump_slot_howto_rela;
+
+  return bfd_elf32_bfd_reloc_name_lookup (abfd, r_name);
+}
+
 /* Implement elf_backend_mips_rtype_to_lookup for VxWorks.  */
 
 static reloc_howto_type *
@@ -1715,6 +1775,9 @@ mips_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
 #undef bfd_elf32_bfd_reloc_type_lookup
 #define bfd_elf32_bfd_reloc_type_lookup \
   mips_vxworks_bfd_reloc_type_lookup
+#undef bfd_elf32_bfd_reloc_name_lookup
+#define bfd_elf32_bfd_reloc_name_lookup \
+  mips_vxworks_bfd_reloc_name_lookup
 #undef elf_backend_mips_rtype_to_howto
 #define elf_backend_mips_rtype_to_howto        \
   mips_vxworks_rtype_to_howto
This page took 0.025548 seconds and 4 git commands to generate.