diff options
author | Alan Modra <amodra@gmail.com> | 2011-03-04 01:43:24 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2011-03-04 01:43:24 +0000 |
commit | 0e29e6e859e8f2bd77c27086d24b129aed0a2c0f (patch) | |
tree | 3efc655b587f285343495580d4707e5cc6edda1c | |
parent | 08c135952ece3dfb7ee20fc829dd1ce9cf0b31fd (diff) | |
download | gdb-0e29e6e859e8f2bd77c27086d24b129aed0a2c0f.zip gdb-0e29e6e859e8f2bd77c27086d24b129aed0a2c0f.tar.gz gdb-0e29e6e859e8f2bd77c27086d24b129aed0a2c0f.tar.bz2 |
* archive.c (bsd_write_armap): Don't call stat in deterministic
mode, and don't use st_mtime if stat returns error.
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/archive.c | 29 |
2 files changed, 18 insertions, 16 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 94e31dc..95166a3 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2011-03-04 Alan Modra <amodra@gmail.com> + + * archive.c (bsd_write_armap): Don't call stat in deterministic + mode, and don't use st_mtime if stat returns error. + 2011-03-03 Michael Snyder <msnyder@vmware.com> * elf64-x86-64.c (elf_x86_64_relocate_section): Remove dead code. diff --git a/bfd/archive.c b/bfd/archive.c index a664300..86d07e9 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -2301,31 +2301,28 @@ bsd_write_armap (bfd *arch, bfd_byte temp[4]; unsigned int count; struct ar_hdr hdr; - struct stat statbuf; long uid, gid; firstreal = mapsize + elength + sizeof (struct ar_hdr) + SARMAG; - stat (arch->filename, &statbuf); + /* If deterministic, we use 0 as the timestamp in the map. + Some linkers may require that the archive filesystem modification + time is less than (or near to) the archive map timestamp. Those + linkers should not be used with deterministic mode. (GNU ld and + Gold do not have this restriction.) */ + bfd_ardata (arch)->armap_timestamp = 0; + uid = 0; + gid = 0; if ((arch->flags & BFD_DETERMINISTIC_OUTPUT) == 0) { - /* Remember the timestamp, to keep it holy. But fudge it a little. */ - bfd_ardata (arch)->armap_timestamp = (statbuf.st_mtime - + ARMAP_TIME_OFFSET); + struct stat statbuf; + + if (stat (arch->filename, &statbuf) == 0) + bfd_ardata (arch)->armap_timestamp = (statbuf.st_mtime + + ARMAP_TIME_OFFSET); uid = getuid(); gid = getgid(); } - else - { - /* If deterministic, we use 0 as the timestamp in the map. - Some linkers may require that the archive filesystem modification - time is less than (or near to) the archive map timestamp. Those - linkers should not be used with deterministic mode. (GNU ld and - Gold do not have this restriction.) */ - bfd_ardata (arch)->armap_timestamp = 0; - uid = 0; - gid = 0; - } memset (&hdr, ' ', sizeof (struct ar_hdr)); memcpy (hdr.ar_name, RANLIBMAG, strlen (RANLIBMAG)); |