8202738: vm_version Abstract_VM_Version::internal_vm_info_string() returns same string for different incremental builds
Reviewed-by: ihse, jiangli
--- a/make/common/NativeCompilation.gmk Wed May 16 18:03:20 2018 +0200
+++ b/make/common/NativeCompilation.gmk Wed May 16 09:37:00 2018 -0700
@@ -391,6 +391,13 @@
# STRIPFLAGS Optionally change the flags given to the strip command
# PRECOMPILED_HEADER Header file to use as precompiled header
# PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH
+#
+# After being called, some variables are exported from this macro, all prefixed
+# with parameter 1 followed by a '_':
+# TARGET The library or executable created by the macro
+# TARGET_DEPS All prerequisites for the target calculated by the macro
+# ALL_OBJS All object files
+# IMPORT_LIBRARY The import library created for a shared library on Windows
SetupNativeCompilation = $(NamedParamsMacroTemplate)
define SetupNativeCompilationBody
@@ -874,7 +881,9 @@
endif
endif
- $$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE) $$(STATIC_MAPFILE_DEP)
+ $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE) $$(STATIC_MAPFILE_DEP)
+
+ $$($1_TARGET): $$($1_TARGET_DEPS)
$$(call LogInfo, Building static library $$($1_BASENAME))
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \
$$($1_AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_ALL_OBJS) \
@@ -964,8 +973,10 @@
endif
endif
- $$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \
+ $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \
$$($1_REAL_MAPFILE) $$($1_VARDEPS_FILE)
+
+ $$($1_TARGET): $$($1_TARGET_DEPS)
ifneq ($$($1_OBJ_FILE_LIST), )
ifeq ($$($1_LINK_OBJS_RELATIVE), true)
$$(eval $$(call ListPathsSafely, $1_ALL_OBJS_RELATIVE, $$($1_OBJ_FILE_LIST)))
--- a/make/hotspot/lib/CompileJvm.gmk Wed May 16 18:03:20 2018 +0200
+++ b/make/hotspot/lib/CompileJvm.gmk Wed May 16 09:37:00 2018 -0700
@@ -177,6 +177,13 @@
PRECOMPILED_HEADER_EXCLUDE := $(JVM_PRECOMPILED_HEADER_EXCLUDE), \
))
+# Always recompile vm_version.cpp if libjvm needs to be relinked. This ensures
+# that the internal vm version is updated as it relies on __DATE__ and __TIME__
+# macros.
+VM_VERSION_OBJ := $(JVM_OUTPUTDIR)/objs/vm_version$(OBJ_SUFFIX)
+$(VM_VERSION_OBJ): $(filter-out $(VM_VERSION_OBJ) $(JVM_MAPFILE), \
+ $(BUILD_LIBJVM_TARGET_DEPS))
+
ifeq ($(OPENJDK_TARGET_OS), windows)
# It doesn't matter which jvm.lib file gets exported, but we need
# to pick just one.