Automatic date update in version.in
[deliverable/binutils-gdb.git] / bfd / elf32-rx.c
index 42f5fc21fb4ca4233b658d77e084e77951f193a3..0b5f983a9a6785968475800db624fc81115b86ab 100644 (file)
@@ -1,5 +1,5 @@
 /* Renesas RX specific support for 32-bit ELF.
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -20,7 +20,6 @@
 
 #include "sysdep.h"
 #include "bfd.h"
-#include "bfd_stdint.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
 #include "elf/rx.h"
@@ -300,10 +299,10 @@ rx_reloc_name_lookup (bfd * abfd ATTRIBUTE_UNUSED, const char * r_name)
 
 /* Set the howto pointer for an RX ELF reloc.  */
 
-static void
-rx_info_to_howto_rela (bfd *abfd,
-                      arelent *cache_ptr,
-                      Elf_Internal_Rela *dst)
+static bfd_boolean
+rx_info_to_howto_rela (bfd *              abfd,
+                      arelent *           cache_ptr,
+                      Elf_Internal_Rela * dst)
 {
   unsigned int r_type;
 
@@ -313,9 +312,19 @@ rx_info_to_howto_rela (bfd *abfd,
       /* xgettext:c-format */
       _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
                          abfd, r_type);
-      r_type = 0;
+      bfd_set_error (bfd_error_bad_value);
+      return FALSE;
     }
   cache_ptr->howto = rx_elf_howto_table + r_type;
+  if (cache_ptr->howto->name == NULL)
+    {
+      /* xgettext:c-format */
+      _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
+                         abfd, r_type);
+      bfd_set_error (bfd_error_bad_value);
+      return FALSE;
+    }
+  return TRUE;
 }
 \f
 static bfd_vma
@@ -3203,7 +3212,12 @@ elf32_rx_machine (bfd * abfd ATTRIBUTE_UNUSED)
         For now we assume that the flags are OK.  */
   if ((elf_elfheader (abfd)->e_flags & EF_RX_CPU_MASK) == EF_RX_CPU_RX)
 #endif
-    return bfd_mach_rx;
+    if ((elf_elfheader (abfd)->e_flags & E_FLAG_RX_V2))
+      return bfd_mach_rx_v2;
+    else if ((elf_elfheader (abfd)->e_flags & E_FLAG_RX_V3))
+      return bfd_mach_rx_v3;
+    else
+      return bfd_mach_rx;
 
   return 0;
 }
@@ -3300,6 +3314,14 @@ rx_elf_object_p (bfd * abfd)
 
   return TRUE;
 }
+
+static bfd_boolean
+rx_linux_object_p (bfd * abfd)
+{
+  bfd_default_set_arch_mach (abfd, bfd_arch_rx,
+           elf32_rx_machine (abfd));
+  return TRUE;
+}
  \f
 
 #ifdef DEBUG
@@ -4049,3 +4071,18 @@ rx_additional_link_map_text (bfd *obfd, struct bfd_link_info *info, FILE *mapfil
 #define elf32_bed                              elf32_rx_be_ns_bed
 
 #include "elf32-target.h"
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM      rx_elf32_linux_le_vec
+#undef  TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME     "elf32-rx-linux"
+#undef  TARGET_BIG_SYM
+#undef  TARGET_BIG_NAME
+
+#undef  elf_backend_object_p
+#define elf_backend_object_p                   rx_linux_object_p
+#undef  elf_symbol_leading_char
+#undef elf32_bed
+#define        elf32_bed                               elf32_rx_le_linux_bed
+
+#include "elf32-target.h"
This page took 0.028156 seconds and 4 git commands to generate.