1a405f
--- binutils-2.27.orig/binutils/readelf.c	2017-01-16 11:51:05.043922264 +0000
1a405f
+++ binutils-2.27/binutils/readelf.c	2017-01-16 12:01:34.389053872 +0000
1a405f
@@ -16733,39 +16733,49 @@ process_archive (char * file_name, FILE
1a405f
 static int
1a405f
 process_file (char * file_name)
1a405f
 {
1a405f
+  char * name;
1a405f
+  char * saved_program_name;
1a405f
   FILE * file;
1a405f
   struct stat statbuf;
1a405f
   char armag[SARMAG];
1a405f
-  int ret;
1a405f
+  int ret = 1;
1a405f
+
1a405f
+  /* Overload program_name to include file_name.  Doing this means
1a405f
+     that warning/error messages will positively identify the file
1a405f
+     concerned even when multiple instances of readelf are running.  */
1a405f
+  name = xmalloc (strlen (program_name) + strlen (file_name) + 3);
1a405f
+  sprintf (name, "%s: %s", program_name, file_name);
1a405f
+  saved_program_name = program_name;
1a405f
+  program_name = name;
1a405f
 
1a405f
   if (stat (file_name, &statbuf) < 0)
1a405f
     {
1a405f
       if (errno == ENOENT)
1a405f
-	error (_("'%s': No such file\n"), file_name);
1a405f
+	error (_("No such file\n"));
1a405f
       else
1a405f
-	error (_("Could not locate '%s'.  System error message: %s\n"),
1a405f
-	       file_name, strerror (errno));
1a405f
-      return 1;
1a405f
+	error (_("Could not locate file.  System error message: %s\n"),
1a405f
+	       strerror (errno));
1a405f
+      goto done;
1a405f
     }
1a405f
 
1a405f
   if (! S_ISREG (statbuf.st_mode))
1a405f
     {
1a405f
-      error (_("'%s' is not an ordinary file\n"), file_name);
1a405f
-      return 1;
1a405f
+      error (_("Not an ordinary file\n"));
1a405f
+      goto done;
1a405f
     }
1a405f
 
1a405f
   file = fopen (file_name, "rb");
1a405f
   if (file == NULL)
1a405f
     {
1a405f
-      error (_("Input file '%s' is not readable.\n"), file_name);
1a405f
-      return 1;
1a405f
+      error (_("Not readable\n"));
1a405f
+      goto done;
1a405f
     }
1a405f
 
1a405f
   if (fread (armag, SARMAG, 1, file) != 1)
1a405f
     {
1a405f
-      error (_("%s: Failed to read file's magic number\n"), file_name);
1a405f
+      error (_("Failed to read file's magic number\n"));
1a405f
       fclose (file);
1a405f
-      return 1;
1a405f
+      goto done;
1a405f
     }
1a405f
 
1a405f
   current_file_size = (bfd_size_type) statbuf.st_size;
1a405f
@@ -16777,8 +16787,7 @@ process_file (char * file_name)
1a405f
   else
1a405f
     {
1a405f
       if (do_archive_index)
1a405f
-	error (_("File %s is not an archive so its index cannot be displayed.\n"),
1a405f
-	       file_name);
1a405f
+	error (_("Not an archive so its index cannot be displayed\n"));
1a405f
 
1a405f
       rewind (file);
1a405f
       archive_file_size = archive_file_offset = 0;
1a405f
@@ -16787,7 +16796,10 @@ process_file (char * file_name)
1a405f
 
1a405f
   fclose (file);
1a405f
 
1a405f
+ done:
1a405f
   current_file_size = 0;
1a405f
+  free (program_name);
1a405f
+  program_name = saved_program_name;
1a405f
   return ret;
1a405f
 }
1a405f