changeset 60601:f81815820cd5

8241271: Make hotspot build reproducible Reviewed-by: erikj, stefank, jwilhelm
author ihse
date Mon, 23 Mar 2020 10:29:04 +0100
parents 3ecfa2b80db2
children d2d076a7dfc4
files make/autoconf/compare.sh.in make/autoconf/hotspot.m4 make/autoconf/spec.gmk.in make/conf/jib-profiles.js make/hotspot/lib/CompileJvm.gmk make/scripts/compare_exceptions.sh.incl src/hotspot/share/runtime/abstract_vm_version.cpp
diffstat 7 files changed, 37 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/make/autoconf/compare.sh.in	Mon Mar 23 10:26:13 2020 +0100
+++ b/make/autoconf/compare.sh.in	Mon Mar 23 10:29:04 2020 +0100
@@ -95,6 +95,9 @@
   fi
 fi
 
+export HOTSPOT_BUILD_TIME="@HOTSPOT_BUILD_TIME@"
+export USE_PRECOMPILED_HEADER="@USE_PRECOMPILED_HEADER@"
+
 # Now locate the main script and run it.
 REAL_COMPARE_SCRIPT="$TOPDIR/make/scripts/compare.sh"
 if [ ! -e "$REAL_COMPARE_SCRIPT" ]; then
--- a/make/autoconf/hotspot.m4	Mon Mar 23 10:26:13 2020 +0100
+++ b/make/autoconf/hotspot.m4	Mon Mar 23 10:29:04 2020 +0100
@@ -157,6 +157,15 @@
     HOTSPOT_TARGET_CPU_ARCH=zero
   fi
 
+  AC_ARG_WITH([hotspot-build-time], [AS_HELP_STRING([--with-hotspot-build-time],
+  [timestamp to use in hotspot version string, empty for on-the-fly @<:@empty@:>@])])
+
+  if test "x$with_hotspot_build_time" != x; then
+    HOTSPOT_BUILD_TIME="$with_hotspot_build_time"
+  fi
+  AC_SUBST(HOTSPOT_BUILD_TIME)
+
+
   # Override hotspot cpu definitions for ARM platforms
   if test "x$OPENJDK_TARGET_CPU" = xarm; then
     HOTSPOT_TARGET_CPU=arm_32
--- a/make/autoconf/spec.gmk.in	Mon Mar 23 10:26:13 2020 +0100
+++ b/make/autoconf/spec.gmk.in	Mon Mar 23 10:29:04 2020 +0100
@@ -156,6 +156,7 @@
 IMPORT_MODULES_MAKE:=@IMPORT_MODULES_MAKE@
 
 COPYRIGHT_YEAR:=@COPYRIGHT_YEAR@
+HOTSPOT_BUILD_TIME:=@HOTSPOT_BUILD_TIME@
 
 # Platform naming variables
 LAUNCHER_NAME:=@LAUNCHER_NAME@
--- a/make/conf/jib-profiles.js	Mon Mar 23 10:26:13 2020 +0100
+++ b/make/conf/jib-profiles.js	Mon Mar 23 10:29:04 2020 +0100
@@ -248,7 +248,7 @@
     common.main_profile_base = {
         dependencies: ["boot_jdk", "gnumake", "jtreg", "jib", "autoconf", "jmh", "jcov"],
         default_make_targets: ["product-bundles", "test-bundles", "static-libs-bundles"],
-        configure_args: concat(["--enable-jtreg-failure-handler"],
+        configure_args: concat("--enable-jtreg-failure-handler",
             "--with-exclude-translations=de,es,fr,it,ko,pt_BR,sv,ca,tr,cs,sk,ja_JP_A,ja_JP_HA,ja_JP_HI,ja_JP_I,zh_TW,zh_HK",
             "--disable-manpages",
             "--disable-jvm-feature-shenandoahgc",
@@ -776,6 +776,10 @@
                     = concat(profiles[cmpBaselineName].default_make_targets, "docs");
             }
             profiles[cmpBaselineName].make_args = [ "COMPARE_BUILD=CONF=" ];
+            profiles[cmpBaselineName].configure_args = concat(
+                profiles[cmpBaselineName].configure_args,
+                "--with-hotspot-build-time=n/a", 
+                "--disable-precompiled-headers");
             // Do not inherit artifact definitions from base profile
             delete profiles[cmpBaselineName].artifacts;
         });
--- a/make/hotspot/lib/CompileJvm.gmk	Mon Mar 23 10:26:13 2020 +0100
+++ b/make/hotspot/lib/CompileJvm.gmk	Mon Mar 23 10:29:04 2020 +0100
@@ -75,6 +75,10 @@
     -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
     #
 
+ifneq ($(HOTSPOT_BUILD_TIME), )
+  CFLAGS_VM_VERSION += -DHOTSPOT_BUILD_TIME='"$(HOTSPOT_BUILD_TIME)"'
+endif
+
 ################################################################################
 # Disabled warnings
 
--- a/make/scripts/compare_exceptions.sh.incl	Mon Mar 23 10:26:13 2020 +0100
+++ b/make/scripts/compare_exceptions.sh.incl	Mon Mar 23 10:29:04 2020 +0100
@@ -36,13 +36,15 @@
 # Diff exceptions
 
 if [ "$OPENJDK_TARGET_OS" = "linux" ]; then
-  ACCEPTED_BIN_DIFF="
-      ./lib/server/libjvm.so
-      ./hotspot/gtest/server/libjvm.so
-      "
-  STRIP_BEFORE_COMPARE="
-      ./hotspot/gtest/server/libjvm.so
-      "
+  if [ "$HOTSPOT_BUILD_TIME" = "" -o "$USE_PRECOMPILED_HEADER" = "true" ]; then
+    ACCEPTED_BIN_DIFF="
+        ./lib/server/libjvm.so
+        ./hotspot/gtest/server/libjvm.so
+        "
+    STRIP_BEFORE_COMPARE="
+        ./hotspot/gtest/server/libjvm.so
+        "
+   fi
 elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
   SKIP_BIN_DIFF="true"
   SKIP_FULLDUMP_DIFF="true"
--- a/src/hotspot/share/runtime/abstract_vm_version.cpp	Mon Mar 23 10:26:13 2020 +0100
+++ b/src/hotspot/share/runtime/abstract_vm_version.cpp	Mon Mar 23 10:29:04 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -273,9 +273,13 @@
     #define FLOAT_ARCH_STR XSTR(FLOAT_ARCH)
   #endif
 
+  #ifndef HOTSPOT_BUILD_TIME
+    #define HOTSPOT_BUILD_TIME __DATE__ " " __TIME__
+  #endif
+
   #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
          " for " OS "-" CPU FLOAT_ARCH_STR \
-         " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+         " JRE (" VERSION_STRING "), built on " HOTSPOT_BUILD_TIME \
          " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
 
   return strcmp(DEBUG_LEVEL, "release") == 0