summaryrefslogtreecommitdiffstats
path: root/contrib/binutils
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2013-06-01 14:16:51 +0000
committerpfg <pfg@FreeBSD.org>2013-06-01 14:16:51 +0000
commit5750b86515d75792972b36539d4a3e166b31d925 (patch)
tree9ccb38c88a217d3ef08308907c0059fbf9ebb79c /contrib/binutils
parentbfce0b30fa1e29d33ded21e07c6ecbc40c95de0d (diff)
downloadFreeBSD-src-5750b86515d75792972b36539d4a3e166b31d925.zip
FreeBSD-src-5750b86515d75792972b36539d4a3e166b31d925.tar.gz
BFD: Use time_t instead of long for archive timestamps.
This basically follows the suggestion in the binutils code and is more in line with what BSD ar(1) does. Obtained from: OpenBSD MFC after: 2 weeks.
Diffstat (limited to 'contrib/binutils')
-rw-r--r--contrib/binutils/bfd/archive.c11
-rw-r--r--contrib/binutils/bfd/bfd-in2.h3
-rw-r--r--contrib/binutils/bfd/bfdio.c4
-rw-r--r--contrib/binutils/bfd/coff-rs6000.c13
-rw-r--r--contrib/binutils/bfd/ecoff.c2
-rw-r--r--contrib/binutils/bfd/libbfd-in.h3
-rw-r--r--contrib/binutils/bfd/libbfd.h3
7 files changed, 24 insertions, 15 deletions
diff --git a/contrib/binutils/bfd/archive.c b/contrib/binutils/bfd/archive.c
index 053ad47..12bb714 100644
--- a/contrib/binutils/bfd/archive.c
+++ b/contrib/binutils/bfd/archive.c
@@ -1390,8 +1390,8 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
/* ar headers are space padded, not null padded! */
memset (hdr, ' ', sizeof (struct ar_hdr));
- _bfd_ar_spacepad (hdr->ar_date, sizeof (hdr->ar_date), "%-12ld",
- status.st_mtime);
+ _bfd_ar_spacepad (hdr->ar_date, sizeof (hdr->ar_date), "%-12lld",
+ (long long)status.st_mtime);
#ifdef HPUX_LARGE_AR_IDS
/* HP has a very "special" way to handle UID/GID's with numeric values
> 99999. */
@@ -1458,6 +1458,11 @@ bfd_generic_stat_arch_elt (bfd *abfd, struct stat *buf)
if (aloser == hdr->arelt) \
return -1;
+#define fooll(arelt, stelt, size) \
+ buf->stelt = strtoll (hdr->arelt, &aloser, size); \
+ if (aloser == hdr->arelt) \
+ return -1;
+
/* Some platforms support special notations for large IDs. */
#ifdef HPUX_LARGE_AR_IDS
# define foo2(arelt, stelt, size) \
@@ -1484,7 +1489,7 @@ bfd_generic_stat_arch_elt (bfd *abfd, struct stat *buf)
# define foo2(arelt, stelt, size) foo (arelt, stelt, size)
#endif
- foo (ar_date, st_mtime, 10);
+ fooll (ar_date, st_mtime, 10);
foo2 (ar_uid, st_uid, 10);
foo2 (ar_gid, st_gid, 10);
foo (ar_mode, st_mode, 8);
diff --git a/contrib/binutils/bfd/bfd-in2.h b/contrib/binutils/bfd/bfd-in2.h
index 8ea1cdd..fe62b6e 100644
--- a/contrib/binutils/bfd/bfd-in2.h
+++ b/contrib/binutils/bfd/bfd-in2.h
@@ -38,6 +38,7 @@ extern "C" {
#include "ansidecl.h"
#include "symcat.h"
+#include <time.h> /* time_t */
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
#ifndef SABER
/* This hack is to avoid a problem with some strict ANSI C preprocessors.
@@ -1141,7 +1142,7 @@ bfd_boolean bfd_fill_in_gnu_debuglink_section
/* Extracted from bfdio.c. */
-long bfd_get_mtime (bfd *abfd);
+time_t bfd_get_mtime (bfd *abfd);
file_ptr bfd_get_size (bfd *abfd);
diff --git a/contrib/binutils/bfd/bfdio.c b/contrib/binutils/bfd/bfdio.c
index 0df25c3..90257b7 100644
--- a/contrib/binutils/bfd/bfdio.c
+++ b/contrib/binutils/bfd/bfdio.c
@@ -377,7 +377,7 @@ FUNCTION
bfd_get_mtime
SYNOPSIS
- long bfd_get_mtime (bfd *abfd);
+ time_t bfd_get_mtime (bfd *abfd);
DESCRIPTION
Return the file modification time (as read from the file system, or
@@ -385,7 +385,7 @@ DESCRIPTION
*/
-long
+time_t
bfd_get_mtime (bfd *abfd)
{
struct stat buf;
diff --git a/contrib/binutils/bfd/coff-rs6000.c b/contrib/binutils/bfd/coff-rs6000.c
index f446f49..c3a48fe 100644
--- a/contrib/binutils/bfd/coff-rs6000.c
+++ b/contrib/binutils/bfd/coff-rs6000.c
@@ -1548,7 +1548,7 @@ _bfd_xcoff_stat_arch_elt (abfd, s)
{
struct xcoff_ar_hdr *hdrp = arch_xhdr (abfd);
- s->st_mtime = strtol (hdrp->date, (char **) NULL, 10);
+ s->st_mtime = strtoll (hdrp->date, (char **) NULL, 10);
s->st_uid = strtol (hdrp->uid, (char **) NULL, 10);
s->st_gid = strtol (hdrp->gid, (char **) NULL, 10);
s->st_mode = strtol (hdrp->mode, (char **) NULL, 8);
@@ -1558,7 +1558,7 @@ _bfd_xcoff_stat_arch_elt (abfd, s)
{
struct xcoff_ar_hdr_big *hdrp = arch_xhdr_big (abfd);
- s->st_mtime = strtol (hdrp->date, (char **) NULL, 10);
+ s->st_mtime = strtoll (hdrp->date, (char **) NULL, 10);
s->st_uid = strtol (hdrp->uid, (char **) NULL, 10);
s->st_gid = strtol (hdrp->gid, (char **) NULL, 10);
s->st_mode = strtol (hdrp->mode, (char **) NULL, 8);
@@ -1678,6 +1678,7 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
static char buff20[XCOFFARMAGBIG_ELEMENT_SIZE + 1];
#define FMT20 "%-20lld"
#define FMT12 "%-12d"
+#define FMT12_LL "%-12lld"
#define FMT12_OCTAL "%-12o"
#define FMT4 "%-4d"
#define PRINT20(d, v) \
@@ -1688,6 +1689,10 @@ static char buff20[XCOFFARMAGBIG_ELEMENT_SIZE + 1];
sprintf (buff20, FMT12, (int)(v)), \
memcpy ((void *) (d), buff20, 12)
+#define PRINT12_LL(d, v) \
+ sprintf (buff20, FMT12_LL, (long long)(v)), \
+ memcpy ((void *) (d), buff20, 12)
+
#define PRINT12_OCTAL(d, v) \
sprintf (buff20, FMT12_OCTAL, (unsigned int)(v)), \
memcpy ((void *) (d), buff20, 12)
@@ -2152,7 +2157,7 @@ xcoff_write_archive_contents_old (abfd)
}
sprintf (ahdrp->size, "%ld", (long) s.st_size);
- sprintf (ahdrp->date, "%ld", (long) s.st_mtime);
+ sprintf (ahdrp->date, "%lld", (long long) s.st_mtime);
sprintf (ahdrp->uid, "%ld", (long) s.st_uid);
sprintf (ahdrp->gid, "%ld", (long) s.st_gid);
sprintf (ahdrp->mode, "%o", (unsigned int) s.st_mode);
@@ -2388,7 +2393,7 @@ xcoff_write_archive_contents_big (abfd)
}
PRINT20 (ahdrp->size, s.st_size);
- PRINT12 (ahdrp->date, s.st_mtime);
+ PRINT12_LL (ahdrp->date, s.st_mtime);
PRINT12 (ahdrp->uid, s.st_uid);
PRINT12 (ahdrp->gid, s.st_gid);
PRINT12_OCTAL (ahdrp->mode, s.st_mode);
diff --git a/contrib/binutils/bfd/ecoff.c b/contrib/binutils/bfd/ecoff.c
index 45cdb1d..7a4b72e 100644
--- a/contrib/binutils/bfd/ecoff.c
+++ b/contrib/binutils/bfd/ecoff.c
@@ -3050,7 +3050,7 @@ _bfd_ecoff_write_armap (bfd *abfd,
linker just checks the archive name; the GNU linker may check the
date. */
stat (abfd->filename, &statbuf);
- sprintf (hdr.ar_date, "%ld", (long) (statbuf.st_mtime + 60));
+ sprintf (hdr.ar_date, "%lld", (long long) (statbuf.st_mtime + 60));
/* The DECstation uses zeroes for the uid, gid and mode of the
armap. */
diff --git a/contrib/binutils/bfd/libbfd-in.h b/contrib/binutils/bfd/libbfd-in.h
index 3555e6a..b6c2cbd 100644
--- a/contrib/binutils/bfd/libbfd-in.h
+++ b/contrib/binutils/bfd/libbfd-in.h
@@ -71,8 +71,7 @@ struct artdata {
symindex symdef_count; /* how many there are */
char *extended_names; /* clever intel extension */
bfd_size_type extended_names_size; /* Size of extended names */
- /* when more compilers are standard C, this can be a time_t */
- long armap_timestamp; /* Timestamp value written into armap.
+ time_t armap_timestamp; /* Timestamp value written into armap.
This is used for BSD archives to check
that the timestamp is recent enough
for the BSD linker to not complain,
diff --git a/contrib/binutils/bfd/libbfd.h b/contrib/binutils/bfd/libbfd.h
index 4c1414f..1a472d8 100644
--- a/contrib/binutils/bfd/libbfd.h
+++ b/contrib/binutils/bfd/libbfd.h
@@ -76,8 +76,7 @@ struct artdata {
symindex symdef_count; /* how many there are */
char *extended_names; /* clever intel extension */
bfd_size_type extended_names_size; /* Size of extended names */
- /* when more compilers are standard C, this can be a time_t */
- long armap_timestamp; /* Timestamp value written into armap.
+ time_t armap_timestamp; /* Timestamp value written into armap.
This is used for BSD archives to check
that the timestamp is recent enough
for the BSD linker to not complain,
OpenPOWER on IntegriCloud