Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 1299fde

Browse files
Alexey PavlyutkinYuri Nesterenko
Alexey Pavlyutkin
authored and
Yuri Nesterenko
committed
8241271: Make hotspot build reproducible
Backport-of: 9010293
1 parent b34726f commit 1299fde

File tree

7 files changed

+37
-10
lines changed

7 files changed

+37
-10
lines changed

make/autoconf/compare.sh.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
9696
fi
9797
fi
9898

99+
export HOTSPOT_BUILD_TIME="@HOTSPOT_BUILD_TIME@"
100+
export USE_PRECOMPILED_HEADER="@USE_PRECOMPILED_HEADER@"
101+
99102
# Now locate the main script and run it.
100103
REAL_COMPARE_SCRIPT="$TOPDIR/make/scripts/compare.sh"
101104
if [ ! -e "$REAL_COMPARE_SCRIPT" ]; then

make/autoconf/hotspot.m4

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,15 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
307307
308308
fi
309309
310+
AC_ARG_WITH([hotspot-build-time], [AS_HELP_STRING([--with-hotspot-build-time],
311+
[timestamp to use in hotspot version string, empty for on-the-fly @<:@empty@:>@])])
312+
313+
if test "x$with_hotspot_build_time" != x; then
314+
HOTSPOT_BUILD_TIME="$with_hotspot_build_time"
315+
fi
316+
AC_SUBST(HOTSPOT_BUILD_TIME)
317+
318+
310319
# Override hotspot cpu definitions for ARM platforms
311320
if test "x$OPENJDK_TARGET_CPU" = xarm; then
312321
HOTSPOT_TARGET_CPU=arm_32

make/autoconf/spec.gmk.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ IMPORT_MODULES_SRC:=@IMPORT_MODULES_SRC@
156156
IMPORT_MODULES_MAKE:=@IMPORT_MODULES_MAKE@
157157

158158
COPYRIGHT_YEAR:=@COPYRIGHT_YEAR@
159+
HOTSPOT_BUILD_TIME:=@HOTSPOT_BUILD_TIME@
159160

160161
# Platform naming variables
161162
LAUNCHER_NAME:=@LAUNCHER_NAME@

make/conf/jib-profiles.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ var getJibProfilesCommon = function (input, data) {
248248
common.main_profile_base = {
249249
dependencies: ["boot_jdk", "gnumake", "jtreg", "jib", "autoconf", "jmh", "jcov"],
250250
default_make_targets: ["product-bundles", "test-bundles", "static-libs-bundles"],
251-
configure_args: concat(["--enable-jtreg-failure-handler"],
251+
configure_args: concat("--enable-jtreg-failure-handler",
252252
"--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",
253253
"--disable-manpages",
254254
"--with-jvm-features=-shenandoahgc",
@@ -777,6 +777,10 @@ var getJibProfilesProfiles = function (input, common, data) {
777777
= concat(profiles[cmpBaselineName].default_make_targets, "docs");
778778
}
779779
profiles[cmpBaselineName].make_args = [ "COMPARE_BUILD=CONF=" ];
780+
profiles[cmpBaselineName].configure_args = concat(
781+
profiles[cmpBaselineName].configure_args,
782+
"--with-hotspot-build-time=n/a",
783+
"--disable-precompiled-headers");
780784
// Do not inherit artifact definitions from base profile
781785
delete profiles[cmpBaselineName].artifacts;
782786
});

make/hotspot/lib/CompileJvm.gmk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ CFLAGS_VM_VERSION := \
7575
-DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
7676
#
7777

78+
ifneq ($(HOTSPOT_BUILD_TIME), )
79+
CFLAGS_VM_VERSION += -DHOTSPOT_BUILD_TIME='"$(HOTSPOT_BUILD_TIME)"'
80+
endif
81+
7882
################################################################################
7983
# Disabled warnings
8084

make/scripts/compare_exceptions.sh.incl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ fi
3636
# Diff exceptions
3737

3838
if [ "$OPENJDK_TARGET_OS" = "linux" ]; then
39-
ACCEPTED_BIN_DIFF="
40-
./lib/server/libjvm.so
41-
./hotspot/gtest/server/libjvm.so
42-
"
43-
STRIP_BEFORE_COMPARE="
44-
./hotspot/gtest/server/libjvm.so
45-
"
39+
if [ "$HOTSPOT_BUILD_TIME" = "" -o "$USE_PRECOMPILED_HEADER" = "true" ]; then
40+
ACCEPTED_BIN_DIFF="
41+
./lib/server/libjvm.so
42+
./hotspot/gtest/server/libjvm.so
43+
"
44+
STRIP_BEFORE_COMPARE="
45+
./hotspot/gtest/server/libjvm.so
46+
"
47+
fi
4648
elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
4749
SKIP_BIN_DIFF="true"
4850
SKIP_FULLDUMP_DIFF="true"

src/hotspot/share/runtime/abstract_vm_version.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -274,9 +274,13 @@ const char* Abstract_VM_Version::internal_vm_info_string() {
274274
#define FLOAT_ARCH_STR XSTR(FLOAT_ARCH)
275275
#endif
276276

277+
#ifndef HOTSPOT_BUILD_TIME
278+
#define HOTSPOT_BUILD_TIME __DATE__ " " __TIME__
279+
#endif
280+
277281
#define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
278282
" for " OS "-" CPU FLOAT_ARCH_STR \
279-
" JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
283+
" JRE (" VERSION_STRING "), built on " HOTSPOT_BUILD_TIME \
280284
" by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
281285

282286
return strcmp(DEBUG_LEVEL, "release") == 0

0 commit comments

Comments
 (0)