]> granicus.if.org Git - yasm/commitdiff
Fix #96 by setting the timestamp in the COFF header. VC2005's incremental linker...
authorPeter Johnson <peter@tortall.net>
Sat, 27 Jan 2007 08:42:48 +0000 (08:42 -0000)
committerPeter Johnson <peter@tortall.net>
Sat, 27 Jan 2007 08:42:48 +0000 (08:42 -0000)
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
out_test.sh

index dce18cced3004fb914c3bf5c3a8710c405b7338c..ab08bf95ec568f4a0207d145ca0fb9589b33ecf8 100644 (file)
@@ -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 <time.h>
 #include <util.h>
 /*@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) */
index f31cba4cdb274c61bd141ebb3c11ca4905af81fe..7cf2fe106017afe50fcb5c0bdbbb7fcfbd472a97 100755 (executable)
@@ -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