From bf6743d1d773a90d0ae8097f51f8265840f61f49 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sat, 27 Jan 2007 08:42:48 +0000 Subject: [PATCH] Fix #96 by setting the timestamp in the COFF header. VC2005's incremental linker uses the timestamp to determine if the object file has been updated, so not setting it makes for bad behavior (the object file gets updated, but when the executable is linked it uses the older "internal" version). To keep tests passing, check an environment variable (YASM_TEST_SUITE); if this exists, the timestamp is set to 0. Set this environment variable in out_test.sh. svn path=/trunk/yasm/; revision=1742 --- modules/objfmts/coff/coff-objfmt.c | 8 +++++++- out_test.sh | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/objfmts/coff/coff-objfmt.c b/modules/objfmts/coff/coff-objfmt.c index dce18cce..ab08bf95 100644 --- a/modules/objfmts/coff/coff-objfmt.c +++ b/modules/objfmts/coff/coff-objfmt.c @@ -24,6 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include #include /*@unused@*/ RCSID("$Id$"); @@ -1139,6 +1140,7 @@ coff_objfmt_output(yasm_objfmt *objfmt, FILE *f, int all_syms, yasm_dbgfmt *df, unsigned long symtab_pos; unsigned long symtab_count; unsigned int flags; + unsigned long ts; if (objfmt_coff->filesym_data->aux[0].fname) yasm_xfree(objfmt_coff->filesym_data->aux[0].fname); @@ -1219,7 +1221,11 @@ coff_objfmt_output(yasm_objfmt *objfmt, FILE *f, int all_syms, yasm_dbgfmt *df, localbuf = info.buf; YASM_WRITE_16_L(localbuf, objfmt_coff->machine); /* magic number */ YASM_WRITE_16_L(localbuf, objfmt_coff->parse_scnum-1);/* number of sects */ - YASM_WRITE_32_L(localbuf, 0); /* time/date stamp */ + if (getenv("YASM_TEST_SUITE")) + ts = 0; + else + ts = (unsigned long)time(NULL); + YASM_WRITE_32_L(localbuf, ts); /* time/date stamp */ YASM_WRITE_32_L(localbuf, symtab_pos); /* file ptr to symtab */ YASM_WRITE_32_L(localbuf, symtab_count); /* number of symtabs */ YASM_WRITE_16_L(localbuf, 0); /* size of optional header (none) */ diff --git a/out_test.sh b/out_test.sh index f31cba4c..7cf2fe10 100755 --- a/out_test.sh +++ b/out_test.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#! /usr/bin/env YASM_TEST_SUITE=1 /bin/sh # $Id$ case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in -- 2.40.0