]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/binutils-tumbl.git/commitdiff
2012-01-10 Tristan Gingold <gingold@adacore.com>
authorTristan Gingold <gingold@adacore.com>
Tue, 10 Jan 2012 11:52:27 +0000 (11:52 +0000)
committerTristan Gingold <gingold@adacore.com>
Tue, 10 Jan 2012 11:52:27 +0000 (11:52 +0000)
* objdump.c (display_object_bfd): Renamed from ...
(display_bfd): ... this.
(display_any_bfd): New function.
(display_file): Split.  Handle nested archives.

binutils/ChangeLog
binutils/objdump.c

index c78b13ffe6a97b84b5ad807483d9f3f5f2c53eab..16c8316f747123d0306b49b0d97f625cf6c97495 100644 (file)
@@ -1,3 +1,10 @@
+2012-01-10  Tristan Gingold  <gingold@adacore.com>
+
+       * objdump.c (display_object_bfd): Renamed from ...
+       (display_bfd): ... this.
+       (display_any_bfd): New function.
+       (display_file): Split.  Handle nested archives.
+
 2012-01-09  Roland McGrath  <mcgrathr@google.com>
 
        * configure.in: Use AM_ZLIB.
index 784ead27e0804d01ee44a3d654802b7f8130b842..ede9ba3b9aaa679d5a640cbe600e3bc06b6d053e 100644 (file)
@@ -3257,7 +3257,7 @@ dump_bfd (bfd *abfd)
 }
 
 static void
-display_bfd (bfd *abfd)
+display_object_bfd (bfd *abfd)
 {
   char **matching;
 
@@ -3297,24 +3297,8 @@ display_bfd (bfd *abfd)
 }
 
 static void
-display_file (char *filename, char *target)
+display_any_bfd (bfd *file, int level)
 {
-  bfd *file;
-  bfd *arfile = NULL;
-
-  if (get_file_size (filename) < 1)
-    {
-      exit_status = 1;
-      return;
-    }
-
-  file = bfd_openr (filename, target);
-  if (file == NULL)
-    {
-      nonfatal (filename);
-      return;
-    }
-
   /* Decompress sections unless dumping the section contents.  */
   if (!dump_section_contents)
     file->flags |= BFD_DECOMPRESS;
@@ -3322,9 +3306,14 @@ display_file (char *filename, char *target)
   /* If the file is an archive, process all of its elements.  */
   if (bfd_check_format (file, bfd_archive))
     {
+      bfd *arfile = NULL;
       bfd *last_arfile = NULL;
 
-      printf (_("In archive %s:\n"), bfd_get_filename (file));
+      if (level == 0)
+        printf (_("In archive %s:\n"), bfd_get_filename (file));
+      else
+        printf (_("In nested archive %s:\n"), bfd_get_filename (file));
+
       for (;;)
        {
          bfd_set_error (bfd_error_no_error);
@@ -3337,7 +3326,7 @@ display_file (char *filename, char *target)
              break;
            }
 
-         display_bfd (arfile);
+         display_any_bfd (arfile, level + 1);
 
          if (last_arfile != NULL)
            bfd_close (last_arfile);
@@ -3348,7 +3337,28 @@ display_file (char *filename, char *target)
        bfd_close (last_arfile);
     }
   else
-    display_bfd (file);
+    display_object_bfd (file);
+}
+
+static void
+display_file (char *filename, char *target)
+{
+  bfd *file;
+
+  if (get_file_size (filename) < 1)
+    {
+      exit_status = 1;
+      return;
+    }
+
+  file = bfd_openr (filename, target);
+  if (file == NULL)
+    {
+      nonfatal (filename);
+      return;
+    }
+
+  display_any_bfd (file, 0);
 
   bfd_close (file);
 }