This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Make windres output deterministic by using constant (zero) timestamps.
- From: Cory Fields <cory at coryfields dot com>
- To: binutils at sourceware dot org
- Cc: nickc at redhat dot com, Cory Fields <cory at coryfields dot com>
- Date: Thu, 14 Nov 2013 15:20:32 -0500
- Subject: [PATCH] Make windres output deterministic by using constant (zero) timestamps.
- Authentication-results: sourceware.org; auth=none
binutils/
* windres.c (define_resource): Use zero for timestamp.
time.h include is no longer needed.
* resres.c (res_append_resource): Likewise.
---
binutils/ChangeLog | 5 +++++
binutils/resres.c | 14 +++++---------
binutils/windres.c | 14 +++++---------
3 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index cc9c6f9..acc6645 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-14 Cory Fields <cory@coryfields.com>
+ * windres.c (define_resource): Use zero for timestamp, making output
+ deterministic. time.h include is no longer needed.
+ * resres.c (res_append_resource): Likewise.
+
2013-11-13 Martin Mitas <mity@morous.org>
* rescoff.c (write_coff_file): Use 64-bit alignment for resource
diff --git a/binutils/resres.c b/binutils/resres.c
index ff95cb5..52a9f47 100644
--- a/binutils/resres.c
+++ b/binutils/resres.c
@@ -32,7 +32,6 @@
#include "windres.h"
#include <assert.h>
-#include <time.h>
static rc_uint_type write_res_directory (windres_bfd *, rc_uint_type,
const rc_res_directory *, const rc_res_id *,
@@ -660,17 +659,14 @@ res_append_resource (rc_res_directory **res_dirs, rc_res_resource *resource,
if (*res_dirs == NULL)
{
- static unsigned long timeval;
-
- /* Use the same timestamp for every resource created in a
- single run. */
- if (timeval == 0)
- timeval = time (NULL);
-
*res_dirs = ((rc_res_directory *)
res_alloc (sizeof (rc_res_directory)));
+
+ /* Using a real timestamp only serves to create non-deterministic
+ results. Use zero instead. */
+ (*res_dirs)->time = 0;
+
(*res_dirs)->characteristics = 0;
- (*res_dirs)->time = timeval;
(*res_dirs)->major = 0;
(*res_dirs)->minor = 0;
(*res_dirs)->entries = NULL;
diff --git a/binutils/windres.c b/binutils/windres.c
index 7de73ef..3ef83af 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -37,7 +37,6 @@
#include "sysdep.h"
#include <assert.h>
-#include <time.h>
#include "bfd.h"
#include "getopt.h"
#include "bucomm.h"
@@ -339,17 +338,14 @@ define_resource (rc_res_directory **resources, int cids,
if (*resources == NULL)
{
- static unsigned int timeval;
-
- /* Use the same timestamp for every resource created in a
- single run. */
- if (timeval == 0)
- timeval = time (NULL);
-
*resources = ((rc_res_directory *)
res_alloc (sizeof (rc_res_directory)));
+
+ /* Using a real timestamp only serves to create non-deterministic
+ results. Use zero instead. */
+ (*resources)->time = 0;
+
(*resources)->characteristics = 0;
- (*resources)->time = timeval;
(*resources)->major = 0;
(*resources)->minor = 0;
(*resources)->entries = NULL;
--
1.8.1.2