* objcopy.c (copy_archive): Preserve dates of archive members if
authorAndreas Schwab <schwab@linux-m68k.org>
Thu, 27 May 1999 03:16:15 +0000 (03:16 +0000)
committerAndreas Schwab <schwab@linux-m68k.org>
Thu, 27 May 1999 03:16:15 +0000 (03:16 +0000)
requested.

binutils/ChangeLog
binutils/objcopy.c

index 746baf1f6714a19ae30f607a575a6b55c675ff2e..f5491d361df854c2a13c9e235da6aed6f4f4063b 100644 (file)
@@ -1,5 +1,8 @@
 Thu May 27 11:58:33 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
 
+       * objcopy.c (copy_archive): Preserve dates of archive members if
+       requested.
+
        * readelf.c (dump_relocations): Always print the addend on RELA
        systems even if there is no symbol.
        (process_program_headers): Reset dynamic_size before looping
index 5fd77775d701a6c2af2e65eb2d8a5f7cc04e3d2f..5e6d6836f43be543ff81dff0c09a0a98b82c51f5 100644 (file)
@@ -962,6 +962,16 @@ copy_archive (ibfd, obfd, output_target)
                                  (char *) NULL);
       bfd *output_bfd = bfd_openw (output_name, output_target);
       bfd *last_element;
+      struct stat buf;
+      int stat_status = 0;
+
+      if (preserve_dates)
+       {
+         stat_status = bfd_stat_arch_elt (this_element, &buf);
+         if (stat_status != 0)
+           non_fatal (_("internal stat error on %s"),
+                      bfd_get_filename (this_element));
+       }
 
       l = (struct name_list *) xmalloc (sizeof (struct name_list));
       l->name = output_name;
@@ -984,6 +994,9 @@ copy_archive (ibfd, obfd, output_target)
          status = 1;
        }
 
+      if (preserve_dates && stat_status == 0)
+       set_times (output_name, &buf);
+
       /* Open the newly output file and attach to our list.  */
       output_bfd = bfd_openr (output_name, output_target);
 
This page took 0.040681 seconds and 4 git commands to generate.