changeset 49728:78af880eec61

8199749: Debug symbols are not copied to exploded image on Mac Reviewed-by: ihse
author erikj
date Mon, 19 Mar 2018 10:11:07 -0700
parents 1b3ee04e3e54
children 2910110c4381 ac3b9e96ffc4 79f6a4dc221e
files make/common/NativeCompilation.gmk make/hotspot/lib/CompileJvm.gmk make/lib/Awt2dLibraries.gmk
diffstat 3 files changed, 30 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/make/common/NativeCompilation.gmk	Mon Mar 19 09:58:41 2018 -0400
+++ b/make/common/NativeCompilation.gmk	Mon Mar 19 10:11:07 2018 -0700
@@ -798,10 +798,6 @@
               "-map:$$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).map"
           $1_DEBUGINFO_FILES := $$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).pdb \
               $$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).map
-          # No separate command is needed for debuginfo on windows, instead
-          # touch target to make sure it has a later time stamp than the debug
-          # symbol files to avoid unnecessary relinking on rebuild.
-          $1_CREATE_DEBUGINFO_CMDS := $(TOUCH) $$($1_TARGET)
 
         else ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
           $1_DEBUGINFO_FILES := $$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).debuginfo
@@ -816,15 +812,23 @@
           $1_DEBUGINFO_FILES := \
               $$($1_OUTPUT_DIR)/$$($1_BASENAME).dSYM/Contents/Info.plist \
               $$($1_OUTPUT_DIR)/$$($1_BASENAME).dSYM/Contents/Resources/DWARF/$$($1_BASENAME)
-          # On Macosx, the debuginfo generation doesn't touch the linked binary, but
-          # to avoid always relinking, touch it anyway to force a later timestamp than
-          # the dSYM files.
           $1_CREATE_DEBUGINFO_CMDS := \
-              $(DSYMUTIL) --out $$($1_OUTPUT_DIR)/$$($1_BASENAME).dSYM $$($1_TARGET) $$(NEWLINE) \
-              $(TOUCH) $$($1_TARGET)
+              $(DSYMUTIL) --out $$($1_OUTPUT_DIR)/$$($1_BASENAME).dSYM $$($1_TARGET)
         endif # OPENJDK_TARGET_OS
 
+        # Since the link rule creates more than one file that we want to track,
+        # we have to use some tricks to get make to cooperate. To properly
+        # trigger downstream dependants of $$($1_DEBUGINFO_FILES), we must have
+        # a recipe in the rule below. To avoid rerunning the recipe every time
+        # have it touch the target. If a debuginfo file is deleted by something
+        # external, explicitly delete the TARGET to trigger a rebuild of both.
+        ifneq ($$(wildcard $$($1_DEBUGINFO_FILES)), $$($1_DEBUGINFO_FILES))
+          $$(call LogDebug, Deleting $$($1_BASENAME) because debuginfo files are missing)
+          $$(shell $(RM) $$($1_TARGET))
+        endif
         $$($1_DEBUGINFO_FILES): $$($1_TARGET)
+		$$(if $$(wildcard $$@), , $$(error $$@ was not created for $$<))
+		$(TOUCH) $$@
 
         $1 += $$($1_DEBUGINFO_FILES)
 
@@ -859,9 +863,20 @@
     # Generating a dynamic library.
     $1_EXTRA_LDFLAGS += $$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
     ifeq ($(OPENJDK_TARGET_OS), windows)
-      $1_EXTRA_LDFLAGS += "-implib:$$($1_OBJECT_DIR)/$$($1_NAME).lib"
-      # Create a rule for the import lib so that other rules may depend on it
-      $$($1_OBJECT_DIR)/$$($1_NAME).lib: $$($1_TARGET)
+      $1_IMPORT_LIBRARY := $$($1_OBJECT_DIR)/$$($1_NAME).lib
+      $1_EXTRA_LDFLAGS += "-implib:$$($1_IMPORT_LIBRARY)"
+      # To properly trigger downstream dependants of the import library, just as
+      # for debug files, we must have a recipe in the rule. To avoid rerunning
+      # the recipe every time have it touch the target. If an import library
+      # file is deleted by something external, explicitly delete the target to
+      # trigger a rebuild of both.
+      ifneq ($$(wildcard $$($1_IMPORT_LIBRARY)), $$($1_IMPORT_LIBRARY))
+        $$(call LogDebug, Deleting $$($1_BASENAME) because import library is missing)
+        $$(shell $(RM) $$($1_TARGET))
+      endif
+      $$($1_IMPORT_LIBRARY): $$($1_TARGET)
+		$$(if $$(wildcard $$@), , $$(error $$@ was not created for $$<))
+		$(TOUCH) $$@
     endif
 
     # Create loadmap on AIX. Helps in diagnosing some problems.
--- a/make/hotspot/lib/CompileJvm.gmk	Mon Mar 19 09:58:41 2018 -0400
+++ b/make/hotspot/lib/CompileJvm.gmk	Mon Mar 19 10:11:07 2018 -0700
@@ -243,10 +243,10 @@
 ifeq ($(OPENJDK_TARGET_OS), windows)
   # It doesn't matter which jvm.lib file gets exported, but we need
   # to pick just one.
-  ifeq ($(JVM_VARIANT), $(firstword $(JVM_VARIANTS)))
+  ifeq ($(JVM_VARIANT), $(JVM_VARIANT_MAIN))
     $(eval $(call SetupCopyFiles, COPY_JVM_LIB, \
         DEST := $(LIB_OUTPUTDIR), \
-        FILES :=$(JVM_VARIANT_OUTPUTDIR)/libjvm/objs/jvm.lib, \
+        FILES :=$(BUILD_LIBJVM_IMPORT_LIBRARY), \
     ))
     TARGETS += $(COPY_JVM_LIB)
   endif
--- a/make/lib/Awt2dLibraries.gmk	Mon Mar 19 09:58:41 2018 -0400
+++ b/make/lib/Awt2dLibraries.gmk	Mon Mar 19 10:11:07 2018 -0700
@@ -739,7 +739,7 @@
   $(BUILD_LIBJAWT): $(BUILD_LIBAWT)
 
   $(eval $(call SetupCopyFiles, COPY_JAWT_LIB, \
-      FILES := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX), \
+      FILES := $(BUILD_LIBJAWT_IMPORT_LIBRARY), \
       DEST := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
   ))