summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Curtis <dalecurtis@chromium.org>2018-11-19 13:52:05 -0800
committerDale Curtis <dalecurtis@chromium.org>2018-11-26 23:02:03 +0000
commit4ee6a69ce33be1e96fd3c44a6e3ae3d8177453da (patch)
tree7521966c1642143d85708dae481b8f1f4d224361
parent417709dfd155acb4c7097d0232d4478817a77d2f (diff)
downloadnasm-4ee6a69ce33be1e96fd3c44a6e3ae3d8177453da.tar.gz
Remove uses of time(NULL) for build determism.
Removes cases suggested on the bug. BUG=766721 TEST=none Change-Id: I88c11d052aef8a9c4e48b3b976ad432f3b008dd6
-rw-r--r--README.patches16
-rw-r--r--asm/nasm.c5
-rw-r--r--output/outcoff.c3
3 files changed, 23 insertions, 1 deletions
diff --git a/README.patches b/README.patches
index 005ccc1f..9c630382 100644
--- a/README.patches
+++ b/README.patches
@@ -25,3 +25,19 @@ Affects:
include/ver.h
nasmlib/ver.c
+------------------------------------------------------------------
+commit e5417246fc34b430f241f055b8b9570f5d9ab2c3
+Author: Dale Curtis <dalecurtis@chromium.org>
+Date: Mon Nov 19 13:50:47 2018 -0800
+
+ Remove uses of time(NULL) for build determism.
+
+ Removes cases suggested on the bug.
+
+ BUG=766721
+ TEST=none
+
+Affects:
+ output/outcoff.c
+ asm/nasm.c
+
diff --git a/asm/nasm.c b/asm/nasm.c
index c935cc47..ad05e44f 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -381,6 +381,10 @@ static int64_t make_posix_time(const struct tm *tm)
static void timestamp(void)
{
struct compile_time * const oct = &official_compile_time;
+#if 1
+ // Chromium patch: Builds should be deterministic and not embed timestamps.
+ memset(oct, 0, sizeof(official_compile_time));
+#else
const struct tm *tp, *best_gm;
time(&oct->t);
@@ -409,6 +413,7 @@ static void timestamp(void)
oct->posix = make_posix_time(best_gm);
oct->have_posix = true;
}
+#endif
}
int main(int argc, char **argv)
diff --git a/output/outcoff.c b/output/outcoff.c
index d26e2985..c7af1b7c 100644
--- a/output/outcoff.c
+++ b/output/outcoff.c
@@ -921,7 +921,8 @@ static void coff_write(void)
i = IMAGE_FILE_MACHINE_I386;
fwriteint16_t(i, ofile); /* machine type */
fwriteint16_t(coff_nsects, ofile); /* number of sections */
- fwriteint32_t(time(NULL), ofile); /* time stamp */
+ // Chromium patch: Builds should be deterministic and not embed timestamps.
+ fwriteint32_t(0, ofile); /* time stamp */
fwriteint32_t(sympos, ofile);
fwriteint32_t(coff_nsyms + initsym, ofile);
fwriteint16_t(0, ofile); /* no optional header */