Commit: PR 22875: Stop strip corrupting unknown relocs

Nick Clifton nickc@redhat.com
Tue Feb 27 12:15:00 GMT 2018


Hi Alan,

> Please use "%pB: unsupported relocation type %#x".  A lot of work went
> into reducing all the unsupported/invalid reloc message variants.

Sorry - I forgot to go through and check all the messages.

I am checking in this patch to fix up the ones that I missed.

Cheers
  Nick

bfd/ChangeLog
2018-02-27  Nick Clifton  <nickc@redhat.com>

	* aout-cris.c (swap_ext_reloc_out): Standadize error/warning
	message.
	* elf-hppa.h (elf_hppa_info_to_howto_rel): Likewise.
	* elf32-i386.c (elf_i386_reloc_type_lookup): Likewise.
	* elf32-xtensa.c (elf_xtensa_reloc_type_lookup): Likewise.
	* elf64-ppc.c (ppc64_elf_reloc_type_lookup): Likewise.
	* elf64-s390.c (elf_s390_reloc_type_lookup): Likewise.
	* elf64-sh64.c (sh_elf64_info_to_howto): Likewise.
	* elfxx-ia64.c (ia64_elf_reloc_type_lookup): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_reloc_type_lookup): Likewise.
	* elfxx-tilegx.c (tilegx_reloc_type_lookup): Likewise.
-------------- next part --------------
diff --git a/bfd/aout-cris.c b/bfd/aout-cris.c
index 6a3480e0bd..2b150cd8b5 100644
--- a/bfd/aout-cris.c
+++ b/bfd/aout-cris.c
@@ -197,7 +197,7 @@ MY (swap_ext_reloc_out) (bfd *abfd,
   if (r_type > 2)
     {
       /* xgettext:c-format */
-      _bfd_error_handler (_("%pB: invalid relocation type exported: %d"),
+      _bfd_error_handler (_("%pB: unsupported relocation type exported: %#x"),
 			  abfd, r_type);
 
       bfd_set_error (bfd_error_wrong_format);
@@ -241,7 +241,7 @@ MY (swap_ext_reloc_in) (bfd *abfd,
   if (r_type > 2)
     {
       /* xgettext:c-format */
-      _bfd_error_handler (_("%pB: invalid relocation type imported: %d"),
+      _bfd_error_handler (_("%pB: unsupported relocation type imported: %#x"),
 			  abfd, r_type);
 
       bfd_set_error (bfd_error_wrong_format);
diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h
index 75b4e26944..95ac96c734 100644
--- a/bfd/elf-hppa.h
+++ b/bfd/elf-hppa.h
@@ -1051,7 +1051,7 @@ elf_hppa_info_to_howto_rel (bfd *abfd,
   if (r_type >= (unsigned int) R_PARISC_UNIMPLEMENTED)
     {
       /* xgettext:c-format */
-      _bfd_error_handler (_("%pB: invalid relocation type %d"), abfd, r_type);
+      _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd, r_type);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 5163e2468f..61a14097b0 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -348,7 +348,7 @@ elf_i386_reloc_type_lookup (bfd *abfd,
     default:
       TRACE ("Unknown");
       /* xgettext:c-format */
-      _bfd_error_handler (_("%pB: invalid Alpha reloc number: %d"),
+      _bfd_error_handler (_("%pB: unsupported relocation type: %#x"),
 			  abfd, (int) code);
       bfd_set_error (bfd_error_bad_value);
       return NULL;
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 02effe71ad..cd087968f7 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -451,7 +451,7 @@ elf_xtensa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
     }
 
   /* xgettext:c-format */
-  _bfd_error_handler (_("%pB: invalid relocation type %d"), abfd, (int) code);
+  _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd, (int) code);
   bfd_set_error (bfd_error_bad_value);
   TRACE ("Unknown");
   return NULL;
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index a79a6b637d..44237bca66 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -2245,7 +2245,7 @@ ppc64_elf_reloc_type_lookup (bfd *abfd,
     {
     default:
       /* xgettext:c-format */
-      _bfd_error_handler (_("%pB: invalid relocation type %d"), abfd, (int) code);
+      _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd, (int) code);
       bfd_set_error (bfd_error_bad_value);
       return NULL;
 
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 5c320a52d6..9eca035152 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -325,7 +325,7 @@ elf_s390_reloc_type_lookup (bfd *abfd,
     }
 
   /* xgettext:c-format */
-  _bfd_error_handler (_("%pB: invalid relocation type %d"), abfd, (int) code);
+  _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd, (int) code);
   bfd_set_error (bfd_error_bad_value);
   return NULL;
 }
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index d8dca7f2c2..b771759c86 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -1411,7 +1411,7 @@ sh_elf64_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
   if (r > (unsigned int) R_SH_64_PCREL)
     {
       /* xgettext:c-format */
-      _bfd_error_handler (_("%pB: invalid relocation type %d"), abfd, r);
+      _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd, r);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index 8f532722da..290dcd8e53 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -322,7 +322,7 @@ ia64_elf_reloc_type_lookup (bfd *abfd,
 
     default:
       /* xgettext:c-format */
-      _bfd_error_handler (_("%pB: invalid BFD relocation type %d"),
+      _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
 			  abfd, (int) bfd_code);
       bfd_set_error (bfd_error_bad_value);
       return NULL;
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index 4108aa619a..30e7bd3c31 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -586,7 +586,7 @@ _bfd_sparc_elf_reloc_type_lookup (bfd *abfd,
       break;
     }
   /* xgettext:c-format */
-  _bfd_error_handler (_("%pB: invalid BFD relocation type %d"), abfd, (int) code);
+  _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd, (int) code);
   bfd_set_error (bfd_error_bad_value);
   return NULL;
 }
diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c
index 2b7bf58b6b..f029cd2526 100644
--- a/bfd/elfxx-tilegx.c
+++ b/bfd/elfxx-tilegx.c
@@ -909,7 +909,7 @@ tilegx_reloc_type_lookup (bfd * abfd,
     }
 
   /* xgettext:c-format */
-  _bfd_error_handler (_("%pB: invalid BFD relocation type %d"),
+  _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
 		      abfd, (int) code);
   bfd_set_error (bfd_error_bad_value);
   return NULL;


More information about the Binutils mailing list