x86: fix "REP RET" with -madd-bnd-prefix
[binutils-gdb.git] / bfd / elf32-rx.c
index b393a50b0af1d80a4b1d118d72260a2a3e602f75..1f70b97a34501b6c4864a6221296e835d695ae90 100644 (file)
@@ -300,8 +300,8 @@ 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 ATTRIBUTE_UNUSED,
+static bfd_boolean
+rx_info_to_howto_rela (bfd *              abfd,
                       arelent *           cache_ptr,
                       Elf_Internal_Rela * dst)
 {
@@ -311,10 +311,21 @@ rx_info_to_howto_rela (bfd *                 abfd ATTRIBUTE_UNUSED,
   if (r_type >= (unsigned int) R_RX_max)
     {
       /* xgettext:c-format */
-      _bfd_error_handler (_("%pB: invalid RX reloc number: %d"), abfd, r_type);
-      r_type = 0;
+      _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
+                         abfd, r_type);
+      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
@@ -660,13 +671,20 @@ rx_elf_relocate_section
 
       r = bfd_reloc_ok;
 
-#define RANGE(a,b) if (a > (long) relocation || (long) relocation > b) r = bfd_reloc_overflow
-#define ALIGN(m)   if (relocation & m) r = bfd_reloc_other;
-#define OP(i)      (contents[rel->r_offset + (i)])
+#define RANGE(a,b) \
+  if (a > (long) relocation || (long) relocation > b)          \
+    r = bfd_reloc_overflow
+#define ALIGN(m) \
+  if (relocation & m)                                          \
+    r = bfd_reloc_other
+#define OP(i) \
+  (contents[rel->r_offset + (i)])
 #define WARN_REDHAT(type) \
-      /* xgettext:c-format */ \
-      _bfd_error_handler (_("%pB:%pA: Warning: deprecated Red Hat reloc " type " detected against: %s."), \
-      input_bfd, input_section, name)
+  /* xgettext:c-format */                                      \
+  _bfd_error_handler                                           \
+    (_("%pB:%pA: warning: deprecated Red Hat reloc "           \
+       "%s detected against: %s"),                             \
+     input_bfd, input_section, #type, name)
 
       /* Check for unsafe relocs in PID mode.  These are any relocs where
         an absolute address is being computed.  There are special cases
@@ -1267,7 +1285,8 @@ rx_elf_relocate_section
                               + sec->output_offset
                               + rel->r_addend);
              else
-               _bfd_error_handler (_("Warning: RX_SYM reloc with an unknown symbol"));
+               _bfd_error_handler
+                 (_("warning: RX_SYM reloc with an unknown symbol"));
            }
          break;
 
@@ -3146,7 +3165,7 @@ rx_elf_merge_private_bfd_data (bfd * ibfd, struct bfd_link_info *info)
            }
          else
            {
-             _bfd_error_handler (_("There is a conflict merging the"
+             _bfd_error_handler (_("there is a conflict merging the"
                                    " ELF header flags from %pB"),
                                  ibfd);
              _bfd_error_handler (_("  the input  file's flags: %s"),