Automatic date update in version.in
[deliverable/binutils-gdb.git] / bfd / elf32-pj.c
index bd0a5b49ffa88948c590e76980d2fdf2af3f54a7..5a509f103ccb0104a9fc480db0fc14c2dbf0e689 100644 (file)
@@ -1,12 +1,12 @@
 /* picoJava specific support for 32-bit ELF
-   Copyright 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1999-2015 Free Software Foundation, Inc.
    Contributed by Steve Chamberlan of Transmeta (sac@pobox.com).
 
    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
+   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,
 
    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.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
-#include "bfd.h"
 #include "sysdep.h"
+#include "bfd.h"
 #include "bfdlink.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
@@ -112,7 +113,7 @@ static reloc_howto_type pj_elf_howto_table[] =
   /* No relocation.  */
   HOWTO (R_PJ_NONE,            /* type */
         0,                     /* rightshift */
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        3,                     /* size (0 = byte, 1 = short, 2 = long) */
         0,                     /* bitsize */
         FALSE,                 /* pc_relative */
         0,                     /* bitpos */
@@ -291,6 +292,22 @@ pj_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
   return NULL;
 }
 
+static reloc_howto_type *
+pj_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+                         const char *r_name)
+{
+  unsigned int i;
+
+  for (i = 0;
+       i < sizeof (pj_elf_howto_table) / sizeof (pj_elf_howto_table[0]);
+       i++)
+    if (pj_elf_howto_table[i].name != NULL
+       && strcasecmp (pj_elf_howto_table[i].name, r_name) == 0)
+      return &pj_elf_howto_table[i];
+
+  return NULL;
+}
+
 /* Given an ELF reloc, fill in the howto field of a relent.  */
 
 static void
@@ -302,7 +319,13 @@ pj_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
 
   r = ELF32_R_TYPE (dst->r_info);
 
-  BFD_ASSERT (r < (unsigned int) R_PJ_max);
+  if (r >= R_PJ_max)
+    {
+      (*_bfd_error_handler) (_("%B: unrecognised PicoJava reloc number: %d"),
+                            abfd, r);
+      bfd_set_error (bfd_error_bad_value);
+      r = R_PJ_NONE;
+    }
 
   cache_ptr->howto = &pj_elf_howto_table[r];
 }
@@ -318,16 +341,18 @@ pj_elf_final_write_processing (bfd *abfd,
   elf_elfheader (abfd)->e_flags |= EF_PICOJAVA_GNUCALLS;
 }
 
-#define TARGET_BIG_SYM         bfd_elf32_pj_vec
+#define TARGET_BIG_SYM         pj_elf32_vec
 #define TARGET_BIG_NAME                "elf32-pj"
-#define TARGET_LITTLE_SYM      bfd_elf32_pjl_vec
+#define TARGET_LITTLE_SYM      pj_elf32_le_vec
 #define TARGET_LITTLE_NAME     "elf32-pjl"
 #define ELF_ARCH               bfd_arch_pj
 #define ELF_MACHINE_CODE       EM_PJ
 #define ELF_MACHINE_ALT1       EM_PJ_OLD
 #define ELF_MAXPAGESIZE                0x1000
-#define bfd_elf32_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
-#define bfd_elf32_bfd_reloc_type_lookup                     pj_elf_reloc_type_lookup
-#define elf_backend_final_write_processing           pj_elf_final_write_processing
-#define elf_info_to_howto                           pj_elf_info_to_howto
+#define bfd_elf32_bfd_get_relocated_section_contents \
+  bfd_generic_get_relocated_section_contents
+#define bfd_elf32_bfd_reloc_type_lookup                pj_elf_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup   pj_elf_reloc_name_lookup
+#define elf_backend_final_write_processing      pj_elf_final_write_processing
+#define elf_info_to_howto                      pj_elf_info_to_howto
 #include "elf32-target.h"
This page took 0.042589 seconds and 4 git commands to generate.