Hi Göran,

In readelf.c, in the macro CHECK_ENTSIZE_VALUES, there is this code

   error (_("Section %d has invalid sh_entsize of %" BFD_VMA_FMT "x\n"), \
         i, section->sh_entsize);    \

When extracting message strings from this code, only the first part
will be extracted:

   msgid "Section %d has invalid sh_entsize of %"

Obviously, that isn't the string that will be sent to the function,
and thus, any translations of this message will be ignored.

A similar problem reappears later in the same file in
dynamic_sction_mips_val:

   printf (_("<corrupt: %" BFD_VMA_FMT "d>"), entry->d_un.d_ptr);

I have checked in a patch (attached) to fix these problems.

Cheers
  Nick


diff --git a/binutils/readelf.c b/binutils/readelf.c
index bc79f03..aea0262 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -5054,19 +5054,22 @@ process_section_headers (FILE * file)
       break;
     }
 
-#define CHECK_ENTSIZE_VALUES(section, i, size32, size64) \
-  do									    \
-    {									    \
-      bfd_size_type expected_entsize = is_32bit_elf ? size32 : size64;	    \
-      if (section->sh_entsize != expected_entsize)			    \
+#define CHECK_ENTSIZE_VALUES(section, i, size32, size64)		\
+  do									\
+    {									\
+      bfd_size_type expected_entsize = is_32bit_elf ? size32 : size64;	\
+      if (section->sh_entsize != expected_entsize)			\
 	{								\
-	  error (_("Section %d has invalid sh_entsize of %" BFD_VMA_FMT "x\n"), \
-		 i, section->sh_entsize);	\
-	  error (_("(Using the expected size of %d for the rest of this dump)\n"), \
-		   (int) expected_entsize); \
+	  char buf[40];							\
+	  sprintf_vma (buf, section->sh_entsize);			\
+	  /* Note: coded this way so that there is a single string for  \
+	     translation.  */ \
+	  error (_("Section %d has invalid sh_entsize of %s\n"), i, buf); \
+	  error (_("(Using the expected size of %u for the rest of this dump)\n"), \
+		   (unsigned) expected_entsize);			\
 	  section->sh_entsize = expected_entsize;			\
-	} \
-    }									    \
+	}								\
+    }									\
   while (0)
 
 #define CHECK_ENTSIZE(section, i, type)					\
@@ -7776,7 +7779,12 @@ dynamic_section_mips_val (Elf_Internal_Dyn * entry)
       if (VALID_DYNAMIC_NAME (entry->d_un.d_val))
 	printf (_("Interface Version: %s"), GET_DYNAMIC_NAME (entry->d_un.d_val));
       else
-	printf (_("<corrupt: %" BFD_VMA_FMT "d>"), entry->d_un.d_ptr);
+	{
+	  char buf[40];
+	  sprintf_vma (buf, entry->d_un.d_ptr);
+	  /* Note: coded this way so that there is a single string for translation.  */
+	  printf (_("<corrupt: %s>"), buf);
+	}
       break;
 
     case DT_MIPS_TIME_STAMP:
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to