Skip gdb.threads/thread_events.exp on RSP targets properly
[binutils-gdb.git] / bfd / coff-sh.c
index dd8090c67033a749bdd14222ddf8e0e293fc56fc..8170152b73991dc32850fb8faaa9676d14fafdb9 100644 (file)
@@ -596,6 +596,9 @@ sh_reloc (bfd *      abfd,
       && bfd_is_und_section (symbol_in->section))
     return bfd_reloc_undefined;
 
+  if (addr > input_section->size)
+    return bfd_reloc_outofrange;
+
   sym_value = get_symbol_value (symbol_in);
 
   switch (r_type)
@@ -772,8 +775,8 @@ sh_relax_section (bfd *abfd,
       if (laddr >= sec->size)
        {
          /* xgettext: c-format */
-         _bfd_error_handler (_("%B: 0x%lx: warning: bad R_SH_USES offset"),
-                             abfd, (unsigned long) irel->r_vaddr);
+         _bfd_error_handler (_("%B: %#Lx: warning: bad R_SH_USES offset"),
+                             abfd, irel->r_vaddr);
          continue;
        }
       insn = bfd_get_16 (abfd, contents + laddr);
@@ -783,8 +786,8 @@ sh_relax_section (bfd *abfd,
        {
          _bfd_error_handler
            /* xgettext: c-format */
-           (_("%B: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x"),
-            abfd, (unsigned long) irel->r_vaddr, insn);
+           (_("%B: %#Lx: warning: R_SH_USES points to unrecognized insn %#x"),
+            abfd, irel->r_vaddr, insn);
          continue;
        }
 
@@ -801,8 +804,8 @@ sh_relax_section (bfd *abfd,
        {
          _bfd_error_handler
            /* xgettext: c-format */
-           (_("%B: 0x%lx: warning: bad R_SH_USES load offset"),
-            abfd, (unsigned long) irel->r_vaddr);
+           (_("%B: %#Lx: warning: bad R_SH_USES load offset"),
+            abfd, irel->r_vaddr);
          continue;
        }
 
@@ -826,8 +829,8 @@ sh_relax_section (bfd *abfd,
        {
          _bfd_error_handler
            /* xgettext: c-format */
-           (_("%B: 0x%lx: warning: could not find expected reloc"),
-            abfd, (unsigned long) paddr);
+           (_("%B: %#Lx: warning: could not find expected reloc"),
+            abfd, paddr);
          continue;
        }
 
@@ -843,8 +846,8 @@ sh_relax_section (bfd *abfd,
        {
          _bfd_error_handler
            /* xgettext: c-format */
-           (_("%B: 0x%lx: warning: symbol in unexpected section"),
-            abfd, (unsigned long) paddr);
+           (_("%B: %#Lx: warning: symbol in unexpected section"),
+            abfd, paddr);
          continue;
        }
 
@@ -969,8 +972,8 @@ sh_relax_section (bfd *abfd,
        {
          _bfd_error_handler
            /* xgettext: c-format */
-           (_("%B: 0x%lx: warning: could not find expected COUNT reloc"),
-            abfd, (unsigned long) paddr);
+           (_("%B: %#Lx: warning: could not find expected COUNT reloc"),
+            abfd, paddr);
          continue;
        }
 
@@ -979,8 +982,8 @@ sh_relax_section (bfd *abfd,
       if (irelcount->r_offset == 0)
        {
          /* xgettext: c-format */
-         _bfd_error_handler (_("%B: 0x%lx: warning: bad count"),
-                             abfd, (unsigned long) paddr);
+         _bfd_error_handler (_("%B: %#Lx: warning: bad count"),
+                             abfd, paddr);
          continue;
        }
 
@@ -1080,7 +1083,7 @@ sh_relax_delete_bytes (bfd *abfd,
 
   contents = coff_section_data (abfd, sec)->contents;
 
-  /* The deletion must stop at the next ALIGN reloc for an aligment
+  /* The deletion must stop at the next ALIGN reloc for an alignment
      power larger than the number of bytes we are deleting.  */
 
   irelalign = NULL;
@@ -1351,8 +1354,8 @@ sh_relax_delete_bytes (bfd *abfd,
            {
              _bfd_error_handler
                /* xgettext: c-format */
-               (_("%B: 0x%lx: fatal: reloc overflow while relaxing"),
-                abfd, (unsigned long) irel->r_vaddr);
+               (_("%B: %#Lx: fatal: reloc overflow while relaxing"),
+                abfd, irel->r_vaddr);
              bfd_set_error (bfd_error_bad_value);
              return FALSE;
            }
@@ -2639,8 +2642,8 @@ sh_swap_insns (bfd *      abfd,
            {
              _bfd_error_handler
                /* xgettext: c-format */
-               (_("%B: 0x%lx: fatal: reloc overflow while relaxing"),
-                abfd, (unsigned long) irel->r_vaddr);
+               (_("%B: %#Lx: fatal: reloc overflow while relaxing"),
+                abfd, irel->r_vaddr);
              bfd_set_error (bfd_error_bad_value);
              return FALSE;
            }