Merge
authorduke
Wed, 05 Jul 2017 22:18:27 +0200
changeset 41348 f7adcb30658a
parent 41347 ddbbb16c6b6e (current diff)
parent 41275 0ffcfee0d9a9 (diff)
child 41416 9c2e348c03c3
Merge
make/StripBinaries.gmk
--- a/.hgtags-top-repo	Thu Oct 06 18:05:53 2016 -0700
+++ b/.hgtags-top-repo	Wed Jul 05 22:18:27 2017 +0200
@@ -381,3 +381,4 @@
 3ec350f5f32af249b59620d7e37b54bdcd77b233 jdk-9+136
 d7f519b004254b19e384131d9f0d0e40e31a0fd3 jdk-9+137
 67c4388142bdf58aec8fefa4475faaa8a5d7380c jdk-9+138
+7dcf453eacae79ee86a6bcc75fd0b546fc99b48a jdk-9+139
--- a/ASSEMBLY_EXCEPTION	Thu Oct 06 18:05:53 2016 -0700
+++ b/ASSEMBLY_EXCEPTION	Wed Jul 05 22:18:27 2017 +0200
@@ -1,27 +1,27 @@
 
 OPENJDK ASSEMBLY EXCEPTION
 
-The OpenJDK source code made available by Sun at openjdk.java.net and
-openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
-GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
+openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
+General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
 only ("GPL2"), with the following clarification and special exception.
 
     Linking this OpenJDK Code statically or dynamically with other code
     is making a combined work based on this library.  Thus, the terms
     and conditions of GPL2 cover the whole combination.
 
-    As a special exception, Sun gives you permission to link this
-    OpenJDK Code with certain code licensed by Sun as indicated at
+    As a special exception, Oracle gives you permission to link this
+    OpenJDK Code with certain code licensed by Oracle as indicated at
     http://openjdk.java.net/legal/exception-modules-2007-05-08.html
     ("Designated Exception Modules") to produce an executable,
     regardless of the license terms of the Designated Exception Modules,
     and to copy and distribute the resulting executable under GPL2,
     provided that the Designated Exception Modules continue to be
-    governed by the licenses under which they were offered by Sun.
+    governed by the licenses under which they were offered by Oracle.
 
-As such, it allows licensees and sublicensees of Sun's GPL2 OpenJDK Code to
-build an executable that includes those portions of necessary code that Sun
-could not provide under GPL2 (or that Sun has provided under GPL2 with the
-Classpath exception).  If you modify or add to the OpenJDK code, that new
-GPL2 code may still be combined with Designated Exception Modules if the
-new code is made subject to this exception by its copyright holder.
+As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
+to build an executable that includes those portions of necessary code that
+Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
+with the Classpath exception).  If you modify or add to the OpenJDK code,
+that new GPL2 code may still be combined with Designated Exception Modules
+if the new code is made subject to this exception by its copyright holder.
--- a/common/bin/compare.sh	Thu Oct 06 18:05:53 2016 -0700
+++ b/common/bin/compare.sh	Wed Jul 05 22:18:27 2017 +0200
@@ -654,10 +654,10 @@
             OTHER_DIZ_FILE="$OTHER/support/native/java.base/java_objs/java.diz"
         elif [ "$NAME" = "jimage.exe" ] \
                && [ -f "$OTHER/support/native/jdk.jlink/jimage_objs/jimage.diz" ]; then
-            OTHER_DIZ_FILE="$OTHER/support/native/jdk.jlink/jimage_objs/jimage.diz"
+            OTHER_DIZ_FILE="$OTHER/support/modules_cmds/jdk.jlink/jimage.diz"
         elif [ "$NAME" = "javacpl.exe" ] \
                && [ -f "$OTHER/support/native/jdk.plugin/javacpl/javacpl.diz" ]; then
-            OTHER_DIZ_FILE="$OTHER/support/native/jdk.plugin/javacpl/javacpl.diz"
+            OTHER_DIZ_FILE="$OTHER/support/modules_cmds/jdk.deploy.controlpanel/javacpl.diz"
         elif [ -f "${OTHER_FILE_BASE}.diz" ]; then
             OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz
         else
@@ -686,10 +686,10 @@
             THIS_DIZ_FILE="$THIS/support/native/java.base/java_objs/java.diz"
         elif [ "$NAME" = "jimage.exe" ] \
                && [ -f "$THIS/support/native/jdk.jlink/jimage_objs/jimage.diz" ]; then
-            THIS_DIZ_FILE="$THIS/support/native/jdk.jlink/jimage_objs/jimage.diz"
+            THIS_DIZ_FILE="$THIS/support/modules_cmds/jdk.jlink/jimage.diz"
         elif [ "$NAME" = "javacpl.exe" ] \
                && [ -f "$THIS/support/native/jdk.plugin/javacpl/javacpl.diz" ]; then
-            THIS_DIZ_FILE="$THIS/support/native/jdk.plugin/javacpl/javacpl.diz"
+            THIS_DIZ_FILE="$THIS/support/modules_cmds/jdk.deploy.controlpanel/javacpl.diz"
         elif [ -f "${THIS_FILE_BASE}.diz" ]; then
             THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz
         else
--- a/make/CompileJavaModules.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ b/make/CompileJavaModules.gmk	Wed Jul 05 22:18:27 2017 +0200
@@ -95,7 +95,7 @@
 ################################################################################
 
 java.desktop_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference \
-    '-Xdoclint/package:java.*,javax.*' -Xlint:-deprecation 
+    '-Xdoclint/package:java.*,javax.*' -Xlint:-deprecation,-exports
 java.desktop_COPY := .gif .png .wav .txt .xml .css .pf
 java.desktop_CLEAN := iio-plugin.properties cursors.properties
 
@@ -316,7 +316,7 @@
 
 ################################################################################
 
-java.naming_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
+java.naming_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*' -Xlint:-exports
 java.naming_CLEAN := jndiprovider.properties
 
 ################################################################################
@@ -344,6 +344,10 @@
 
 ################################################################################
 
+jdk.accessibility_ADD_JAVAC_FLAGS := -Xlint:-exports
+
+################################################################################
+
 jdk.compiler_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:-com.sun.tools.*' \
     -XDstringConcat=inline
 jdk.compiler_CLEAN_FILES := $(wildcard \
@@ -352,6 +356,10 @@
 
 ################################################################################
 
+jdk.jshell_ADD_JAVAC_FLAGS := -Xlint:-exports
+
+################################################################################
+
 jdk.hotspot.agent_ADD_JAVAC_FLAGS := $(DISABLE_WARNINGS),-overrides
 jdk.hotspot.agent_COPY := .gif .png sa.js .properties
 
@@ -428,6 +436,10 @@
 
 ################################################################################
 
+jdk.jsobject_ADD_JAVAC_FLAGS := -Xlint:-exports
+
+################################################################################
+
 jdk.dev_CLEAN_FILES := $(wildcard \
     $(patsubst %, $(JDK_TOPDIR)/src/jdk.dev/share/classes/%/*.properties, \
         com/sun/tools/script/shell))
@@ -440,6 +452,10 @@
 
 ################################################################################
 
+jdk.vm.ci_ADD_JAVAC_FLAGS := -Xlint:-exports
+
+################################################################################
+
 jdk.xml.bind_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
 jdk.xml.bind_CLEAN := .properties
 jdk.xml.bind_COPY := .xsd JAXBContextFactory.java ZeroOneBooleanAdapter.java
--- a/make/CopyImportModules.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ b/make/CopyImportModules.gmk	Wed Jul 05 22:18:27 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2016, 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
@@ -59,9 +59,24 @@
     $(eval $(call SetupCopyFiles, COPY_LIBS, \
         SRC := $(LIBS_DIR), \
         DEST := $(JDK_OUTPUTDIR)/lib, \
-        FILES := $(call CacheFind, $(LIBS_DIR)), \
+        FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \
     ))
-    TARGETS += $(COPY_LIBS)
+
+    # Use relative links if the import dir is inside the OUTPUT_ROOT, otherwise
+    # copy to avoid having automated systems following symlinks when deleting files,
+    # or risk invalidating the build output from external changes.
+    ifeq ($(filter $(OUTPUT_ROOT)/%, $(LIBS_DIR)), )
+      LINK_MACRO := install-file
+    else
+      LINK_MACRO := link-file-relative
+    endif
+    $(eval $(call SetupCopyFiles, LINK_LIBS, \
+        SRC := $(LIBS_DIR), \
+        DEST := $(JDK_OUTPUTDIR)/lib, \
+        FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \
+        MACRO := $(LINK_MACRO), \
+    ))
+    TARGETS += $(COPY_LIBS) $(LINK_LIBS)
   endif
 endif
 
--- a/make/CreateJmods.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ b/make/CreateJmods.gmk	Wed Jul 05 22:18:27 2017 +0200
@@ -38,9 +38,9 @@
 JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
 
 LIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
-    $(SUPPORT_OUTPUTDIR)/modules_libs-stripped $(IMPORT_MODULES_LIBS))))
+    $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
 CMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
-    $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped $(IMPORT_MODULES_CMDS))))
+    $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
 CONF_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
     $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
 CLASSES_DIR := $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
@@ -103,7 +103,7 @@
             --os-arch $(OPENJDK_TARGET_CPU_LEGACY) \
             --os-version $(REQUIRED_OS_VERSION) \
             --module-path $(JMODS_DIR) \
-            --exclude '**{_the.*,*.diz,*.debuginfo,*.dSYM/**,*.pdb,*.map}' \
+            --exclude '**{_the.*,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \
 	    $(JMOD_FLAGS) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@)
 	$(MV) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@) $@
 
--- a/make/Help.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ b/make/Help.gmk	Wed Jul 05 22:18:27 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2016, 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
@@ -39,7 +39,8 @@
 	$(info $(_) make [default]         # Compile all modules in langtools, hotspot, jdk, jaxws,)
 	$(info $(_)                        # jaxp and corba, and create a runnable "exploded" image)
 	$(info $(_) make all               # Compile everything, all repos, docs and images)
-	$(info $(_) make images            # Create complete jdk and jre images)
+	$(info $(_) make images            # Create complete jdk and jre images (alias for product-images))
+	$(info $(_) make <name>-image      # Build just the image (jdk, jre, test, docs etc))
 	$(info $(_) make <phase>           # Build the specified phase and everything it depends on)
 	$(info $(_)                        # (gensrc, java, copy, libs, launchers, gendata, rmic))
 	$(info $(_) make *-only            # Applies to most targets and disables compling the)
--- a/make/Images.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ b/make/Images.gmk	Wed Jul 05 22:18:27 2017 +0200
@@ -382,14 +382,28 @@
 
 ################################################################################
 # /demo dir
-ifneq ($(findstring images, $(MAKECMDGOALS)), )
+# Avoid doing the expensive find unless called with "jdk" as target.
+ifneq ($(filter jdk, $(MAKECMDGOALS)), )
+
+  DEMO_FILES := \
+      $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
+        $(call DoubleDollar, $(call DoubleDollar, \
+        $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
+            -type f -a ! \( -name "_the*" -o -name "javac_state" \) ))) \
+      )
+
+  ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
+    ifeq ($(OPENJDK_TARGET_OS), macosx)
+      DEMO_FILES := $(call not-containing, .dSYM, $(DEMO_FILES))
+    else
+      DEMO_FILES := $(filter-out %.debuginfo %.pdb %.map, $(DEMO_FILES))
+    endif
+  endif
+
   $(eval $(call SetupCopyFiles, JDK_COPY_DEMOS, \
       SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \
       DEST := $(JDK_IMAGE_DIR)/demo, \
-      FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
-          $(call DoubleDollar, $(call DoubleDollar, \
-      $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
-          -type f -a ! \( -name "_the*" -o -name "javac_state" \) )))), \
+      FILES := $(DEMO_FILES), \
   ))
 
   JDK_TARGETS += $(JDK_COPY_DEMOS)
@@ -454,21 +468,25 @@
   LIBS_TARGET_SUBDIR := lib
 endif
 
-DEBUGINFO_SUFFIXES := .diz .debuginfo .pdb .map
-
 # Param 1 - dir to find debuginfo files in
 FindDebuginfoFiles = \
     $(wildcard $(addprefix $1/*, $(DEBUGINFO_SUFFIXES)) \
         $(addprefix $1/*/*, $(DEBUGINFO_SUFFIXES)) \
         $(addprefix $1/*/*/*, $(DEBUGINFO_SUFFIXES)))
 
-# On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM
-# dirs.
-ifeq ($(OPENJDK_TARGET_OS)-$(ZIP_EXTERNAL_DEBUG_SYMBOLS), macosx-false)
-  $(eval $(call FillCacheFind, \
-      $(SUPPORT_OUTPUTDIR)/modules_cmds $(SUPPORT_OUTPUTDIR)/modules_libs/))
-  FindDebuginfoFiles = \
-      $(if $(wildcard $1), $(call containing, .dSYM/, $(call CacheFind, $1)))
+# Pick the correct debug info files to copy, either zipped or not.
+ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
+  DEBUGINFO_SUFFIXES += .diz
+else
+  DEBUGINFO_SUFFIXES := .debuginfo .pdb .map
+  # On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM
+  # dirs.
+  ifeq ($(OPENJDK_TARGET_OS), macosx)
+    $(eval $(call FillCacheFind, \
+        $(SUPPORT_OUTPUTDIR)/modules_cmds $(SUPPORT_OUTPUTDIR)/modules_libs))
+    FindDebuginfoFiles = \
+        $(if $(wildcard $1), $(call containing, .dSYM/, $(call CacheFind, $1)))
+  endif
 endif
 
 # Param 1 - either JDK or JRE
@@ -499,8 +517,11 @@
 $(JRE_TARGETS): $(TOOL_JRE_TARGETS)
 $(JDK_TARGETS): $(TOOL_JDK_TARGETS)
 
-jimages: $(TOOL_JRE_TARGETS) $(TOOL_JDK_TARGETS) $(JRE_TARGETS) $(JDK_TARGETS) \
-    $(SYMBOLS_TARGETS)
+jdk: $(JDK_TARGETS)
+jre: $(JRE_TARGETS)
+symbols: $(SYMBOLS_TARGETS)
+
+all: jdk jre symbols
 
 $(JRE_COMPACT1_TARGETS): $(TOOL_JRE_COMPACT1_TARGETS)
 $(JRE_COMPACT2_TARGETS): $(TOOL_JRE_COMPACT2_TARGETS)
@@ -513,4 +534,4 @@
     $(JRE_COMPACT2_TARGETS) \
     $(JRE_COMPACT3_TARGETS)
 
-.PHONY: default all jimages profiles
+.PHONY: default all jdk jre symbols profiles
--- a/make/Javadoc.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ b/make/Javadoc.gmk	Wed Jul 05 22:18:27 2017 +0200
@@ -773,19 +773,17 @@
 # jvmtidocs
 #
 
-ALL_OTHER_TARGETS += jvmtidocs
-
-JVMTI_DOCDIR = $(PLATFORM_DOCSDIR)/jvmti
-JVMTI_HTML = $(HOTSPOT_DIST)/docs/platform/jvmti/jvmti.html
+JVMTI_DOCDIR := $(PLATFORM_DOCSDIR)/jvmti
+# Pick jvmti.html from any jvm variant, they are all the same.
+JVMTI_HTML := $(firstword \
+    $(wildcard $(HOTSPOT_OUTPUTDIR)/variant-*/gensrc/jvmtifiles/jvmti.html))
 
-jvmtidocs: $(JVMTI_DOCDIR)/jvmti.html
-$(JVMTI_DOCDIR)/jvmti.html:
-	@$(prep-javadoc)
-	@if [ -f $(JVMTI_HTML) ] ; then \
-	  $(CP) $(JVMTI_HTML) $@; \
-	else \
-	  $(ECHO) "WARNING: Generated file does not exist: $(JVMTI_HTML)"; \
-	fi
+$(eval $(call SetupCopyFiles, COPY_JVMTI_HTML, \
+    FILES := $(JVMTI_HTML), \
+    DEST := $(PLATFORM_DOCSDIR)/jvmti, \
+))
+
+jvmtidocs: $(COPY_JVMTI_HTML)
 
 #############################################################
 #
--- a/make/Main.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ b/make/Main.gmk	Wed Jul 05 22:18:27 2017 +0200
@@ -93,16 +93,13 @@
 ################################################################################
 # Special targets for certain modules
 
-import-hotspot:
-	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
-
 unpack-sec:
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
 
 generate-exported-symbols:
 	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk)
 
-ALL_TARGETS += import-hotspot unpack-sec generate-exported-symbols
+ALL_TARGETS += unpack-sec generate-exported-symbols
 
 ################################################################################
 # Gensrc targets, generating source before java compilation can be done
@@ -269,23 +266,6 @@
 ALL_TARGETS += generate-summary
 
 ################################################################################
-# Strip binaries targets
-
-STRIP_MODULES := $(sort $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES) \
-    $(GENDATA_MODULES))
-STRIP_TARGETS := $(addsuffix -strip, $(STRIP_MODULES))
-
-define DeclareStripRecipe
-  $1-strip:
-	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk \
-	    MODULE=$1)
-endef
-
-$(foreach m, $(STRIP_MODULES), $(eval $(call DeclareStripRecipe,$m)))
-
-ALL_TARGETS += $(STRIP_TARGETS)
-
-################################################################################
 # Jmod targets
 
 JMOD_MODULES := $(ALL_MODULES)
@@ -334,8 +314,14 @@
 jrtfs-jar:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
 
-jimages:
-	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
+jdk-image:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jdk)
+
+jre-image:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jre)
+
+symbols-image:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk symbols)
 
 profiles:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
@@ -347,7 +333,8 @@
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ExplodedImageOptimize.gmk)
 
 ALL_TARGETS += source-tips create-hgtip-files bootcycle-images zip-security \
-    zip-source jrtfs-jar jimages profiles mac-bundles-jdk \
+    zip-source jrtfs-jar jdk-image jre-image \
+    symbols-image profiles mac-bundles-jdk \
     exploded-image-optimize
 
 ################################################################################
@@ -386,7 +373,7 @@
 ALL_TARGETS += create-buildjdk-copy create-buildjdk-interim-image
 
 ################################################################################
-# The interim-image is a small jlinked image that is used to generate artifacts 
+# The interim-image is a small jlinked image that is used to generate artifacts
 # at build time for use when linking the real images.
 
 interim-image:
@@ -548,11 +535,9 @@
 
   hotspot-ide-project: hotspot exploded-image
 
-  import-hotspot: hotspot
-
   generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs
 
-  $(LIBS_TARGETS): import-hotspot
+  $(LIBS_TARGETS): hotspot
 
   $(LAUNCHER_TARGETS): java.base-libs
 
@@ -607,17 +592,8 @@
   # Explicitly add dependencies for special targets
   java.base-java: unpack-sec
 
-  # The copy target copies files generated by gensrc
-  java.base-copy-hotspot: java.base-gensrc-hotspot
-
   jdk.jdeps-gendata: java rmic
 
-  # Declare dependencies from <module>-strip to libs, launchers, gendata and copy
-  $(foreach m, $(LIBS_MODULES), $(eval $m-strip: $m-libs))
-  $(foreach m, $(LAUNCHER_MODULES), $(eval $m-strip: $m-launchers))
-  $(foreach m, $(GENDATA_MODULES), $(eval $m-strip: $m-gendata))
-  $(foreach m, $(COPY_MODULES), $(eval $m-strip: $m-copy))
-
   # Declare dependencies between jmod targets. Only java.base jmod needs access
   # to the other jmods to be built.
   # When creating a BUILDJDK, we don't need to add hashes to java.base, thus
@@ -628,7 +604,6 @@
   endif
 
   # Declare dependencies from <module>-jmod to all other module targets
-  $(foreach m, $(STRIP_MODULES), $(eval $m-jmod: $m-strip))
   # When creating a BUILDJDK, the java compilation has already been done by the
   # normal build and copied in.
   ifneq ($(CREATING_BUILDJDK), true)
@@ -640,23 +615,33 @@
   $(foreach m, $(LAUNCHER_MODULES), $(eval $m-jmod: $m-launchers))
   $(foreach m, $(COPY_MODULES), $(eval $m-jmod: $m-copy))
 
-  # Jmods cannot be created until we have the jlink tool ready to run, which requires
-  # all java modules to be compiled and jdk.jlink-launchers.
-  # And we also need to copy jvm.cfg (done in java.base-copy) and tzdb.dat (done in
-  # java.base-gendata) to the appropriate location otherwise jimage, jlink and jmod won't start.
-  $(JMOD_TARGETS): java.base-libs java.base-copy java.base-gendata jdk.jlink-launchers
-  # When creating a BUILDJDK, the java compilation has already been done by the
-  # normal build and copied in.
-  ifneq ($(CREATING_BUILDJDK), true)
-    $(JMOD_TARGETS): java
-  endif
-
+  # Jmods cannot be created until we have the jmod tool ready to run. During
+  # a normal build we run it from the exploded image, but when cross compiling
+  # it's run from the buildjdk, which is either created at build time or user
+  # supplied.
+  #
+  # For the exploded image to be runnable, all java modules and
+  # jdk.jlink-launchers need to be built. We also need to copy jvm.cfg (done
+  # in java.base-copy) and tzdb.dat (done in java.base-gendata) to the
+  # appropriate location otherwise jimage, jlink and jmod won't start. This
+  # also applies when creating the buildjdk.
+  DEFAULT_JMOD_DEPS := java.base-libs java.base-copy java.base-gendata \
+      jdk.jlink-launchers
+  # When cross compiling and buildjdk is to be created, depend on creating the
+  # buildjdk instead of the default dependencies.
   ifeq ($(CREATE_BUILDJDK), true)
-    # Avoid calling create-buildjdk from within a create-buildjdk call
+    # Avoid calling create-buildjdk from within a create-buildjdk call.
     ifneq ($(CREATING_BUILDJDK), true)
       $(JMOD_TARGETS): create-buildjdk
       buildtools-modules: create-buildjdk
+    else
+      # While actually creating the buildjdk, the default deps applies.
+      $(JMOD_TARGETS): $(DEFAULT_JMOD_DEPS)
     endif
+  else
+    # The normal non cross compilation case uses the default deps.
+    # To avoid races with the optimize target, that also needs to happen first.
+    $(JMOD_TARGETS): $(DEFAULT_JMOD_DEPS) exploded-image-optimize
   endif
 
   zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
@@ -678,18 +663,23 @@
     endif
     generate-classlist: buildtools-jdk
 
-    jimages: generate-classlist
+    jdk-image jre-image: generate-classlist
   endif
 
-  jimages: jmods zip-source source-tips demos samples jrtfs-jar
+  jdk-image: jmods zip-source source-tips demos samples jrtfs-jar
+  jre-image: jmods source-tips jrtfs-jar
 
   profiles: jmods zip-source source-tips jrtfs-jar
 
-  mac-bundles-jdk: jimages
+  mac-bundles-jdk: jdk-image jre-image
 
-  exploded-image-optimize: exploded-image-base buildtools-modules
+  # The optimize target can run as soon as the modules dir has been completely
+  # populated (java, copy and gendata targets) and the basic libs and launchers
+  # have been built.
+  exploded-image-optimize: java copy gendata java.base-libs java.base-launchers \
+      buildtools-modules
 
-  bootcycle-images: jimages
+  bootcycle-images: jdk-image
 
   docs-javadoc: $(GENSRC_TARGETS) rmic
 
@@ -697,7 +687,7 @@
 
   zip-docs: docs-javadoc docs-jvmtidoc
 
-  test: jimages test-image
+  test: jdk-image test-image
 
   create-buildjdk-copy: jdk.jlink-java java.base-gendata \
       $(addsuffix -java, $(INTERIM_IMAGE_MODULES))
@@ -716,7 +706,7 @@
 
   test-image-failure-handler: build-test-failure-handler
 
-  build-test-hotspot-jtreg-native: buildtools-jdk import-hotspot
+  build-test-hotspot-jtreg-native: buildtools-jdk hotspot
 
   build-test-jdk-jtreg-native: buildtools-jdk
 
@@ -728,7 +718,7 @@
 
   test-hotspot-internal: exploded-image
 
-  test-hotspot-jtreg: jimages test-image
+  test-hotspot-jtreg: jdk-image test-image
 
   test-hotspot-gtest: exploded-image test-image-hotspot-gtest
 
@@ -766,8 +756,6 @@
 
 jmods: $(JMOD_TARGETS)
 
-strip-binaries: $(STRIP_TARGETS)
-
 # Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
 # is actually handled by jdk.jdi-gensrc
 jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
@@ -787,7 +775,12 @@
 
 # The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
 exploded-image-base: $(ALL_MODULES)
-exploded-image: exploded-image-base exploded-image-optimize
+exploded-image: exploded-image-base
+# When cross compiling, no need to optimize the exploded image since it won't
+# be runnable on the host platform anyway.
+ifneq ($(COMPILE_TYPE), cross)
+  exploded-image: exploded-image-optimize
+endif
 
 create-buildjdk: create-buildjdk-copy create-buildjdk-interim-image
 
@@ -798,7 +791,11 @@
 
 # This target builds the product images, e.g. the JRE and JDK image
 # (and possibly other, more specific versions)
-product-images: jimages demos samples zip-security exploded-image
+product-images: jdk-image jre-image symbols-image exploded-image
+
+# zip-security is actually a bundle, but for now it needs to be considered
+# an image until this can be cleaned up properly.
+product-images: zip-security
 
 # The module summary cannot be run when:
 # * Cross compiling and building a partial BUILDJDK for the build host
--- a/make/MainSupport.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ b/make/MainSupport.gmk	Wed Jul 05 22:18:27 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, 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
@@ -88,9 +88,7 @@
 	@$(PRINTF) "\n" $(LOG_DEBUG)
 	$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
 	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
-	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1)
 	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
-	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1)
 	@$(PRINTF) " done\n"
 endef
 
--- a/make/ModuleWrapper.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ b/make/ModuleWrapper.gmk	Wed Jul 05 22:18:27 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2016, 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
@@ -45,44 +45,59 @@
 ifeq ($(OPENJDK_TARGET_OS), windows)
   TO_BIN_FILTER := %$(SHARED_LIBRARY_SUFFIX) %.diz %.pdb %.map
 
-  $(eval $(call SetupCopyFiles,COPY_LIBS_TO_BIN, \
+  $(eval $(call SetupCopyFiles, COPY_LIBS_TO_BIN, \
       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
       DEST := $(JDK_OUTPUTDIR)/bin, \
       FILES := $(filter $(TO_BIN_FILTER), \
           $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
-          $(TARGETS)))))
+          $(TARGETS))), \
+  ))
 
-  $(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
+  $(eval $(call SetupCopyFiles, COPY_LIBS_TO_LIB, \
       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
       DEST := $(JDK_OUTPUTDIR)/lib, \
       FILES := $(filter-out $(TO_BIN_FILTER), \
           $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
-          $(TARGETS)))))
+          $(TARGETS))), \
+  ))
 
 else
-  $(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
+  $(eval $(call SetupCopyFiles, COPY_LIBS_TO_LIB, \
       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
       DEST := $(JDK_OUTPUTDIR)/lib, \
-      FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
-          $(TARGETS))))
+      FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), \
+          $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+          $(TARGETS))), \
+  ))
+  $(eval $(call SetupCopyFiles, LINK_LIBS_TO_LIB, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
+      DEST := $(JDK_OUTPUTDIR)/lib, \
+      FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), \
+          $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+          $(TARGETS))), \
+      MACRO := link-file-relative, \
+  ))
 endif
 
-$(eval $(call SetupCopyFiles,COPY_INCLUDE, \
+$(eval $(call SetupCopyFiles, COPY_INCLUDE, \
     SRC := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE), \
     DEST := $(JDK_OUTPUTDIR)/include, \
     FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)/%, \
-          $(TARGETS))))
+        $(TARGETS)), \
+))
 
-$(eval $(call SetupCopyFiles,COPY_CMDS, \
+$(eval $(call SetupCopyFiles, COPY_CMDS, \
     SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
     DEST := $(JDK_OUTPUTDIR)/bin, \
-    FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/%, $(TARGETS))))
+    FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/%, $(TARGETS)), \
+))
 
-$(eval $(call SetupCopyFiles,COPY_CONF, \
+$(eval $(call SetupCopyFiles, COPY_CONF, \
     SRC := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE), \
     DEST := $(JDK_OUTPUTDIR)/conf, \
     FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE)/%, \
-          $(TARGETS))))
+        $(TARGETS)), \
+))
 
 all: $(TARGETS) $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \
-    $(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF)
+    $(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF) $(LINK_LIBS_TO_LIB)
--- a/make/StripBinaries.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-#
-# Copyright (c) 2014, 2016, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , StripBinaries.gmk))
-
-################################################################################
-# Copy native libraries and executables to a secondary location to strip them
-# and filter out files that shouldn't go into the image.
-
-MODULES_CMDS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
-MODULES_LIBS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
-
-ifneq ($(STRIP), )
-  define StripRecipe
-	$(call LogInfo, Stripping $(patsubst $(OUTPUT_ROOT)/%,%,$<))
-	$(call MakeDir, $(@D))
-	$(CP) $< $@.tmp
-	$(CHMOD) u+w $@.tmp
-	$(STRIP) $(STRIPFLAGS) $@.tmp
-	$(CHMOD) go-w $@.tmp
-	$(MV) $@.tmp $@
-  endef
-else
-  define StripRecipe
-    $(call install-file)
-  endef
-endif
-
-NO_STRIP_CMDS_FILTER += %.cgi
-
-# Don't include debug info for executables.
-ifneq ($(wildcard $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)), )
-  # OS X stores symbol information in a .dylib file inside a .dSYM directory -
-  # that file should not be stripped, so we prune the tree at the .dSYM directory.
-  ALL_CMDS_SRC := $(filter-out %.bc %.debuginfo %.diz %.map %.pdb, \
-      $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE) \( -type f -o -type l \) \
-      -print -o -name "*.dSYM" -prune))
-  COPY_CMDS_SRC := $(filter $(NO_STRIP_CMDS_FILTER), $(ALL_CMDS_SRC))
-  STRIP_CMDS_SRC := $(filter-out $(NO_STRIP_CMDS_FILTER), $(ALL_CMDS_SRC))
-endif
-
-ifneq ($(wildcard $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)), )
-  # OS X stores symbol information in a .dylib file inside a .dSYM directory -
-  # that file should not be stripped, so we prune the tree at the .dSYM directory.
-  # Example: support/modules_libs/java.base/libjsig.dylib.dSYM/Contents/Resources/DWARF/libjsig.dylib
-  STRIP_LIBS_SRC := \
-      $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE) \
-        -name '*$(SHARED_LIBRARY_SUFFIX)' -type f -print -o -name "*.dSYM" -prune)
-
-  # Make sure symbolic links are copied and not stripped.
-  COPY_LIBS_SRC := \
-      $(filter-out $(STRIP_LIBS_SRC), \
-      $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE) -type f -o -type l))
-endif
-
-$(eval $(call SetupCopyFiles,STRIP_MODULES_CMDS, \
-    SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
-    DEST := $(MODULES_CMDS_STRIPPED), \
-    FILES := $(STRIP_CMDS_SRC), \
-    MACRO := StripRecipe))
-
-$(eval $(call SetupCopyFiles,COPY_MODULES_CMDS, \
-    SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
-    DEST := $(MODULES_CMDS_STRIPPED), \
-    FILES := $(COPY_CMDS_SRC)))
-
-$(eval $(call SetupCopyFiles,STRIP_MODULES_LIBS, \
-    SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
-    DEST := $(MODULES_LIBS_STRIPPED), \
-    FILES := $(STRIP_LIBS_SRC), \
-    MACRO := StripRecipe))
-
-$(eval $(call SetupCopyFiles,COPY_MODULES_LIBS, \
-    SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
-    DEST := $(MODULES_LIBS_STRIPPED), \
-    FILES := $(COPY_LIBS_SRC)))
-
-TARGETS += $(STRIP_MODULES_CMDS) $(COPY_MODULES_CMDS) \
-    $(STRIP_MODULES_LIBS) $(COPY_MODULES_LIBS)
-
-all: $(TARGETS)
--- a/make/common/MakeBase.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ b/make/common/MakeBase.gmk	Wed Jul 05 22:18:27 2017 +0200
@@ -535,6 +535,67 @@
 endif
 
 ################################################################################
+# Take two paths and return the path of the last common directory.
+# Ex: /foo/bar/baz, /foo/bar/banan -> /foo/bar
+#     foo/bar/baz, /foo/bar -> <empty>
+#
+# The x prefix is used to preserve the presence of the initial slash
+#
+# $1 - Path to compare
+# $2 - Other path to compare
+FindCommonPathPrefix = \
+    $(patsubst x%,%,$(subst $(SPACE),/,$(strip \
+        $(call FindCommonPathPrefixHelper, \
+            $(subst /,$(SPACE),x$(strip $1)), $(subst /,$(SPACE),x$(strip $2))) \
+    )))
+
+FindCommonPathPrefixHelper = \
+    $(if $(call equals, $(firstword $1), $(firstword $2)), \
+      $(firstword $1) \
+      $(call FindCommonPathPrefixHelper, \
+          $(wordlist 2, $(words $1), $1), $(wordlist 2, $(words $2), $2) \
+      ) \
+    )
+
+# Convert a partial path into as many directory levels of ../, removing
+# leading and following /.
+# Ex: foo/bar/baz/ -> ../../..
+#     foo/bar -> ../..
+#     /foo -> ..
+DirToDotDot = \
+    $(subst $(SPACE),/,$(foreach d, $(subst /,$(SPACE),$1),..))
+
+# Computes the relative path from a directory to a file
+# $1 - File to compute the relative path to
+# $2 - Directory to compute the relative path from
+RelativePath = \
+    $(eval $1_prefix := $(call FindCommonPathPrefix, $1, $2)) \
+    $(eval $1_dotdots := $(call DirToDotDot, $(patsubst $($(strip $1)_prefix)/%, %, $2))) \
+    $(eval $1_suffix := $(patsubst $($(strip $1)_prefix)/%, %, $1)) \
+    $($(strip $1)_dotdots)/$($(strip $1)_suffix)
+
+################################################################################
+# link-file-* works similarly to install file but creates a symlink instead on
+# platforms that support it. There are two versions, either creating a relative
+# or an absolute link.
+ifeq ($(OPENJDK_BUILD_OS), windows)
+  link-file-absolute = $(install-file)
+  link-file-relative = $(install-file)
+else
+  define link-file-relative
+	$(call MakeDir, $(@D))
+	$(RM) $@
+	$(LN) -s $(call RelativePath, $<, $(@D)) $@
+  endef
+
+  define link-file-absolute
+	$(call MakeDir, $(@D))
+	$(RM) $@
+	$(LN) -s $< $@
+  endef
+endif
+
+################################################################################
 # Filter out duplicate sub strings while preserving order. Keeps the first occurance.
 uniq = \
     $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
--- a/make/common/NativeCompilation.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ b/make/common/NativeCompilation.gmk	Wed Jul 05 22:18:27 2017 +0200
@@ -346,6 +346,7 @@
 #   LIBS the libraries to link to
 #   ARFLAGS the archiver flags to be used
 #   OBJECT_DIR the directory where we store the object files
+#   OUTPUT_DIR the directory where the resulting binary is put
 #   LIBRARY the resulting library file
 #   PROGRAM the resulting exec file
 #   INCLUDES only pick source from these directories
@@ -829,67 +830,58 @@
     ifneq ($$($1_DEBUG_SYMBOLS), false)
       # Only copy debug symbols for dynamic libraries and programs.
       ifeq ($$($1_STATIC_LIBRARY), )
-        ifneq ($$($1_OUTPUT_DIR), $$($1_OBJECT_DIR))
-          # The dependency on TARGET is needed on windows for debuginfo files
-          # to be rebuilt properly.
-          $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/% $$($1_TARGET)
-                # Use cp -r since on macosx, the dSYM is a directory
-		$(CP) -r $$< $$@
-        endif
-
         # Generate debuginfo files.
         ifeq ($(OPENJDK_TARGET_OS), windows)
-          $1_EXTRA_LDFLAGS += -debug "-pdb:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb" \
-              "-map:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map"
-          $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
-              $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
+          $1_EXTRA_LDFLAGS += -debug "-pdb:$$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).pdb" \
+              "-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_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
+          $1_DEBUGINFO_FILES := $$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).debuginfo
           # Setup the command line creating debuginfo files, to be run after linking.
           # It cannot be run separately since it updates the original target file
           $1_CREATE_DEBUGINFO_CMDS := \
-            $$($1_OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
-            $(CD) $$($1_OUTPUT_DIR) && \
-                $$($1_OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
+              $$($1_OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
+              $(CD) $$($1_OUTPUT_DIR) && \
+                  $$($1_OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
 
         else ifeq ($(OPENJDK_TARGET_OS), macosx)
-          $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_BASENAME).dSYM
+          $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_DEBUGINFO_FILES) $$($1_TARGET) $$(NEWLINE) \
+              $(DSYMUTIL) --out $$($1_OUTPUT_DIR)/$$($1_BASENAME).dSYM $$($1_TARGET) $$(NEWLINE) \
               $(TOUCH) $$($1_TARGET)
         endif # OPENJDK_TARGET_OS
 
-        # This dependency dance ensures that debug info files get rebuilt
-        # properly if deleted.
-        $$($1_TARGET): $$($1_DEBUGINFO_FILES)
-        $$($1_DEBUGINFO_FILES): $$($1_ALL_OBJS)
+        $$($1_DEBUGINFO_FILES): $$($1_TARGET)
+
+        $1 += $$($1_DEBUGINFO_FILES)
 
         ifeq ($$($1_ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
-          $1_DEBUGINFO_ZIP := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).diz
-          $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_ZIP))
+          $1_DEBUGINFO_ZIP := $$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).diz
+          $1 += $$($1_DEBUGINFO_ZIP)
 
           # The dependency on TARGET is needed for debuginfo files
           # to be rebuilt properly.
           $$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET)
-		$(CD) $$($1_OBJECT_DIR) \
-		&& $(ZIP) -q -r $$@ $$(notdir $$($1_DEBUGINFO_FILES))
+		$(CD) $$($1_OUTPUT_DIR) && \
+		    $(ZIP) -q -r $$@ $$(subst $$($1_OUTPUT_DIR)/,, $$($1_DEBUGINFO_FILES))
 
-        else
-          $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_FILES))
         endif
-      endif # !STATIC_LIBRARY
+       endif # !STATIC_LIBRARY
     endif # $1_DEBUG_SYMBOLS != false
   endif # COPY_DEBUG_SYMBOLS
 
-  ifeq ($$($1_STRIP_SYMBOLS), true)
+  ifneq ($$($1_STRIP_SYMBOLS), false)
     ifneq ($$($1_STRIP), )
       # Default to using the global STRIPFLAGS. Allow for overriding with an empty value
       $1_STRIPFLAGS ?= $(STRIPFLAGS)
@@ -902,6 +894,8 @@
     $1_EXTRA_LDFLAGS += $$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
     ifeq ($(OPENJDK_TARGET_OS), windows)
       $1_EXTRA_LDFLAGS += "-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
+      # Create a rule for the import lib so that other rules may depend on it
+      $$($1_OBJECT_DIR)/$$($1_LIBRARY).lib: $$($1_TARGET)
     endif
 
     # Create loadmap on AIX. Helps in diagnosing some problems.
--- a/make/common/TestFilesCompilation.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ b/make/common/TestFilesCompilation.gmk	Wed Jul 05 22:18:27 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2016, 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
@@ -88,6 +88,8 @@
         LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$($1_PREFIX)$$(name)), \
         LIBS := $$($1_LIBS_$$($1_PREFIX)$$(name)), \
         OPTIMIZATION := LOW, \
+        COPY_DEBUG_SYMBOLS := false, \
+        STRIP_SYMBOLS := false, \
     )) \
     $$(eval $1 += $$(BUILD_TEST_$$(name)) )  \
   )
--- a/make/common/TextFileProcessing.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ b/make/common/TextFileProcessing.gmk	Wed Jul 05 22:18:27 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2014, 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
--- a/test/fmw/gtest/include/gtest/internal/gtest-port.h	Thu Oct 06 18:05:53 2016 -0700
+++ b/test/fmw/gtest/include/gtest/internal/gtest-port.h	Wed Jul 05 22:18:27 2017 +0200
@@ -1586,12 +1586,13 @@
 GTEST_API_ size_t GetThreadCount();
 
 // Passing non-POD classes through ellipsis (...) crashes the ARM
-// compiler and generates a warning in Sun Studio.  The Nokia Symbian
+// compiler and generates a warning in Sun Studio before 12u4. The Nokia Symbian
 // and the IBM XL C/C++ compiler try to instantiate a copy constructor
 // for objects passed through ellipsis (...), failing for uncopyable
 // objects.  We define this to ensure that only POD is passed through
 // ellipsis on these systems.
-#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
+#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || \
+     (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5130)
 // We lose support for NULL detection where the compiler doesn't like
 // passing non-POD classes through ellipsis (...).
 # define GTEST_ELLIPSIS_NEEDS_POD_ 1
--- a/test/lib/jdk/test/lib/Platform.java	Thu Oct 06 18:05:53 2016 -0700
+++ b/test/lib/jdk/test/lib/Platform.java	Wed Jul 05 22:18:27 2017 +0200
@@ -28,6 +28,9 @@
 public class Platform {
     public  static final String vmName      = System.getProperty("java.vm.name");
     public  static final String vmInfo      = System.getProperty("java.vm.info");
+    private static final String osVersion   = System.getProperty("os.version");
+    private static       int osVersionMajor = -1;
+    private static       int osVersionMinor = -1;
     private static final String osName      = System.getProperty("os.name");
     private static final String dataModel   = System.getProperty("sun.arch.data.model");
     private static final String vmVersion   = System.getProperty("java.vm.version");
@@ -112,6 +115,35 @@
         return osName;
     }
 
+    // Os version support.
+    private static void init_version() {
+        try {
+            final String[] tokens = osVersion.split("\\.");
+            if (tokens.length > 0) {
+                osVersionMajor = Integer.parseInt(tokens[0]);
+                if (tokens.length > 1) {
+                    osVersionMinor = Integer.parseInt(tokens[1]);
+                }
+            }
+        } catch (NumberFormatException e) {
+            osVersionMajor = osVersionMinor = 0;
+        }
+    }
+
+    // Returns major version number from os.version system property.
+    // E.g. 5 on Solaris 10 and 3 on SLES 11.3 (for the linux kernel version).
+    public static int getOsVersionMajor() {
+        if (osVersionMajor == -1) init_version();
+        return osVersionMajor;
+    }
+
+    // Returns minor version number from os.version system property.
+    // E.g. 10 on Solaris 10 and 0 on SLES 11.3 (for the linux kernel version).
+    public static int getOsVersionMinor() {
+        if (osVersionMinor == -1) init_version();
+        return osVersionMinor;
+    }
+
     public static boolean isDebugBuild() {
         return (jdkDebug.toLowerCase().contains("debug"));
     }
--- a/test/lib/jdk/test/lib/cli/predicate/AndPredicate.java	Thu Oct 06 18:05:53 2016 -0700
+++ b/test/lib/jdk/test/lib/cli/predicate/AndPredicate.java	Wed Jul 05 22:18:27 2017 +0200
@@ -28,14 +28,22 @@
 public class AndPredicate implements BooleanSupplier {
     private final BooleanSupplier a;
     private final BooleanSupplier b;
+    private final BooleanSupplier c;
 
     public AndPredicate(BooleanSupplier a, BooleanSupplier b) {
         this.a = a;
         this.b = b;
+        this.c = () -> true; // Boolean.TRUE::booleanValue
+    }
+
+    public AndPredicate(BooleanSupplier a, BooleanSupplier b, BooleanSupplier c) {
+        this.a = a;
+        this.b = b;
+        this.c = c;
     }
 
     @Override
     public boolean getAsBoolean() {
-        return a.getAsBoolean() && b.getAsBoolean();
+        return a.getAsBoolean() && b.getAsBoolean() && c.getAsBoolean();
     }
 }
--- a/test/make/TestMakeBase.gmk	Thu Oct 06 18:05:53 2016 -0700
+++ b/test/make/TestMakeBase.gmk	Wed Jul 05 22:18:27 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2016, 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
@@ -264,4 +264,81 @@
     $(call PathList, $(PATHLIST_INPUT)), \
     PathList call not safe for calling twice))
 
+################################################################################
+# Test FindCommonPathPrefix
+
+$(eval $(call assert-equals, \
+    $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/banan), \
+    /foo/bar, \
+    FindCommonPathPrefix, \
+))
+
+$(eval $(call assert-equals, \
+    $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar), \
+    /foo/bar, \
+    FindCommonPathPrefix, \
+))
+
+$(eval $(call assert-equals, \
+    $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/), \
+    /foo/bar, \
+    FindCommonPathPrefix, \
+))
+
+$(eval $(call assert-equals, \
+    $(call FindCommonPathPrefix, foo/bar/baz, foo/bar/banan), \
+    foo/bar, \
+    FindCommonPathPrefix, \
+))
+
+$(eval $(call assert-equals, \
+    $(call FindCommonPathPrefix, foo/bar/baz, /foo/bar/banan), \
+    , \
+    FindCommonPathPrefix, \
+))
+
+################################################################################
+# DirToDotDot
+
+$(eval $(call assert-equals, \
+    $(call DirToDotDot, foo/bar/baz/), \
+    ../../.., \
+    DirToDotDot, \
+))
+
+$(eval $(call assert-equals, \
+    $(call DirToDotDot, foo/bar), \
+    ../.., \
+    DirToDotDot, \
+))
+
+$(eval $(call assert-equals, \
+    $(call DirToDotDot, /foo), \
+    .., \
+    DirToDotDot, \
+))
+
+################################################################################
+# RelativePath
+
+$(eval $(call assert-equals, \
+    $(call RelativePath, foo/bar/baz, foo/bar/banan), \
+    ../baz, \
+    RelativePath, \
+))
+
+$(eval $(call assert-equals, \
+    $(call RelativePath, foo/bar/baz/banan/kung, foo/bar/banan/kung), \
+    ../../baz/banan/kung, \
+    RelativePath, \
+))
+
+$(eval $(call assert-equals, \
+    $(call RelativePath, /foo/bar/baz/banan/kung, /foo/bar/banan/kung/), \
+    ../../baz/banan/kung, \
+    RelativePath, \
+))
+
+################################################################################
+
 all: $(TEST_TARGETS)