From 5fa2bdc6c76d8f70c8d8582889e96b9c0d2b86b5 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 28 Feb 2024 22:48:17 +0000 Subject: [PATCH] 8326953: Race in creation of win-exports.def with static-libs Reviewed-by: jwaters, erikj, dholmes --- make/hotspot/lib/CompileJvm.gmk | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk index e9175efd4e9..69cd80f5171 100644 --- a/make/hotspot/lib/CompileJvm.gmk +++ b/make/hotspot/lib/CompileJvm.gmk @@ -146,7 +146,11 @@ $(call FillFindCache, $(JVM_SRC_DIRS)) LIBJVM_STATIC_EXCLUDE_OBJS := operator_new.o ifeq ($(call isTargetOs, windows), true) - WIN_EXPORT_FILE := $(JVM_OUTPUTDIR)/win-exports.def + ifeq ($(STATIC_LIBS), true) + WIN_EXPORT_FILE := $(JVM_OUTPUTDIR)/static-win-exports.def + else + WIN_EXPORT_FILE := $(JVM_OUTPUTDIR)/win-exports.def + endif JVM_LDFLAGS += -def:$(WIN_EXPORT_FILE) endif @@ -232,7 +236,7 @@ ifeq ($(call isTargetOs, windows), true) # std::function f = [](){} FILTER_SYMBOLS_AWK_SCRIPT := \ '{ \ - if ($$7 ~ /\?\?_7.*@@6B@/ && $$7 !~ /type_info/ && $$7 !~ /lambda/) print $$7; \ + if ($$7 ~ /\?\?_7.*@@6B@/ && $$7 !~ /type_info/ && $$7 !~ /lambda/) print " " $$7; \ }' # A more correct solution would be to send BUILD_LIBJVM_ALL_OBJS instead of @@ -241,10 +245,9 @@ ifeq ($(call isTargetOs, windows), true) $(WIN_EXPORT_FILE): $(BUILD_LIBJVM_ALL_OBJS) $(call LogInfo, Generating list of symbols to export from object files) $(call MakeDir, $(@D)) - $(CD) $(JVM_OUTPUTDIR)/objs && \ - $(DUMPBIN) -symbols *$(OBJ_SUFFIX) | $(AWK) $(FILTER_SYMBOLS_AWK_SCRIPT) | $(SORT) -u > $@.syms $(ECHO) "EXPORTS" > $@.tmp - $(AWK) '{ if ($$0 ~ ".") { print " " $$0 } }' < $@.syms >> $@.tmp + $(CD) $(BUILD_LIBJVM_OBJECT_DIR) && \ + $(DUMPBIN) -symbols *$(OBJ_SUFFIX) | $(AWK) $(FILTER_SYMBOLS_AWK_SCRIPT) | $(SORT) -u >> $@.tmp $(RM) $@ $(MV) $@.tmp $@