aboutsummaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>1999-05-27 03:16:15 +0000
committerAndreas Schwab <schwab@linux-m68k.org>1999-05-27 03:16:15 +0000
commit8066d1a2839e6eb0b1b5cddde033311ec887a486 (patch)
treec399d4b08faa34b8e28beadbb511675cbf9909bb /binutils/objcopy.c
parent1b228002a1a96136e0cde0825a88eb4d785fb9c2 (diff)
downloadgdb-8066d1a2839e6eb0b1b5cddde033311ec887a486.zip
gdb-8066d1a2839e6eb0b1b5cddde033311ec887a486.tar.gz
gdb-8066d1a2839e6eb0b1b5cddde033311ec887a486.tar.bz2
* objcopy.c (copy_archive): Preserve dates of archive members if
requested.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r--binutils/objcopy.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 5fd7777..5e6d683 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -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);