Merge
authorduke
Wed, 05 Jul 2017 21:27:42 +0200
changeset 36509 2d47f4ba3ddf
parent 36508 5f9eee6b383b (current diff)
parent 36506 17612cee3530 (diff)
child 36512 1b1dea65af3e
Merge
make/CheckModules.gmk
make/GenerateModuleDeps.gmk
modules.xml
--- a/.hgtags-top-repo	Thu Mar 17 19:04:01 2016 +0000
+++ b/.hgtags-top-repo	Wed Jul 05 21:27:42 2017 +0200
@@ -352,3 +352,4 @@
 4d65eba233a8730f913734a6804910b842d2cb54 jdk-9+107
 c7be2a78c31b3b6132f2f5e9e4b3d3bb1c20245c jdk-9+108
 1787bdaabb2b6f4193406e25a50cb0419ea8e8f3 jdk-9+109
+925be13b3740d07a5958ccb5ab3c0ae1baba7055 jdk-9+110
--- a/common/autoconf/basics.m4	Thu Mar 17 19:04:01 2016 +0000
+++ b/common/autoconf/basics.m4	Wed Jul 05 21:27:42 2017 +0200
@@ -843,6 +843,8 @@
   AC_CONFIG_FILES([$OUTPUT_ROOT/hotspot-spec.gmk:$AUTOCONF_DIR/hotspot-spec.gmk.in])
   # The bootcycle-spec.gmk file contains support for boot cycle builds.
   AC_CONFIG_FILES([$OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in])
+  # The buildjdk-spec.gmk file contains support for building a buildjdk when cross compiling.
+  AC_CONFIG_FILES([$OUTPUT_ROOT/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in])
   # The compare.sh is used to compare the build output to other builds.
   AC_CONFIG_FILES([$OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in])
   # The generated Makefile knows where the spec.gmk is and where the source is.
--- a/common/autoconf/boot-jdk.m4	Thu Mar 17 19:04:01 2016 +0000
+++ b/common/autoconf/boot-jdk.m4	Wed Jul 05 21:27:42 2017 +0200
@@ -304,6 +304,18 @@
   # When compiling code to be executed by the Boot JDK, force jdk8 compatibility.
   BOOT_JDK_SOURCETARGET="-source 8 -target 8"
   AC_SUBST(BOOT_JDK_SOURCETARGET)
+
+  ADD_JVM_ARG_IF_OK([-Xpatch:], dummy, [$JAVA])
+  AC_MSG_CHECKING([if Boot JDK supports modules])
+  if test "x$JVM_ARG_OK" = "xtrue"; then
+    AC_MSG_RESULT([yes])
+    BOOT_JDK_MODULAR="true"
+  else
+    AC_MSG_RESULT([no])
+    BOOT_JDK_MODULAR="false"
+  fi
+  AC_SUBST(BOOT_JDK_MODULAR)
+
   AC_SUBST(JAVAC_FLAGS)
 
   # Check if the boot jdk is 32 or 64 bit
@@ -397,3 +409,100 @@
   done
   AC_SUBST(JAVA_TOOL_FLAGS_SMALL)
 ])
+
+# BUILD_JDK: the location of the latest JDK that can run
+#   on the host system and supports the target class file version
+#   generated in this JDK build.  This variable should only be
+#   used after the launchers are built.
+#
+
+# Execute the check given as argument, and verify the result.
+# If the JDK was previously found, do nothing.
+# $1 A command line (typically autoconf macro) to execute
+AC_DEFUN([BOOTJDK_CHECK_BUILD_JDK],
+[
+  if test "x$BUILD_JDK_FOUND" = xno; then
+    # Execute the test
+    $1
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BUILD_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BUILD_JDK/bin/java"; then
+        AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK did not contain bin/java; ignoring])
+        BUILD_JDK_FOUND=no
+      elif test ! -x "$BUILD_JDK/bin/jlink"; then
+        AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK did not contain bin/jlink; ignoring])
+        BUILD_JDK_FOUND=no
+      elif test ! -x "$BUILD_JDK/bin/javac"; then
+        # Do we have a bin/javac?
+        AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK did not contain bin/javac; ignoring])
+        AC_MSG_NOTICE([(This might be a JRE instead of an JDK)])
+        BUILD_JDK_FOUND=no
+      else
+        # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+        BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | head -n 1`
+
+        # Extra M4 quote needed to protect [] in grep expression.
+        [FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | grep  '\"1\.[9]\.'`]
+        if test "x$FOUND_CORRECT_VERSION" = x; then
+          AC_MSG_NOTICE([Potential Boot JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring])
+          AC_MSG_NOTICE([(Your Build JDK must be version 9)])
+          BUILD_JDK_FOUND=no
+        else
+          # We're done!
+          BUILD_JDK_FOUND=yes
+          BASIC_FIXUP_PATH(BUILD_JDK)
+          AC_MSG_CHECKING([for Build JDK])
+          AC_MSG_RESULT([$BUILD_JDK])
+          AC_MSG_CHECKING([Build JDK version])
+          BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+          AC_MSG_RESULT([$BUILD_JDK_VERSION])
+        fi # end check jdk version
+      fi # end check java
+    fi # end check build jdk found
+  fi
+])
+
+# By default the BUILD_JDK is the JDK_OUTPUTDIR.  If the target architecture
+# is different than the host system doing the build (e.g. cross-compilation),
+# a special BUILD_JDK is built as part of the build process.  An external
+# prebuilt BUILD_JDK can also be supplied.
+AC_DEFUN([BOOTJDK_SETUP_BUILD_JDK],
+[
+  AC_ARG_WITH(build-jdk, [AS_HELP_STRING([--with-build-jdk],
+      [path to JDK of same version as is being built@<:@the newly built JDK@:>@])])
+
+  CREATE_BUILDJDK_FOR_HOST=false
+  BUILD_JDK_FOUND="no"
+  if test "x$with_build_jdk" != "x"; then
+    BOOTJDK_CHECK_BUILD_JDK([
+       if test "x$with_build_jdk" != x; then
+         BUILD_JDK=$with_build_jdk
+         BUILD_JDK_FOUND=maybe
+         AC_MSG_NOTICE([Found potential Build JDK using configure arguments])
+       fi])
+  else
+    if test "x$COMPILE_TYPE" = "xcross"; then
+      BUILD_JDK="\$(BUILDJDK_OUTPUTDIR)/jdk"
+      BUILD_JDK_FOUND=yes
+      CREATE_BUILDJDK=true
+      AC_MSG_CHECKING([for Build JDK])
+      AC_MSG_RESULT([yes, will build it for the host platform])
+    else
+      BUILD_JDK="\$(JDK_OUTPUTDIR)"
+      BUILD_JDK_FOUND=yes
+      AC_MSG_CHECKING([for Build JDK])
+      AC_MSG_RESULT([yes, will use output dir])
+    fi
+  fi
+
+  if test "x$BUILD_JDK_FOUND" != "xyes"; then
+    AC_MSG_CHECKING([for Build JDK])
+    AC_MSG_RESULT([no])
+    AC_MSG_ERROR([Could not find a suitable Build JDK])
+  fi
+
+  AC_SUBST(CREATE_BUILDJDK)
+  AC_SUBST(BUILD_JDK)
+])
--- a/common/autoconf/bootcycle-spec.gmk.in	Thu Mar 17 19:04:01 2016 +0000
+++ b/common/autoconf/bootcycle-spec.gmk.in	Wed Jul 05 21:27:42 2017 +0200
@@ -25,6 +25,8 @@
 
 # Support for building boot cycle builds
 
+BOOT_JDK_MODULAR := true
+
 # First include the real base spec.gmk file
 include @SPEC@
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/autoconf/buildjdk-spec.gmk.in	Wed Jul 05 21:27:42 2017 +0200
@@ -0,0 +1,148 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+# This spec file is used to compile a BUILD_JDK while cross compiling. The
+# BUILD_JDK runs on the build/host platform and is of the same version as
+# the main build.
+
+# First include the real base spec.gmk file
+include @SPEC@
+
+CC := @BUILD_CC@
+CXX := @BUILD_CXX@
+LD := @BUILD_LD@
+AS := @BUILD_AS@
+NM := @BUILD_NM@
+AR := @BUILD_AR@
+OBJCOPY := @BUILD_OBJCOPY@
+STRIP := @BUILD_STRIP@
+SYSROOT_CFLAGS := @BUILD_SYSROOT_CFLAGS@
+SYSROOT_LDFLAGS := @BUILD_SYSROOT_LDFLAGS@
+
+# These directories should not be moved to BUILDJDK_OUTPUTDIR
+HOTSPOT_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(HOTSPOT_OUTPUTDIR))
+HOTSPOT_DIST := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(HOTSPOT_DIST))
+SUPPORT_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(SUPPORT_OUTPUTDIR))
+JDK_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(JDK_OUTPUTDIR))
+
+OPENJDK_BUILD_CPU_LEGACY := @OPENJDK_BUILD_CPU_LEGACY@
+OPENJDK_BUILD_CPU_LEGACY_LIB := @OPENJDK_BUILD_CPU_LEGACY_LIB@
+OPENJDK_BUILD_CPU_LIBDIR := @OPENJDK_BUILD_CPU_LIBDIR@
+OPENJDK_TARGET_CPU_LIBDIR := @OPENJDK_BUILD_CPU_LIBDIR@
+OPENJDK_TARGET_CPU := @OPENJDK_BUILD_CPU@
+OPENJDK_TARGET_CPU_ARCH := @OPENJDK_BUILD_CPU_ARCH@
+OPENJDK_TARGET_CPU_BITS := @OPENJDK_BUILD_CPU_BITS@
+OPENJDK_TARGET_CPU_ENDIAN := @OPENJDK_BUILD_CPU_ENDIAN@
+OPENJDK_TARGET_CPU_LEGACY := @OPENJDK_BUILD_CPU_LEGACY@
+
+CFLAGS_JDKLIB := @OPENJDK_BUILD_CFLAGS_JDKLIB@
+CXXFLAGS_JDKLIB := @OPENJDK_BUILD_CXXFLAGS_JDKLIB@
+LDFLAGS_JDKLIB := @OPENJDK_BUILD_LDFLAGS_JDKLIB@
+CFLAGS_JDKEXE := @OPENJDK_BUILD_CFLAGS_JDKEXE@
+CXXFLAGS_JDKEXE := @OPENJDK_BUILD_CXXFLAGS_JDKEXE@
+LDFLAGS_JDKEXE := @OPENJDK_BUILD_LDFLAGS_JDKEXE@
+OPENJDK_TARGET_CPU_JLI_CFLAGS := @OPENJDK_BUILD_CPU_JLI_CFLAGS@
+
+# The compiler for the build platform is likely not warning compatible with the official
+# compiler.
+WARNINGS_AS_ERRORS := false
+DISABLE_WARNING_PREFIX := @BUILD_CC_DISABLE_WARNING_PREFIX@
+
+# Save speed and disk space by not enabling debug symbols for the buildjdk
+ENABLE_DEBUG_SYMBOLS := false
+
+####################################################
+#
+# Legacy Hotspot support
+
+# Legacy setting: OPT or DBG
+VARIANT := OPT
+# Legacy setting: true or false
+FASTDEBUG := false
+# Legacy setting: debugging the class files?
+DEBUG_CLASSFILES := false
+
+# Some users still set EXTRA_*FLAGS on the make command line. Must
+# make sure to override that when building buildjdk.
+override EXTRA_CFLAGS :=
+override EXTRA_CXXFLAGS :=
+override EXTRA_LDFLAGS :=
+
+# The HOSTCC/HOSTCXX is Hotspot terminology for the BUILD_CC/BUILD_CXX, i.e. the
+# compiler that produces code that can be run on the build platform.
+HOSTCC := $(BUILD_CC)
+HOSTCXX := $(BUILD_CXX)
+
+# Old name for OPENJDK_TARGET_OS (aix,bsd,hpux,linux,macosx,solaris,windows etc)
+PLATFORM := $(OPENJDK_BUILD_OS)
+# 32 or 64 bit
+ARCH_DATA_MODEL := $(OPENJDK_BUILD_CPU_BITS)
+
+ALT_BOOTDIR := $(BOOT_JDK)
+# Yet another name for arch used for an extra subdir below the jvm lib.
+# Uses i386 and amd64, instead of x86 and x86_64.
+LIBARCH := @OPENJDK_BUILD_CPU_LEGACY_LIB@
+# Set the cpu architecture. Some users still set ARCH on the make command line. Must
+# make sure to override that when building buildjdk.
+override ARCH := $(OPENJDK_BUILD_CPU_ARCH)
+# Legacy setting for building for a 64 bit machine.
+# If yes then this expands to _LP64 := 1
+ifeq ($(OPENJDK_BUILD_CPU_BITS), 64)
+  _LP64 := 1
+endif
+
+ALT_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)
+ALT_EXPORT_PATH := $(HOTSPOT_DIST)
+
+JVM_INTERPRETER := @JVM_INTERPRETER@
+ifeq ($(JVM_INTERPRETER), cpp)
+  CC_INTERP=true
+endif
+
+HOTSPOT_MAKE_ARGS := product docs export_product
+# Control wether Hotspot runs Queens test after building
+TEST_IN_BUILD := false
+
+USE_PRECOMPILED_HEADER := @USE_PRECOMPILED_HEADER@
+
+# Hotspot expects the variable FULL_DEBUG_SYMBOLS=1/0 to control debug symbols
+# creation.
+FULL_DEBUG_SYMBOLS := 0
+ZIP_DEBUGINFO_FILES := 0
+# Disable stripping
+STRIP_POLICY := none
+
+JVM_VARIANTS := server
+JVM_VARIANT_SERVER := true
+JVM_VARIANT_CLIENT := false
+JVM_VARIANT_MINIMAL1 := false
+JVM_VARIANT_KERNEL := false
+JVM_VARIANT_ZERO := false
+JVM_VARIANT_ZEROSHARK := false
+JVM_VARIANT_CORE := false
+
+# Sneak this in via the spec.gmk file, since we don't want to mess around too much with the Hotspot make files.
+# This is needed to get the LOG setting to work properly.
+include $(SRC_ROOT)/make/common/MakeBase.gmk
--- a/common/autoconf/configure.ac	Thu Mar 17 19:04:01 2016 +0000
+++ b/common/autoconf/configure.ac	Wed Jul 05 21:27:42 2017 +0200
@@ -134,6 +134,7 @@
 
 # We need build & target for this.
 JDKOPT_SETUP_JDK_OPTIONS
+JDKOPT_SETUP_JLINK_OPTIONS
 HOTSPOT_SETUP_HOTSPOT_OPTIONS
 JDKVER_SETUP_JDK_VERSION_NUMBERS
 
@@ -144,6 +145,7 @@
 ###############################################################################
 
 BOOTJDK_SETUP_BOOT_JDK
+BOOTJDK_SETUP_BUILD_JDK
 
 ###############################################################################
 #
@@ -155,6 +157,8 @@
 SRCDIRS_SETUP_ALTERNATIVE_TOPDIRS
 SRCDIRS_SETUP_OUTPUT_DIRS
 
+SRCDIRS_SETUP_IMPORT_MODULES
+
 ###############################################################################
 #
 # Setup the toolchain (compilers etc), i.e. tools used to compile and process
--- a/common/autoconf/flags.m4	Thu Mar 17 19:04:01 2016 +0000
+++ b/common/autoconf/flags.m4	Wed Jul 05 21:27:42 2017 +0200
@@ -689,9 +689,6 @@
       ;;
   esac
 
-  # Setup LP64
-  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK $ADD_LP64"
-
   # Set some common defines. These works for all compilers, but assume
   # -D is universally accepted.
 
@@ -722,7 +719,12 @@
   COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D$OPENJDK_TARGET_OS_UPPERCASE"
 
   # Setup target CPU
-  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
+  OPENJDK_TARGET_CCXXFLAGS_JDK="$OPENJDK_TARGET_CCXXFLAGS_JDK \
+      $ADD_LP64 \
+      -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
+  OPENJDK_BUILD_CCXXFLAGS_JDK="$OPENJDK_BUILD_CCXXFLAGS_JDK \
+      $OPENJDK_BUILD_ADD_LP64 \
+      -DARCH='\"$OPENJDK_BUILD_CPU_LEGACY\"' -D$OPENJDK_BUILD_CPU_LEGACY"
 
   # Setup debug/release defines
   if test "x$DEBUG_LEVEL" = xrelease; then
@@ -766,17 +768,35 @@
       -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava"
 
   # The shared libraries are compiled using the picflag.
-  CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
-  CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
+  CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $OPENJDK_TARGET_CCXXFLAGS_JDK \
+      $CFLAGS_JDK $EXTRA_CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
+  CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $OPENJDK_TARGET_CCXXFLAGS_JDK \
+      $CXXFLAGS_JDK $EXTRA_CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
 
   # Executable flags
-  CFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
-  CXXFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK"
+  CFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $OPENJDK_TARGET_CCXXFLAGS_JDK \
+      $CFLAGS_JDK $EXTRA_CFLAGS_JDK"
+  CXXFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $OPENJDK_TARGET_CCXXFLAGS_JDK \
+      $CXXFLAGS_JDK $EXTRA_CXXFLAGS_JDK"
+
+  # The corresponding flags for building for the build platform. This is still an
+  # approximation, we only need something that runs on this machine when cross
+  # compiling the product.
+  OPENJDK_BUILD_CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $OPENJDK_BUILD_CCXXFLAGS_JDK \
+      $PICFLAG $CFLAGS_JDKLIB_EXTRA"
+  OPENJDK_BUILD_CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $OPENJDK_BUILD_CCXXFLAGS_JDK \
+      $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
+  OPENJDK_BUILD_CFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $OPENJDK_BUILD_CCXXFLAGS_JDK"
+  OPENJDK_BUILD_CXXFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $OPENJDK_BUILD_CCXXFLAGS_JDK"
 
   AC_SUBST(CFLAGS_JDKLIB)
   AC_SUBST(CFLAGS_JDKEXE)
   AC_SUBST(CXXFLAGS_JDKLIB)
   AC_SUBST(CXXFLAGS_JDKEXE)
+  AC_SUBST(OPENJDK_BUILD_CFLAGS_JDKLIB)
+  AC_SUBST(OPENJDK_BUILD_CFLAGS_JDKEXE)
+  AC_SUBST(OPENJDK_BUILD_CXXFLAGS_JDKLIB)
+  AC_SUBST(OPENJDK_BUILD_CXXFLAGS_JDKEXE)
 
   # Flags for compiling test libraries
   CFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
@@ -872,6 +892,9 @@
     LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Wl,--allow-shlib-undefined"
   fi
 
+  OPENJDK_BUILD_LDFLAGS_JDKEXE="${LDFLAGS_JDKEXE}"
+  LDFLAGS_JDKEXE="${LDFLAGS_JDKEXE} ${EXTRA_LDFLAGS_JDK}"
+
   # Customize LDFLAGS for libs
   LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
 
@@ -882,30 +905,39 @@
     JDKLIB_LIBS=""
   else
     LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} \
-        -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}"
+        -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)"
 
     # On some platforms (mac) the linker warns about non existing -L dirs.
     # Add server first if available. Linking aginst client does not always produce the same results.
     # Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
     # Default to server for other variants.
     if test "x$JVM_VARIANT_SERVER" = xtrue; then
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
     elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/client"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/client"
     elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/minimal"
     else
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
     fi
 
     JDKLIB_LIBS="-ljava -ljvm"
     if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
       JDKLIB_LIBS="$JDKLIB_LIBS -lc"
     fi
+
+    # When building a buildjdk, it's always only the server variant
+    OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} \
+        -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
   fi
 
+  OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} ${LDFLAGS_JDKLIB}"
+  LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${EXTRA_LDFLAGS_JDK}"
+
   AC_SUBST(LDFLAGS_JDKLIB)
   AC_SUBST(LDFLAGS_JDKEXE)
+  AC_SUBST(OPENJDK_BUILD_LDFLAGS_JDKLIB)
+  AC_SUBST(OPENJDK_BUILD_LDFLAGS_JDKEXE)
   AC_SUBST(JDKLIB_LIBS)
   AC_SUBST(JDKEXE_LIBS)
   AC_SUBST(LDFLAGS_CXX_JDK)
@@ -1075,5 +1107,6 @@
       ;;
   esac
   AC_SUBST(DISABLE_WARNING_PREFIX)
+  AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
   AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
 ])
--- a/common/autoconf/generated-configure.sh	Thu Mar 17 19:04:01 2016 +0000
+++ b/common/autoconf/generated-configure.sh	Wed Jul 05 21:27:42 2017 +0200
@@ -694,6 +694,7 @@
 COPY_DEBUG_SYMBOLS
 COMPILE_WITH_DEBUG_SYMBOLS
 CFLAGS_WARNINGS_ARE_ERRORS
+BUILD_CC_DISABLE_WARNING_PREFIX
 DISABLE_WARNING_PREFIX
 HOTSPOT_SET_WARNINGS_AS_ERRORS
 WARNINGS_AS_ERRORS
@@ -705,12 +706,18 @@
 LDFLAGS_CXX_JDK
 JDKEXE_LIBS
 JDKLIB_LIBS
+OPENJDK_BUILD_LDFLAGS_JDKEXE
+OPENJDK_BUILD_LDFLAGS_JDKLIB
 LDFLAGS_JDKEXE
 LDFLAGS_JDKLIB
 CXXFLAGS_TESTEXE
 CXXFLAGS_TESTLIB
 CFLAGS_TESTEXE
 CFLAGS_TESTLIB
+OPENJDK_BUILD_CXXFLAGS_JDKEXE
+OPENJDK_BUILD_CXXFLAGS_JDKLIB
+OPENJDK_BUILD_CFLAGS_JDKEXE
+OPENJDK_BUILD_CFLAGS_JDKLIB
 CXXFLAGS_JDKEXE
 CXXFLAGS_JDKLIB
 CFLAGS_JDKEXE
@@ -759,6 +766,8 @@
 BUILD_AS
 BUILD_LDCXX
 BUILD_LD
+BUILD_STRIP
+BUILD_OBJCOPY
 BUILD_AR
 BUILD_NM
 BUILD_CXX
@@ -821,6 +830,12 @@
 LIBRARY_PREFIX
 TOOLCHAIN_TYPE
 STATIC_BUILD
+IMPORT_MODULES_MAKE
+IMPORT_MODULES_SRC
+IMPORT_MODULES_CONF
+IMPORT_MODULES_LIBS
+IMPORT_MODULES_CMDS
+IMPORT_MODULES_CLASSES
 BUILD_HOTSPOT
 HOTSPOT_DIST
 BUILD_OUTPUT
@@ -831,8 +846,11 @@
 JAXP_TOPDIR
 CORBA_TOPDIR
 LANGTOOLS_TOPDIR
+BUILD_JDK
+CREATE_BUILDJDK
 BOOT_JDK_BITS
 JAVAC_FLAGS
+BOOT_JDK_MODULAR
 BOOT_JDK_SOURCETARGET
 JARSIGNER
 JAR
@@ -862,6 +880,7 @@
 PRODUCT_NAME
 LAUNCHER_NAME
 TEST_IN_BUILD
+JLINK_KEEP_PACKAGED_MODULES
 COPYRIGHT_YEAR
 COMPRESS_JARS
 INCLUDE_SA
@@ -930,9 +949,13 @@
 DEFINE_CROSS_COMPILE_ARCH
 LP64
 OPENJDK_TARGET_OS_EXPORT_DIR
+OPENJDK_BUILD_CPU_JLI_CFLAGS
 OPENJDK_TARGET_CPU_JLI_CFLAGS
 OPENJDK_TARGET_CPU_OSARCH
 OPENJDK_TARGET_CPU_ISADIR
+OPENJDK_BUILD_CPU_LIBDIR
+OPENJDK_BUILD_CPU_LEGACY_LIB
+OPENJDK_BUILD_CPU_LEGACY
 OPENJDK_TARGET_CPU_LIBDIR
 OPENJDK_TARGET_CPU_LEGACY_LIB
 OPENJDK_TARGET_CPU_LEGACY
@@ -1080,6 +1103,7 @@
 with_cacerts_file
 enable_unlimited_crypto
 with_copyright_year
+enable_keep_packaged_modules
 enable_hotspot_test_in_build
 with_milestone
 with_update_version
@@ -1094,6 +1118,7 @@
 with_version_security
 with_version_patch
 with_boot_jdk
+with_build_jdk
 with_add_source_root
 with_override_source_root
 with_adds_and_overrides
@@ -1105,6 +1130,7 @@
 with_override_nashorn
 with_override_jdk
 with_import_hotspot
+with_import_modules
 enable_static_build
 with_toolchain_type
 with_extra_cflags
@@ -1248,6 +1274,8 @@
 BUILD_CXX
 BUILD_NM
 BUILD_AR
+BUILD_OBJCOPY
+BUILD_STRIP
 JTREGEXE
 XMKMF
 FREETYPE_CFLAGS
@@ -1890,6 +1918,8 @@
                           support) [enabled]
   --enable-unlimited-crypto
                           Enable unlimited crypto policy [disabled]
+  --disable-keep-packaged-modules
+                          Do not keep packaged modules in jdk image [enable]
   --enable-hotspot-test-in-build
                           run the Queens test after Hotspot build [disabled]
   --enable-static-build   enable static library build [disabled]
@@ -1973,6 +2003,8 @@
   --with-version-patch    Set version 'PATCH' field (fourth number) [not
                           specified]
   --with-boot-jdk         path to Boot JDK (used to bootstrap build) [probed]
+  --with-build-jdk        path to JDK of same version as is being built[the
+                          newly built JDK]
   --with-add-source-root  Deprecated. Option is kept for backwards
                           compatibility and is ignored
   --with-override-source-root
@@ -1999,6 +2031,8 @@
   --with-import-hotspot   import hotspot binaries from this jdk image or
                           hotspot build dist dir instead of building from
                           source
+  --with-import-modules   import a set of prebuilt modules either as a zip
+                          file or an exploded directory
   --with-toolchain-type   the toolchain type (or family) to use, use '--help'
                           to show possible values [platform dependent]
   --with-extra-cflags     extra flags to be used when compiling jdk c-files
@@ -2167,6 +2201,9 @@
   BUILD_CXX   Override default value for BUILD_CXX
   BUILD_NM    Override default value for BUILD_NM
   BUILD_AR    Override default value for BUILD_AR
+  BUILD_OBJCOPY
+              Override default value for BUILD_OBJCOPY
+  BUILD_STRIP Override default value for BUILD_STRIP
   JTREGEXE    Override default value for JTREGEXE
   XMKMF       Path to xmkmf, Makefile generator for X Window System
   FREETYPE_CFLAGS
@@ -3777,6 +3814,23 @@
 
 
 
+# BUILD_JDK: the location of the latest JDK that can run
+#   on the host system and supports the target class file version
+#   generated in this JDK build.  This variable should only be
+#   used after the launchers are built.
+#
+
+# Execute the check given as argument, and verify the result.
+# If the JDK was previously found, do nothing.
+# $1 A command line (typically autoconf macro) to execute
+
+
+# By default the BUILD_JDK is the JDK_OUTPUTDIR.  If the target architecture
+# is different than the host system doing the build (e.g. cross-compilation),
+# a special BUILD_JDK is built as part of the build process.  An external
+# prebuilt BUILD_JDK can also be supplied.
+
+
 #
 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -4192,6 +4246,13 @@
 #
 
 
+################################################################################
+#
+# jlink options.
+# We always keep packaged modules in JDK image.
+#
+
+
 #
 # Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -4628,6 +4689,12 @@
 
 
 
+################################################################################
+# Define a mechanism for importing extra prebuilt modules
+#
+
+
+
 #
 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -4862,7 +4929,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1457684806
+DATE_WHEN_GENERATED=1458008154
 
 ###############################################################################
 #
@@ -15157,6 +15224,37 @@
   fi
 
 
+  # Now do the same for OPENJDK_BUILD_CPU...
+  # Also store the legacy naming of the cpu.
+  # Ie i586 and amd64 instead of x86 and x86_64
+  OPENJDK_BUILD_CPU_LEGACY="$OPENJDK_BUILD_CPU"
+  if test "x$OPENJDK_BUILD_CPU" = xx86; then
+    OPENJDK_BUILD_CPU_LEGACY="i586"
+  elif test "x$OPENJDK_BUILD_OS" != xmacosx && test "x$OPENJDK_BUILD_CPU" = xx86_64; then
+    # On all platforms except MacOSX replace x86_64 with amd64.
+    OPENJDK_BUILD_CPU_LEGACY="amd64"
+  fi
+
+
+  # And the second legacy naming of the cpu.
+  # Ie i386 and amd64 instead of x86 and x86_64.
+  OPENJDK_BUILD_CPU_LEGACY_LIB="$OPENJDK_BUILD_CPU"
+  if test "x$OPENJDK_BUILD_CPU" = xx86; then
+    OPENJDK_BUILD_CPU_LEGACY_LIB="i386"
+  elif test "x$OPENJDK_BUILD_CPU" = xx86_64; then
+    OPENJDK_BUILD_CPU_LEGACY_LIB="amd64"
+  fi
+
+
+  # This is the name of the cpu (but using i386 and amd64 instead of
+  # x86 and x86_64, respectively), preceeded by a /, to be used when
+  # locating libraries. On macosx, it's empty, though.
+  OPENJDK_BUILD_CPU_LIBDIR="/$OPENJDK_BUILD_CPU_LEGACY_LIB"
+  if test "x$OPENJDK_BUILD_OS" = xmacosx; then
+    OPENJDK_BUILD_CPU_LIBDIR=""
+  fi
+
+
   # OPENJDK_TARGET_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to
   # /amd64 or /sparcv9. This string is appended to some library paths, like this:
   # /usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libexample.so
@@ -15199,6 +15297,24 @@
   fi
 
 
+  OPENJDK_BUILD_CPU_JLI="$OPENJDK_BUILD_CPU"
+  if test "x$OPENJDK_BUILD_CPU" = xx86; then
+    OPENJDK_BUILD_CPU_JLI="i386"
+  elif test "x$OPENJDK_BUILD_OS" != xmacosx && test "x$OPENJDK_BUILD_CPU" = xx86_64; then
+    # On all platforms except macosx, we replace x86_64 with amd64.
+    OPENJDK_BUILD_CPU_JLI="amd64"
+  fi
+  # Now setup the -D flags for building libjli.
+  OPENJDK_BUILD_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_BUILD_CPU_JLI\"'"
+  if test "x$OPENJDK_BUILD_OS" = xsolaris; then
+    if test "x$OPENJDK_BUILD_CPU_ARCH" = xsparc; then
+      OPENJDK_BUILD_CPU_JLI_CFLAGS="$OPENJDK_BUILD_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"sparc\"' -DLIBARCH64NAME='\"sparcv9\"'"
+    elif test "x$OPENJDK_BUILD_CPU_ARCH" = xx86; then
+      OPENJDK_BUILD_CPU_JLI_CFLAGS="$OPENJDK_BUILD_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'"
+    fi
+  fi
+
+
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
       OPENJDK_TARGET_OS_EXPORT_DIR=macosx
   else
@@ -15216,6 +15332,11 @@
   fi
   LP64=$A_LP64
 
+  if test "x$OPENJDK_BUILD_CPU_BITS" = x64; then
+    if test "x$OPENJDK_BUILD_OS" = xlinux || test "x$OPENJDK_BUILD_OS" = xmacosx; then
+      OPENJDK_BUILD_ADD_LP64="-D_LP64=1"
+    fi
+  fi
 
   if test "x$COMPILE_TYPE" = "xcross"; then
     # FIXME: ... or should this include reduced builds..?
@@ -16701,6 +16822,9 @@
   # The bootcycle-spec.gmk file contains support for boot cycle builds.
   ac_config_files="$ac_config_files $OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in"
 
+  # The buildjdk-spec.gmk file contains support for building a buildjdk when cross compiling.
+  ac_config_files="$ac_config_files $OUTPUT_ROOT/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in"
+
   # The compare.sh is used to compare the build output to other builds.
   ac_config_files="$ac_config_files $OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in"
 
@@ -23299,6 +23423,35 @@
 
 
 
+  # Check whether --enable-keep-packaged-modules was given.
+if test "${enable_keep_packaged_modules+set}" = set; then :
+  enableval=$enable_keep_packaged_modules;
+fi
+
+
+  if test "x$enable_keep_packaged_modules" = "xyes"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if packaged modules are kept" >&5
+$as_echo_n "checking if packaged modules are kept... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    JLINK_KEEP_PACKAGED_MODULES=true
+  elif test "x$enable_keep_packaged_modules" = "xno"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if packaged modules are kept" >&5
+$as_echo_n "checking if packaged modules are kept... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    JLINK_KEEP_PACKAGED_MODULES=false
+  elif test "x$enable_keep_packaged_modules" = "x"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5
+$as_echo "yes (default)" >&6; }
+    JLINK_KEEP_PACKAGED_MODULES=true
+  else
+    as_fn_error $? "--enable-keep-packaged-modules accepts no argument" "$LINENO" 5
+  fi
+
+
+
+
   # Control wether Hotspot runs Queens test after build.
   # Check whether --enable-hotspot-test-in-build was given.
 if test "${enable_hotspot_test_in_build+set}" = set; then :
@@ -29596,6 +29749,35 @@
 
 
 
+  $ECHO "Check if jvm arg is ok: -Xpatch:" >&5
+  $ECHO "Command: $JAVA -Xpatch: -version" >&5
+  OUTPUT=`$JAVA -Xpatch: -version 2>&1`
+  FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
+  FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+  if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
+    dummy="$dummy -Xpatch:"
+    JVM_ARG_OK=true
+  else
+    $ECHO "Arg failed:" >&5
+    $ECHO "$OUTPUT" >&5
+    JVM_ARG_OK=false
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Boot JDK supports modules" >&5
+$as_echo_n "checking if Boot JDK supports modules... " >&6; }
+  if test "x$JVM_ARG_OK" = "xtrue"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    BOOT_JDK_MODULAR="true"
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    BOOT_JDK_MODULAR="false"
+  fi
+
+
+
+
   # Check if the boot jdk is 32 or 64 bit
   if "$JAVA" -d64 -version > /dev/null 2>&1; then
     BOOT_JDK_BITS="64"
@@ -29609,6 +29791,237 @@
 
 
 
+
+# Check whether --with-build-jdk was given.
+if test "${with_build_jdk+set}" = set; then :
+  withval=$with_build_jdk;
+fi
+
+
+  CREATE_BUILDJDK_FOR_HOST=false
+  BUILD_JDK_FOUND="no"
+  if test "x$with_build_jdk" != "x"; then
+
+  if test "x$BUILD_JDK_FOUND" = xno; then
+    # Execute the test
+
+       if test "x$with_build_jdk" != x; then
+         BUILD_JDK=$with_build_jdk
+         BUILD_JDK_FOUND=maybe
+         { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential Build JDK using configure arguments" >&5
+$as_echo "$as_me: Found potential Build JDK using configure arguments" >&6;}
+       fi
+
+    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
+    if test "x$BUILD_JDK_FOUND" = xmaybe; then
+      # Do we have a bin/java?
+      if test ! -x "$BUILD_JDK/bin/java"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Build JDK found at $BUILD_JDK did not contain bin/java; ignoring" >&5
+$as_echo "$as_me: Potential Build JDK found at $BUILD_JDK did not contain bin/java; ignoring" >&6;}
+        BUILD_JDK_FOUND=no
+      elif test ! -x "$BUILD_JDK/bin/jlink"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Build JDK found at $BUILD_JDK did not contain bin/jlink; ignoring" >&5
+$as_echo "$as_me: Potential Build JDK found at $BUILD_JDK did not contain bin/jlink; ignoring" >&6;}
+        BUILD_JDK_FOUND=no
+      elif test ! -x "$BUILD_JDK/bin/javac"; then
+        # Do we have a bin/javac?
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Build JDK found at $BUILD_JDK did not contain bin/javac; ignoring" >&5
+$as_echo "$as_me: Potential Build JDK found at $BUILD_JDK did not contain bin/javac; ignoring" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: (This might be a JRE instead of an JDK)" >&5
+$as_echo "$as_me: (This might be a JRE instead of an JDK)" >&6;}
+        BUILD_JDK_FOUND=no
+      else
+        # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+        BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | head -n 1`
+
+        # Extra M4 quote needed to protect [] in grep expression.
+        FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | grep  '\"1\.[9]\.'`
+        if test "x$FOUND_CORRECT_VERSION" = x; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Build JDK must be version 9)" >&5
+$as_echo "$as_me: (Your Build JDK must be version 9)" >&6;}
+          BUILD_JDK_FOUND=no
+        else
+          # We're done!
+          BUILD_JDK_FOUND=yes
+
+  # Only process if variable expands to non-empty
+
+  if test "x$BUILD_JDK" != x; then
+    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  path="$BUILD_JDK"
+  new_path=`$CYGPATH -u "$path"`
+
+  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+  # "foo.exe" is OK but "foo" is an error.
+  #
+  # This test is therefore slightly more accurate than "test -f" to check for file precense.
+  # It is also a way to make sure we got the proper file name for the real test later on.
+  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+  if test "x$test_shortpath" = x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_JDK, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of BUILD_JDK, which resolves as \"$path\", is invalid." >&6;}
+    as_fn_error $? "Cannot locate the the path of BUILD_JDK" "$LINENO" 5
+  fi
+
+  # Call helper function which possibly converts this using DOS-style short mode.
+  # If so, the updated path is stored in $new_path.
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+      # Going to short mode and back again did indeed matter. Since short mode is
+      # case insensitive, let's make it lowercase to improve readability.
+      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+      # Now convert it back to Unix-style (cygpath)
+      input_path=`$CYGPATH -u "$shortmode_path"`
+      new_path="$input_path"
+    fi
+  fi
+
+  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+  if test "x$test_cygdrive_prefix" = x; then
+    # As a simple fix, exclude /usr/bin since it's not a real path.
+    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+      # a path prefixed by /cygdrive for fixpath to work.
+      new_path="$CYGWIN_ROOT_PATH$input_path"
+    fi
+  fi
+
+
+  if test "x$path" != "x$new_path"; then
+    BUILD_JDK="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_JDK to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting BUILD_JDK to \"$new_path\"" >&6;}
+  fi
+
+    elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+  path="$BUILD_JDK"
+  has_colon=`$ECHO $path | $GREP ^.:`
+  new_path="$path"
+  if test "x$has_colon" = x; then
+    # Not in mixed or Windows style, start by that.
+    new_path=`cmd //c echo $path`
+  fi
+
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+  fi
+
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+  if test "x$path" != "x$new_path"; then
+    BUILD_JDK="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_JDK to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting BUILD_JDK to \"$new_path\"" >&6;}
+  fi
+
+  # Save the first 10 bytes of this path to the storage, so fixpath can work.
+  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+    else
+      # We're on a unix platform. Hooray! :)
+      path="$BUILD_JDK"
+      has_space=`$ECHO "$path" | $GREP " "`
+      if test "x$has_space" != x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_JDK, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of BUILD_JDK, which resolves as \"$path\", is invalid." >&6;}
+        as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+      fi
+
+      # Use eval to expand a potential ~
+      eval path="$path"
+      if test ! -f "$path" && test ! -d "$path"; then
+        as_fn_error $? "The path of BUILD_JDK, which resolves as \"$path\", is not found." "$LINENO" 5
+      fi
+
+      if test -d "$path"; then
+        BUILD_JDK="`cd "$path"; $THEPWDCMD -L`"
+      else
+        dir="`$DIRNAME "$path"`"
+        base="`$BASENAME "$path"`"
+        BUILD_JDK="`cd "$dir"; $THEPWDCMD -L`/$base"
+      fi
+    fi
+  fi
+
+          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Build JDK" >&5
+$as_echo_n "checking for Build JDK... " >&6; }
+          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_JDK" >&5
+$as_echo "$BUILD_JDK" >&6; }
+          { $as_echo "$as_me:${as_lineno-$LINENO}: checking Build JDK version" >&5
+$as_echo_n "checking Build JDK version... " >&6; }
+          BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_JDK_VERSION" >&5
+$as_echo "$BUILD_JDK_VERSION" >&6; }
+        fi # end check jdk version
+      fi # end check java
+    fi # end check build jdk found
+  fi
+
+  else
+    if test "x$COMPILE_TYPE" = "xcross"; then
+      BUILD_JDK="\$(BUILDJDK_OUTPUTDIR)/jdk"
+      BUILD_JDK_FOUND=yes
+      CREATE_BUILDJDK=true
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Build JDK" >&5
+$as_echo_n "checking for Build JDK... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, will build it for the host platform" >&5
+$as_echo "yes, will build it for the host platform" >&6; }
+    else
+      BUILD_JDK="\$(JDK_OUTPUTDIR)"
+      BUILD_JDK_FOUND=yes
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Build JDK" >&5
+$as_echo_n "checking for Build JDK... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, will use output dir" >&5
+$as_echo "yes, will use output dir" >&6; }
+    fi
+  fi
+
+  if test "x$BUILD_JDK_FOUND" != "xyes"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Build JDK" >&5
+$as_echo_n "checking for Build JDK... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    as_fn_error $? "Could not find a suitable Build JDK" "$LINENO" 5
+  fi
+
+
+
+
+
 ###############################################################################
 #
 # Configure the sources to use. We can add or override individual directories.
@@ -29758,6 +30171,189 @@
   JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
 
 
+
+
+# Check whether --with-import-modules was given.
+if test "${with_import_modules+set}" = set; then :
+  withval=$with_import_modules;
+fi
+
+
+  if test "x$with_import_modules" != x \
+      && test "x$with_import_modules" != "xno"; then
+    if test -d "$with_import_modules"; then
+      IMPORT_MODULES_TOPDIR="$with_import_modules"
+
+  # Only process if variable expands to non-empty
+
+  if test "x$IMPORT_MODULES_TOPDIR" != x; then
+    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  path="$IMPORT_MODULES_TOPDIR"
+  new_path=`$CYGPATH -u "$path"`
+
+  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+  # "foo.exe" is OK but "foo" is an error.
+  #
+  # This test is therefore slightly more accurate than "test -f" to check for file precense.
+  # It is also a way to make sure we got the proper file name for the real test later on.
+  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+  if test "x$test_shortpath" = x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of IMPORT_MODULES_TOPDIR, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of IMPORT_MODULES_TOPDIR, which resolves as \"$path\", is invalid." >&6;}
+    as_fn_error $? "Cannot locate the the path of IMPORT_MODULES_TOPDIR" "$LINENO" 5
+  fi
+
+  # Call helper function which possibly converts this using DOS-style short mode.
+  # If so, the updated path is stored in $new_path.
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+      # Going to short mode and back again did indeed matter. Since short mode is
+      # case insensitive, let's make it lowercase to improve readability.
+      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+      # Now convert it back to Unix-style (cygpath)
+      input_path=`$CYGPATH -u "$shortmode_path"`
+      new_path="$input_path"
+    fi
+  fi
+
+  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+  if test "x$test_cygdrive_prefix" = x; then
+    # As a simple fix, exclude /usr/bin since it's not a real path.
+    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+      # a path prefixed by /cygdrive for fixpath to work.
+      new_path="$CYGWIN_ROOT_PATH$input_path"
+    fi
+  fi
+
+
+  if test "x$path" != "x$new_path"; then
+    IMPORT_MODULES_TOPDIR="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting IMPORT_MODULES_TOPDIR to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting IMPORT_MODULES_TOPDIR to \"$new_path\"" >&6;}
+  fi
+
+    elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+  path="$IMPORT_MODULES_TOPDIR"
+  has_colon=`$ECHO $path | $GREP ^.:`
+  new_path="$path"
+  if test "x$has_colon" = x; then
+    # Not in mixed or Windows style, start by that.
+    new_path=`cmd //c echo $path`
+  fi
+
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+  fi
+
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+  if test "x$path" != "x$new_path"; then
+    IMPORT_MODULES_TOPDIR="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting IMPORT_MODULES_TOPDIR to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting IMPORT_MODULES_TOPDIR to \"$new_path\"" >&6;}
+  fi
+
+  # Save the first 10 bytes of this path to the storage, so fixpath can work.
+  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+    else
+      # We're on a unix platform. Hooray! :)
+      path="$IMPORT_MODULES_TOPDIR"
+      has_space=`$ECHO "$path" | $GREP " "`
+      if test "x$has_space" != x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: The path of IMPORT_MODULES_TOPDIR, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of IMPORT_MODULES_TOPDIR, which resolves as \"$path\", is invalid." >&6;}
+        as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+      fi
+
+      # Use eval to expand a potential ~
+      eval path="$path"
+      if test ! -f "$path" && test ! -d "$path"; then
+        as_fn_error $? "The path of IMPORT_MODULES_TOPDIR, which resolves as \"$path\", is not found." "$LINENO" 5
+      fi
+
+      if test -d "$path"; then
+        IMPORT_MODULES_TOPDIR="`cd "$path"; $THEPWDCMD -L`"
+      else
+        dir="`$DIRNAME "$path"`"
+        base="`$BASENAME "$path"`"
+        IMPORT_MODULES_TOPDIR="`cd "$dir"; $THEPWDCMD -L`/$base"
+      fi
+    fi
+  fi
+
+    elif test -e "$with_import_modules"; then
+      IMPORT_MODULES_TOPDIR="$CONFIGURESUPPORT_OUTPUTDIR/import-modules"
+      $RM -rf "$IMPORT_MODULES_TOPDIR"
+      $MKDIR -p "$IMPORT_MODULES_TOPDIR"
+      if ! $UNZIP -q "$with_import_modules" -d "$IMPORT_MODULES_TOPDIR"; then
+        as_fn_error $? "--with-import-modules=\"$with_import_modules\" must point to a dir or a zip file" "$LINENO" 5
+      fi
+    else
+      as_fn_error $? "--with-import-modules=\"$with_import_modules\" must point to a dir or a zip file" "$LINENO" 5
+    fi
+  fi
+
+  if test -d "$IMPORT_MODULES_TOPDIR/modules"; then
+    IMPORT_MODULES_CLASSES="$IMPORT_MODULES_TOPDIR/modules"
+  fi
+  if test -d "$IMPORT_MODULES_TOPDIR/modules_cmds"; then
+    IMPORT_MODULES_CMDS="$IMPORT_MODULES_TOPDIR/modules_cmds"
+  fi
+  if test -d "$IMPORT_MODULES_TOPDIR/modules_libs"; then
+    IMPORT_MODULES_LIBS="$IMPORT_MODULES_TOPDIR/modules_libs"
+  fi
+  if test -d "$IMPORT_MODULES_TOPDIR/modules_conf"; then
+    IMPORT_MODULES_CONF="$IMPORT_MODULES_TOPDIR/modules_conf"
+  fi
+  if test -d "$IMPORT_MODULES_TOPDIR/modules_src"; then
+    IMPORT_MODULES_SRC="$IMPORT_MODULES_TOPDIR/modules_src"
+  fi
+  if test -d "$IMPORT_MODULES_TOPDIR/make"; then
+    IMPORT_MODULES_MAKE="$IMPORT_MODULES_TOPDIR/make"
+  fi
+
+
+
+
+
+
+
+
+
 ###############################################################################
 #
 # Setup the toolchain (compilers etc), i.e. tools used to compile and process
@@ -44514,6 +45110,972 @@
     fi
   fi
 
+
+
+  # Publish this variable in the help.
+
+
+  if [ -z "${BUILD_OBJCOPY+x}" ]; then
+    # The variable is not set by user, try to locate tool using the code snippet
+    for ac_prog in objcopy
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BUILD_OBJCOPY+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BUILD_OBJCOPY in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BUILD_OBJCOPY="$BUILD_OBJCOPY" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BUILD_OBJCOPY="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+BUILD_OBJCOPY=$ac_cv_path_BUILD_OBJCOPY
+if test -n "$BUILD_OBJCOPY"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_OBJCOPY" >&5
+$as_echo "$BUILD_OBJCOPY" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$BUILD_OBJCOPY" && break
+done
+
+  else
+    # The variable is set, but is it from the command line or the environment?
+
+    # Try to remove the string !BUILD_OBJCOPY! from our list.
+    try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!BUILD_OBJCOPY!/}
+    if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
+      # If it failed, the variable was not from the command line. Ignore it,
+      # but warn the user (except for BASH, which is always set by the calling BASH).
+      if test "xBUILD_OBJCOPY" != xBASH; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of BUILD_OBJCOPY from the environment. Use command line variables instead." >&5
+$as_echo "$as_me: WARNING: Ignoring value of BUILD_OBJCOPY from the environment. Use command line variables instead." >&2;}
+      fi
+      # Try to locate tool using the code snippet
+      for ac_prog in objcopy
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BUILD_OBJCOPY+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BUILD_OBJCOPY in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BUILD_OBJCOPY="$BUILD_OBJCOPY" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BUILD_OBJCOPY="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+BUILD_OBJCOPY=$ac_cv_path_BUILD_OBJCOPY
+if test -n "$BUILD_OBJCOPY"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_OBJCOPY" >&5
+$as_echo "$BUILD_OBJCOPY" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$BUILD_OBJCOPY" && break
+done
+
+    else
+      # If it succeeded, then it was overridden by the user. We will use it
+      # for the tool.
+
+      # First remove it from the list of overridden variables, so we can test
+      # for unknown variables in the end.
+      CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
+
+      # Check if we try to supply an empty value
+      if test "x$BUILD_OBJCOPY" = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool BUILD_OBJCOPY= (no value)" >&5
+$as_echo "$as_me: Setting user supplied tool BUILD_OBJCOPY= (no value)" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BUILD_OBJCOPY" >&5
+$as_echo_n "checking for BUILD_OBJCOPY... " >&6; }
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
+$as_echo "disabled" >&6; }
+      else
+        # Check if the provided tool contains a complete path.
+        tool_specified="$BUILD_OBJCOPY"
+        tool_basename="${tool_specified##*/}"
+        if test "x$tool_basename" = "x$tool_specified"; then
+          # A command without a complete path is provided, search $PATH.
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool BUILD_OBJCOPY=$tool_basename" >&5
+$as_echo "$as_me: Will search for user supplied tool BUILD_OBJCOPY=$tool_basename" >&6;}
+          # Extract the first word of "$tool_basename", so it can be a program name with args.
+set dummy $tool_basename; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BUILD_OBJCOPY+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BUILD_OBJCOPY in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BUILD_OBJCOPY="$BUILD_OBJCOPY" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BUILD_OBJCOPY="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+BUILD_OBJCOPY=$ac_cv_path_BUILD_OBJCOPY
+if test -n "$BUILD_OBJCOPY"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_OBJCOPY" >&5
+$as_echo "$BUILD_OBJCOPY" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+          if test "x$BUILD_OBJCOPY" = x; then
+            as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
+          fi
+        else
+          # Otherwise we believe it is a complete path. Use it as it is.
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool BUILD_OBJCOPY=$tool_specified" >&5
+$as_echo "$as_me: Will use user supplied tool BUILD_OBJCOPY=$tool_specified" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BUILD_OBJCOPY" >&5
+$as_echo_n "checking for BUILD_OBJCOPY... " >&6; }
+          if test ! -x "$tool_specified"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+            as_fn_error $? "User supplied tool BUILD_OBJCOPY=$tool_specified does not exist or is not executable" "$LINENO" 5
+          fi
+          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
+$as_echo "$tool_specified" >&6; }
+        fi
+      fi
+    fi
+
+  fi
+
+
+
+  # Only process if variable expands to non-empty
+
+  if test "x$BUILD_OBJCOPY" != x; then
+    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+  # First separate the path from the arguments. This will split at the first
+  # space.
+  complete="$BUILD_OBJCOPY"
+  path="${complete%% *}"
+  tmp="$complete EOL"
+  arguments="${tmp#* }"
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  new_path=`$CYGPATH -u "$path"`
+
+  # Now try to locate executable using which
+  new_path=`$WHICH "$new_path" 2> /dev/null`
+  # bat and cmd files are not always considered executable in cygwin causing which
+  # to not find them
+  if test "x$new_path" = x \
+      && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+      && test "x`$LS \"$path\" 2>/dev/null`" != x; then
+    new_path=`$CYGPATH -u "$path"`
+  fi
+  if test "x$new_path" = x; then
+    # Oops. Which didn't find the executable.
+    # The splitting of arguments from the executable at a space might have been incorrect,
+    # since paths with space are more likely in Windows. Give it another try with the whole
+    # argument.
+    path="$complete"
+    arguments="EOL"
+    new_path=`$CYGPATH -u "$path"`
+    new_path=`$WHICH "$new_path" 2> /dev/null`
+    # bat and cmd files are not always considered executable in cygwin causing which
+    # to not find them
+    if test "x$new_path" = x \
+        && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+        && test "x`$LS \"$path\" 2>/dev/null`" != x; then
+      new_path=`$CYGPATH -u "$path"`
+    fi
+    if test "x$new_path" = x; then
+      # It's still not found. Now this is an unrecoverable error.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_OBJCOPY, which resolves as \"$complete\", is not found." >&5
+$as_echo "$as_me: The path of BUILD_OBJCOPY, which resolves as \"$complete\", is not found." >&6;}
+      has_space=`$ECHO "$complete" | $GREP " "`
+      if test "x$has_space" != x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: You might be mixing spaces in the path and extra arguments, which is not allowed." >&5
+$as_echo "$as_me: You might be mixing spaces in the path and extra arguments, which is not allowed." >&6;}
+      fi
+      as_fn_error $? "Cannot locate the the path of BUILD_OBJCOPY" "$LINENO" 5
+    fi
+  fi
+
+  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+  # "foo.exe" is OK but "foo" is an error.
+  #
+  # This test is therefore slightly more accurate than "test -f" to check for file presence.
+  # It is also a way to make sure we got the proper file name for the real test later on.
+  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+  if test "x$test_shortpath" = x; then
+    # Short path failed, file does not exist as specified.
+    # Try adding .exe or .cmd
+    if test -f "${new_path}.exe"; then
+      input_to_shortpath="${new_path}.exe"
+    elif test -f "${new_path}.cmd"; then
+      input_to_shortpath="${new_path}.cmd"
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_OBJCOPY, which resolves as \"$new_path\", is invalid." >&5
+$as_echo "$as_me: The path of BUILD_OBJCOPY, which resolves as \"$new_path\", is invalid." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" >&5
+$as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" >&6;}
+      as_fn_error $? "Cannot locate the the path of BUILD_OBJCOPY" "$LINENO" 5
+    fi
+  else
+    input_to_shortpath="$new_path"
+  fi
+
+  # Call helper function which possibly converts this using DOS-style short mode.
+  # If so, the updated path is stored in $new_path.
+  new_path="$input_to_shortpath"
+
+  input_path="$input_to_shortpath"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+      # Going to short mode and back again did indeed matter. Since short mode is
+      # case insensitive, let's make it lowercase to improve readability.
+      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+      # Now convert it back to Unix-style (cygpath)
+      input_path=`$CYGPATH -u "$shortmode_path"`
+      new_path="$input_path"
+    fi
+  fi
+
+  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+  if test "x$test_cygdrive_prefix" = x; then
+    # As a simple fix, exclude /usr/bin since it's not a real path.
+    if test "x`$ECHO $input_to_shortpath | $GREP ^/usr/bin/`" = x; then
+      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+      # a path prefixed by /cygdrive for fixpath to work.
+      new_path="$CYGWIN_ROOT_PATH$input_path"
+    fi
+  fi
+
+  # remove trailing .exe if any
+  new_path="${new_path/%.exe/}"
+
+    elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+  # First separate the path from the arguments. This will split at the first
+  # space.
+  complete="$BUILD_OBJCOPY"
+  path="${complete%% *}"
+  tmp="$complete EOL"
+  arguments="${tmp#* }"
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  new_path="$path"
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+
+  # Now try to locate executable using which
+  new_path=`$WHICH "$new_path" 2> /dev/null`
+
+  if test "x$new_path" = x; then
+    # Oops. Which didn't find the executable.
+    # The splitting of arguments from the executable at a space might have been incorrect,
+    # since paths with space are more likely in Windows. Give it another try with the whole
+    # argument.
+    path="$complete"
+    arguments="EOL"
+    new_path="$path"
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+
+    new_path=`$WHICH "$new_path" 2> /dev/null`
+    # bat and cmd files are not always considered executable in MSYS causing which
+    # to not find them
+    if test "x$new_path" = x \
+        && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+        && test "x`$LS \"$path\" 2>/dev/null`" != x; then
+      new_path="$path"
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+    fi
+
+    if test "x$new_path" = x; then
+      # It's still not found. Now this is an unrecoverable error.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_OBJCOPY, which resolves as \"$complete\", is not found." >&5
+$as_echo "$as_me: The path of BUILD_OBJCOPY, which resolves as \"$complete\", is not found." >&6;}
+      has_space=`$ECHO "$complete" | $GREP " "`
+      if test "x$has_space" != x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: You might be mixing spaces in the path and extra arguments, which is not allowed." >&5
+$as_echo "$as_me: You might be mixing spaces in the path and extra arguments, which is not allowed." >&6;}
+      fi
+      as_fn_error $? "Cannot locate the the path of BUILD_OBJCOPY" "$LINENO" 5
+    fi
+  fi
+
+  # Now new_path has a complete unix path to the binary
+  if test "x`$ECHO $new_path | $GREP ^/bin/`" != x; then
+    # Keep paths in /bin as-is, but remove trailing .exe if any
+    new_path="${new_path/%.exe/}"
+    # Do not save /bin paths to all_fixpath_prefixes!
+  else
+    # Not in mixed or Windows style, start by that.
+    new_path=`cmd //c echo $new_path`
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+  fi
+
+    # Output is in $new_path
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+    # remove trailing .exe if any
+    new_path="${new_path/%.exe/}"
+
+    # Save the first 10 bytes of this path to the storage, so fixpath can work.
+    all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+  fi
+
+    else
+      # We're on a unix platform. Hooray! :)
+      # First separate the path from the arguments. This will split at the first
+      # space.
+      complete="$BUILD_OBJCOPY"
+      path="${complete%% *}"
+      tmp="$complete EOL"
+      arguments="${tmp#* }"
+
+      # Cannot rely on the command "which" here since it doesn't always work.
+      is_absolute_path=`$ECHO "$path" | $GREP ^/`
+      if test -z "$is_absolute_path"; then
+        # Path to executable is not absolute. Find it.
+        IFS_save="$IFS"
+        IFS=:
+        for p in $PATH; do
+          if test -f "$p/$path" && test -x "$p/$path"; then
+            new_path="$p/$path"
+            break
+          fi
+        done
+        IFS="$IFS_save"
+      else
+        # This is an absolute path, we can use it without further modifications.
+        new_path="$path"
+      fi
+
+      if test "x$new_path" = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_OBJCOPY, which resolves as \"$complete\", is not found." >&5
+$as_echo "$as_me: The path of BUILD_OBJCOPY, which resolves as \"$complete\", is not found." >&6;}
+        has_space=`$ECHO "$complete" | $GREP " "`
+        if test "x$has_space" != x; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5
+$as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;}
+        fi
+        as_fn_error $? "Cannot locate the the path of BUILD_OBJCOPY" "$LINENO" 5
+      fi
+    fi
+
+    # Now join together the path and the arguments once again
+    if test "x$arguments" != xEOL; then
+      new_complete="$new_path ${arguments% *}"
+    else
+      new_complete="$new_path"
+    fi
+
+    if test "x$complete" != "x$new_complete"; then
+      BUILD_OBJCOPY="$new_complete"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_OBJCOPY to \"$new_complete\"" >&5
+$as_echo "$as_me: Rewriting BUILD_OBJCOPY to \"$new_complete\"" >&6;}
+    fi
+  fi
+
+
+
+  # Publish this variable in the help.
+
+
+  if [ -z "${BUILD_STRIP+x}" ]; then
+    # The variable is not set by user, try to locate tool using the code snippet
+    for ac_prog in strip
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BUILD_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BUILD_STRIP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BUILD_STRIP="$BUILD_STRIP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BUILD_STRIP="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+BUILD_STRIP=$ac_cv_path_BUILD_STRIP
+if test -n "$BUILD_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_STRIP" >&5
+$as_echo "$BUILD_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$BUILD_STRIP" && break
+done
+
+  else
+    # The variable is set, but is it from the command line or the environment?
+
+    # Try to remove the string !BUILD_STRIP! from our list.
+    try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!BUILD_STRIP!/}
+    if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
+      # If it failed, the variable was not from the command line. Ignore it,
+      # but warn the user (except for BASH, which is always set by the calling BASH).
+      if test "xBUILD_STRIP" != xBASH; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of BUILD_STRIP from the environment. Use command line variables instead." >&5
+$as_echo "$as_me: WARNING: Ignoring value of BUILD_STRIP from the environment. Use command line variables instead." >&2;}
+      fi
+      # Try to locate tool using the code snippet
+      for ac_prog in strip
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BUILD_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BUILD_STRIP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BUILD_STRIP="$BUILD_STRIP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BUILD_STRIP="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+BUILD_STRIP=$ac_cv_path_BUILD_STRIP
+if test -n "$BUILD_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_STRIP" >&5
+$as_echo "$BUILD_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$BUILD_STRIP" && break
+done
+
+    else
+      # If it succeeded, then it was overridden by the user. We will use it
+      # for the tool.
+
+      # First remove it from the list of overridden variables, so we can test
+      # for unknown variables in the end.
+      CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
+
+      # Check if we try to supply an empty value
+      if test "x$BUILD_STRIP" = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool BUILD_STRIP= (no value)" >&5
+$as_echo "$as_me: Setting user supplied tool BUILD_STRIP= (no value)" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BUILD_STRIP" >&5
+$as_echo_n "checking for BUILD_STRIP... " >&6; }
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
+$as_echo "disabled" >&6; }
+      else
+        # Check if the provided tool contains a complete path.
+        tool_specified="$BUILD_STRIP"
+        tool_basename="${tool_specified##*/}"
+        if test "x$tool_basename" = "x$tool_specified"; then
+          # A command without a complete path is provided, search $PATH.
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool BUILD_STRIP=$tool_basename" >&5
+$as_echo "$as_me: Will search for user supplied tool BUILD_STRIP=$tool_basename" >&6;}
+          # Extract the first word of "$tool_basename", so it can be a program name with args.
+set dummy $tool_basename; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BUILD_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BUILD_STRIP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BUILD_STRIP="$BUILD_STRIP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BUILD_STRIP="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+BUILD_STRIP=$ac_cv_path_BUILD_STRIP
+if test -n "$BUILD_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_STRIP" >&5
+$as_echo "$BUILD_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+          if test "x$BUILD_STRIP" = x; then
+            as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
+          fi
+        else
+          # Otherwise we believe it is a complete path. Use it as it is.
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool BUILD_STRIP=$tool_specified" >&5
+$as_echo "$as_me: Will use user supplied tool BUILD_STRIP=$tool_specified" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BUILD_STRIP" >&5
+$as_echo_n "checking for BUILD_STRIP... " >&6; }
+          if test ! -x "$tool_specified"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+            as_fn_error $? "User supplied tool BUILD_STRIP=$tool_specified does not exist or is not executable" "$LINENO" 5
+          fi
+          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
+$as_echo "$tool_specified" >&6; }
+        fi
+      fi
+    fi
+
+  fi
+
+
+
+  # Only process if variable expands to non-empty
+
+  if test "x$BUILD_STRIP" != x; then
+    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+  # First separate the path from the arguments. This will split at the first
+  # space.
+  complete="$BUILD_STRIP"
+  path="${complete%% *}"
+  tmp="$complete EOL"
+  arguments="${tmp#* }"
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  new_path=`$CYGPATH -u "$path"`
+
+  # Now try to locate executable using which
+  new_path=`$WHICH "$new_path" 2> /dev/null`
+  # bat and cmd files are not always considered executable in cygwin causing which
+  # to not find them
+  if test "x$new_path" = x \
+      && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+      && test "x`$LS \"$path\" 2>/dev/null`" != x; then
+    new_path=`$CYGPATH -u "$path"`
+  fi
+  if test "x$new_path" = x; then
+    # Oops. Which didn't find the executable.
+    # The splitting of arguments from the executable at a space might have been incorrect,
+    # since paths with space are more likely in Windows. Give it another try with the whole
+    # argument.
+    path="$complete"
+    arguments="EOL"
+    new_path=`$CYGPATH -u "$path"`
+    new_path=`$WHICH "$new_path" 2> /dev/null`
+    # bat and cmd files are not always considered executable in cygwin causing which
+    # to not find them
+    if test "x$new_path" = x \
+        && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+        && test "x`$LS \"$path\" 2>/dev/null`" != x; then
+      new_path=`$CYGPATH -u "$path"`
+    fi
+    if test "x$new_path" = x; then
+      # It's still not found. Now this is an unrecoverable error.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_STRIP, which resolves as \"$complete\", is not found." >&5
+$as_echo "$as_me: The path of BUILD_STRIP, which resolves as \"$complete\", is not found." >&6;}
+      has_space=`$ECHO "$complete" | $GREP " "`
+      if test "x$has_space" != x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: You might be mixing spaces in the path and extra arguments, which is not allowed." >&5
+$as_echo "$as_me: You might be mixing spaces in the path and extra arguments, which is not allowed." >&6;}
+      fi
+      as_fn_error $? "Cannot locate the the path of BUILD_STRIP" "$LINENO" 5
+    fi
+  fi
+
+  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+  # "foo.exe" is OK but "foo" is an error.
+  #
+  # This test is therefore slightly more accurate than "test -f" to check for file presence.
+  # It is also a way to make sure we got the proper file name for the real test later on.
+  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+  if test "x$test_shortpath" = x; then
+    # Short path failed, file does not exist as specified.
+    # Try adding .exe or .cmd
+    if test -f "${new_path}.exe"; then
+      input_to_shortpath="${new_path}.exe"
+    elif test -f "${new_path}.cmd"; then
+      input_to_shortpath="${new_path}.cmd"
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_STRIP, which resolves as \"$new_path\", is invalid." >&5
+$as_echo "$as_me: The path of BUILD_STRIP, which resolves as \"$new_path\", is invalid." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" >&5
+$as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" >&6;}
+      as_fn_error $? "Cannot locate the the path of BUILD_STRIP" "$LINENO" 5
+    fi
+  else
+    input_to_shortpath="$new_path"
+  fi
+
+  # Call helper function which possibly converts this using DOS-style short mode.
+  # If so, the updated path is stored in $new_path.
+  new_path="$input_to_shortpath"
+
+  input_path="$input_to_shortpath"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+      # Going to short mode and back again did indeed matter. Since short mode is
+      # case insensitive, let's make it lowercase to improve readability.
+      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+      # Now convert it back to Unix-style (cygpath)
+      input_path=`$CYGPATH -u "$shortmode_path"`
+      new_path="$input_path"
+    fi
+  fi
+
+  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+  if test "x$test_cygdrive_prefix" = x; then
+    # As a simple fix, exclude /usr/bin since it's not a real path.
+    if test "x`$ECHO $input_to_shortpath | $GREP ^/usr/bin/`" = x; then
+      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+      # a path prefixed by /cygdrive for fixpath to work.
+      new_path="$CYGWIN_ROOT_PATH$input_path"
+    fi
+  fi
+
+  # remove trailing .exe if any
+  new_path="${new_path/%.exe/}"
+
+    elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+  # First separate the path from the arguments. This will split at the first
+  # space.
+  complete="$BUILD_STRIP"
+  path="${complete%% *}"
+  tmp="$complete EOL"
+  arguments="${tmp#* }"
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  new_path="$path"
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+
+  # Now try to locate executable using which
+  new_path=`$WHICH "$new_path" 2> /dev/null`
+
+  if test "x$new_path" = x; then
+    # Oops. Which didn't find the executable.
+    # The splitting of arguments from the executable at a space might have been incorrect,
+    # since paths with space are more likely in Windows. Give it another try with the whole
+    # argument.
+    path="$complete"
+    arguments="EOL"
+    new_path="$path"
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+
+    new_path=`$WHICH "$new_path" 2> /dev/null`
+    # bat and cmd files are not always considered executable in MSYS causing which
+    # to not find them
+    if test "x$new_path" = x \
+        && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+        && test "x`$LS \"$path\" 2>/dev/null`" != x; then
+      new_path="$path"
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+    fi
+
+    if test "x$new_path" = x; then
+      # It's still not found. Now this is an unrecoverable error.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_STRIP, which resolves as \"$complete\", is not found." >&5
+$as_echo "$as_me: The path of BUILD_STRIP, which resolves as \"$complete\", is not found." >&6;}
+      has_space=`$ECHO "$complete" | $GREP " "`
+      if test "x$has_space" != x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: You might be mixing spaces in the path and extra arguments, which is not allowed." >&5
+$as_echo "$as_me: You might be mixing spaces in the path and extra arguments, which is not allowed." >&6;}
+      fi
+      as_fn_error $? "Cannot locate the the path of BUILD_STRIP" "$LINENO" 5
+    fi
+  fi
+
+  # Now new_path has a complete unix path to the binary
+  if test "x`$ECHO $new_path | $GREP ^/bin/`" != x; then
+    # Keep paths in /bin as-is, but remove trailing .exe if any
+    new_path="${new_path/%.exe/}"
+    # Do not save /bin paths to all_fixpath_prefixes!
+  else
+    # Not in mixed or Windows style, start by that.
+    new_path=`cmd //c echo $new_path`
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+  fi
+
+    # Output is in $new_path
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+    # remove trailing .exe if any
+    new_path="${new_path/%.exe/}"
+
+    # Save the first 10 bytes of this path to the storage, so fixpath can work.
+    all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+  fi
+
+    else
+      # We're on a unix platform. Hooray! :)
+      # First separate the path from the arguments. This will split at the first
+      # space.
+      complete="$BUILD_STRIP"
+      path="${complete%% *}"
+      tmp="$complete EOL"
+      arguments="${tmp#* }"
+
+      # Cannot rely on the command "which" here since it doesn't always work.
+      is_absolute_path=`$ECHO "$path" | $GREP ^/`
+      if test -z "$is_absolute_path"; then
+        # Path to executable is not absolute. Find it.
+        IFS_save="$IFS"
+        IFS=:
+        for p in $PATH; do
+          if test -f "$p/$path" && test -x "$p/$path"; then
+            new_path="$p/$path"
+            break
+          fi
+        done
+        IFS="$IFS_save"
+      else
+        # This is an absolute path, we can use it without further modifications.
+        new_path="$path"
+      fi
+
+      if test "x$new_path" = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: The path of BUILD_STRIP, which resolves as \"$complete\", is not found." >&5
+$as_echo "$as_me: The path of BUILD_STRIP, which resolves as \"$complete\", is not found." >&6;}
+        has_space=`$ECHO "$complete" | $GREP " "`
+        if test "x$has_space" != x; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5
+$as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;}
+        fi
+        as_fn_error $? "Cannot locate the the path of BUILD_STRIP" "$LINENO" 5
+      fi
+    fi
+
+    # Now join together the path and the arguments once again
+    if test "x$arguments" != xEOL; then
+      new_complete="$new_path ${arguments% *}"
+    else
+      new_complete="$new_path"
+    fi
+
+    if test "x$complete" != "x$new_complete"; then
+      BUILD_STRIP="$new_complete"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting BUILD_STRIP to \"$new_complete\"" >&5
+$as_echo "$as_me: Rewriting BUILD_STRIP to \"$new_complete\"" >&6;}
+    fi
+  fi
+
     # Assume the C compiler is the assembler
     BUILD_AS="$BUILD_CC -c"
     # Just like for the target compiler, use the compiler as linker
@@ -44530,6 +46092,8 @@
     BUILD_LDCXX="$LDCXX"
     BUILD_NM="$NM"
     BUILD_AS="$AS"
+    BUILD_OBJCOPY="$OBJCOPY"
+    BUILD_STRIP="$STRIP"
     BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
     BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
     BUILD_AR="$AR"
@@ -46684,9 +48248,6 @@
       ;;
   esac
 
-  # Setup LP64
-  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK $ADD_LP64"
-
   # Set some common defines. These works for all compilers, but assume
   # -D is universally accepted.
 
@@ -46717,7 +48278,12 @@
   COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D$OPENJDK_TARGET_OS_UPPERCASE"
 
   # Setup target CPU
-  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
+  OPENJDK_TARGET_CCXXFLAGS_JDK="$OPENJDK_TARGET_CCXXFLAGS_JDK \
+      $ADD_LP64 \
+      -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
+  OPENJDK_BUILD_CCXXFLAGS_JDK="$OPENJDK_BUILD_CCXXFLAGS_JDK \
+      $OPENJDK_BUILD_ADD_LP64 \
+      -DARCH='\"$OPENJDK_BUILD_CPU_LEGACY\"' -D$OPENJDK_BUILD_CPU_LEGACY"
 
   # Setup debug/release defines
   if test "x$DEBUG_LEVEL" = xrelease; then
@@ -46761,12 +48327,30 @@
       -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava"
 
   # The shared libraries are compiled using the picflag.
-  CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
-  CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
+  CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $OPENJDK_TARGET_CCXXFLAGS_JDK \
+      $CFLAGS_JDK $EXTRA_CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
+  CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $OPENJDK_TARGET_CCXXFLAGS_JDK \
+      $CXXFLAGS_JDK $EXTRA_CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
 
   # Executable flags
-  CFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
-  CXXFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK"
+  CFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $OPENJDK_TARGET_CCXXFLAGS_JDK \
+      $CFLAGS_JDK $EXTRA_CFLAGS_JDK"
+  CXXFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $OPENJDK_TARGET_CCXXFLAGS_JDK \
+      $CXXFLAGS_JDK $EXTRA_CXXFLAGS_JDK"
+
+  # The corresponding flags for building for the build platform. This is still an
+  # approximation, we only need something that runs on this machine when cross
+  # compiling the product.
+  OPENJDK_BUILD_CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $OPENJDK_BUILD_CCXXFLAGS_JDK \
+      $PICFLAG $CFLAGS_JDKLIB_EXTRA"
+  OPENJDK_BUILD_CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $OPENJDK_BUILD_CCXXFLAGS_JDK \
+      $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
+  OPENJDK_BUILD_CFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $OPENJDK_BUILD_CCXXFLAGS_JDK"
+  OPENJDK_BUILD_CXXFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $OPENJDK_BUILD_CCXXFLAGS_JDK"
+
+
+
+
 
 
 
@@ -46867,6 +48451,9 @@
     LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Wl,--allow-shlib-undefined"
   fi
 
+  OPENJDK_BUILD_LDFLAGS_JDKEXE="${LDFLAGS_JDKEXE}"
+  LDFLAGS_JDKEXE="${LDFLAGS_JDKEXE} ${EXTRA_LDFLAGS_JDK}"
+
   # Customize LDFLAGS for libs
   LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
 
@@ -46877,27 +48464,36 @@
     JDKLIB_LIBS=""
   else
     LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} \
-        -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}"
+        -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)"
 
     # On some platforms (mac) the linker warns about non existing -L dirs.
     # Add server first if available. Linking aginst client does not always produce the same results.
     # Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
     # Default to server for other variants.
     if test "x$JVM_VARIANT_SERVER" = xtrue; then
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
     elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/client"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/client"
     elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
-    else
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/minimal"
+    else
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
     fi
 
     JDKLIB_LIBS="-ljava -ljvm"
     if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
       JDKLIB_LIBS="$JDKLIB_LIBS -lc"
     fi
-  fi
+
+    # When building a buildjdk, it's always only the server variant
+    OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} \
+        -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
+  fi
+
+  OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} ${LDFLAGS_JDKLIB}"
+  LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${EXTRA_LDFLAGS_JDK}"
+
+
 
 
 
@@ -47503,6 +49099,7 @@
 
 
 
+
 # Setup debug symbols (need objcopy from the toolchain for that)
 
   #
@@ -61205,6 +62802,7 @@
     "$OUTPUT_ROOT/spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in" ;;
     "$OUTPUT_ROOT/hotspot-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/hotspot-spec.gmk:$AUTOCONF_DIR/hotspot-spec.gmk.in" ;;
     "$OUTPUT_ROOT/bootcycle-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in" ;;
+    "$OUTPUT_ROOT/buildjdk-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in" ;;
     "$OUTPUT_ROOT/compare.sh") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in" ;;
     "$OUTPUT_ROOT/Makefile") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in" ;;
 
--- a/common/autoconf/jdk-options.m4	Thu Mar 17 19:04:01 2016 +0000
+++ b/common/autoconf/jdk-options.m4	Wed Jul 05 21:27:42 2017 +0200
@@ -405,3 +405,31 @@
 
   AC_SUBST(STATIC_BUILD)
 ])
+
+################################################################################
+#
+# jlink options. 
+# We always keep packaged modules in JDK image.
+#
+AC_DEFUN_ONCE([JDKOPT_SETUP_JLINK_OPTIONS],
+[
+  AC_ARG_ENABLE([keep-packaged-modules], [AS_HELP_STRING([--disable-keep-packaged-modules],
+    [Do not keep packaged modules in jdk image @<:@enable@:>@])])
+
+  if test "x$enable_keep_packaged_modules" = "xyes"; then
+    AC_MSG_CHECKING([if packaged modules are kept])
+    AC_MSG_RESULT([yes])
+    JLINK_KEEP_PACKAGED_MODULES=true
+  elif test "x$enable_keep_packaged_modules" = "xno"; then
+    AC_MSG_CHECKING([if packaged modules are kept])
+    AC_MSG_RESULT([no])
+    JLINK_KEEP_PACKAGED_MODULES=false
+  elif test "x$enable_keep_packaged_modules" = "x"; then
+    AC_MSG_RESULT([yes (default)])
+    JLINK_KEEP_PACKAGED_MODULES=true
+  else
+    AC_MSG_ERROR([--enable-keep-packaged-modules accepts no argument])
+  fi
+
+  AC_SUBST(JLINK_KEEP_PACKAGED_MODULES)
+])
--- a/common/autoconf/platform.m4	Thu Mar 17 19:04:01 2016 +0000
+++ b/common/autoconf/platform.m4	Wed Jul 05 21:27:42 2017 +0200
@@ -304,6 +304,37 @@
   fi
   AC_SUBST(OPENJDK_TARGET_CPU_LIBDIR)
 
+  # Now do the same for OPENJDK_BUILD_CPU...
+  # Also store the legacy naming of the cpu.
+  # Ie i586 and amd64 instead of x86 and x86_64
+  OPENJDK_BUILD_CPU_LEGACY="$OPENJDK_BUILD_CPU"
+  if test "x$OPENJDK_BUILD_CPU" = xx86; then
+    OPENJDK_BUILD_CPU_LEGACY="i586"
+  elif test "x$OPENJDK_BUILD_OS" != xmacosx && test "x$OPENJDK_BUILD_CPU" = xx86_64; then
+    # On all platforms except MacOSX replace x86_64 with amd64.
+    OPENJDK_BUILD_CPU_LEGACY="amd64"
+  fi
+  AC_SUBST(OPENJDK_BUILD_CPU_LEGACY)
+
+  # And the second legacy naming of the cpu.
+  # Ie i386 and amd64 instead of x86 and x86_64.
+  OPENJDK_BUILD_CPU_LEGACY_LIB="$OPENJDK_BUILD_CPU"
+  if test "x$OPENJDK_BUILD_CPU" = xx86; then
+    OPENJDK_BUILD_CPU_LEGACY_LIB="i386"
+  elif test "x$OPENJDK_BUILD_CPU" = xx86_64; then
+    OPENJDK_BUILD_CPU_LEGACY_LIB="amd64"
+  fi
+  AC_SUBST(OPENJDK_BUILD_CPU_LEGACY_LIB)
+
+  # This is the name of the cpu (but using i386 and amd64 instead of
+  # x86 and x86_64, respectively), preceeded by a /, to be used when
+  # locating libraries. On macosx, it's empty, though.
+  OPENJDK_BUILD_CPU_LIBDIR="/$OPENJDK_BUILD_CPU_LEGACY_LIB"
+  if test "x$OPENJDK_BUILD_OS" = xmacosx; then
+    OPENJDK_BUILD_CPU_LIBDIR=""
+  fi
+  AC_SUBST(OPENJDK_BUILD_CPU_LIBDIR)
+
   # OPENJDK_TARGET_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to
   # /amd64 or /sparcv9. This string is appended to some library paths, like this:
   # /usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libexample.so
@@ -346,6 +377,24 @@
   fi
   AC_SUBST(OPENJDK_TARGET_CPU_JLI_CFLAGS)
 
+  OPENJDK_BUILD_CPU_JLI="$OPENJDK_BUILD_CPU"
+  if test "x$OPENJDK_BUILD_CPU" = xx86; then
+    OPENJDK_BUILD_CPU_JLI="i386"
+  elif test "x$OPENJDK_BUILD_OS" != xmacosx && test "x$OPENJDK_BUILD_CPU" = xx86_64; then
+    # On all platforms except macosx, we replace x86_64 with amd64.
+    OPENJDK_BUILD_CPU_JLI="amd64"
+  fi
+  # Now setup the -D flags for building libjli.
+  OPENJDK_BUILD_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_BUILD_CPU_JLI\"'"
+  if test "x$OPENJDK_BUILD_OS" = xsolaris; then
+    if test "x$OPENJDK_BUILD_CPU_ARCH" = xsparc; then
+      OPENJDK_BUILD_CPU_JLI_CFLAGS="$OPENJDK_BUILD_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"sparc\"' -DLIBARCH64NAME='\"sparcv9\"'"
+    elif test "x$OPENJDK_BUILD_CPU_ARCH" = xx86; then
+      OPENJDK_BUILD_CPU_JLI_CFLAGS="$OPENJDK_BUILD_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'"
+    fi
+  fi
+  AC_SUBST(OPENJDK_BUILD_CPU_JLI_CFLAGS)
+
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
       OPENJDK_TARGET_OS_EXPORT_DIR=macosx
   else
@@ -362,6 +411,11 @@
     fi
   fi
   AC_SUBST(LP64,$A_LP64)
+  if test "x$OPENJDK_BUILD_CPU_BITS" = x64; then
+    if test "x$OPENJDK_BUILD_OS" = xlinux || test "x$OPENJDK_BUILD_OS" = xmacosx; then
+      OPENJDK_BUILD_ADD_LP64="-D_LP64=1"
+    fi
+  fi
 
   if test "x$COMPILE_TYPE" = "xcross"; then
     # FIXME: ... or should this include reduced builds..?
--- a/common/autoconf/source-dirs.m4	Thu Mar 17 19:04:01 2016 +0000
+++ b/common/autoconf/source-dirs.m4	Wed Jul 05 21:27:42 2017 +0200
@@ -84,3 +84,56 @@
 
   JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
 ])
+
+################################################################################
+# Define a mechanism for importing extra prebuilt modules
+#
+
+AC_DEFUN_ONCE([SRCDIRS_SETUP_IMPORT_MODULES],
+[
+  AC_ARG_WITH(import-modules, [AS_HELP_STRING([--with-import-modules],
+      [import a set of prebuilt modules either as a zip file or an exploded directory])])
+
+  if test "x$with_import_modules" != x \
+      && test "x$with_import_modules" != "xno"; then
+    if test -d "$with_import_modules"; then
+      IMPORT_MODULES_TOPDIR="$with_import_modules"
+      BASIC_FIXUP_PATH([IMPORT_MODULES_TOPDIR])
+    elif test -e "$with_import_modules"; then
+      IMPORT_MODULES_TOPDIR="$CONFIGURESUPPORT_OUTPUTDIR/import-modules"
+      $RM -rf "$IMPORT_MODULES_TOPDIR"
+      $MKDIR -p "$IMPORT_MODULES_TOPDIR"
+      if ! $UNZIP -q "$with_import_modules" -d "$IMPORT_MODULES_TOPDIR"; then
+        AC_MSG_ERROR([--with-import-modules="$with_import_modules" must point to a dir or a zip file])
+      fi
+    else
+      AC_MSG_ERROR([--with-import-modules="$with_import_modules" must point to a dir or a zip file])
+    fi
+  fi
+
+  if test -d "$IMPORT_MODULES_TOPDIR/modules"; then
+    IMPORT_MODULES_CLASSES="$IMPORT_MODULES_TOPDIR/modules"
+  fi
+  if test -d "$IMPORT_MODULES_TOPDIR/modules_cmds"; then
+    IMPORT_MODULES_CMDS="$IMPORT_MODULES_TOPDIR/modules_cmds"
+  fi
+  if test -d "$IMPORT_MODULES_TOPDIR/modules_libs"; then
+    IMPORT_MODULES_LIBS="$IMPORT_MODULES_TOPDIR/modules_libs"
+  fi
+  if test -d "$IMPORT_MODULES_TOPDIR/modules_conf"; then
+    IMPORT_MODULES_CONF="$IMPORT_MODULES_TOPDIR/modules_conf"
+  fi
+  if test -d "$IMPORT_MODULES_TOPDIR/modules_src"; then
+    IMPORT_MODULES_SRC="$IMPORT_MODULES_TOPDIR/modules_src"
+  fi
+  if test -d "$IMPORT_MODULES_TOPDIR/make"; then
+    IMPORT_MODULES_MAKE="$IMPORT_MODULES_TOPDIR/make"
+  fi
+
+  AC_SUBST(IMPORT_MODULES_CLASSES)
+  AC_SUBST(IMPORT_MODULES_CMDS)
+  AC_SUBST(IMPORT_MODULES_LIBS)
+  AC_SUBST(IMPORT_MODULES_CONF)
+  AC_SUBST(IMPORT_MODULES_SRC)
+  AC_SUBST(IMPORT_MODULES_MAKE)
+])
--- a/common/autoconf/spec.gmk.in	Thu Mar 17 19:04:01 2016 +0000
+++ b/common/autoconf/spec.gmk.in	Wed Jul 05 21:27:42 2017 +0200
@@ -130,6 +130,14 @@
 JAXWS_TOPDIR:=@JAXWS_TOPDIR@
 HOTSPOT_TOPDIR:=@HOTSPOT_TOPDIR@
 NASHORN_TOPDIR:=@NASHORN_TOPDIR@
+
+IMPORT_MODULES_CLASSES:=@IMPORT_MODULES_CLASSES@
+IMPORT_MODULES_CMDS:=@IMPORT_MODULES_CMDS@
+IMPORT_MODULES_LIBS:=@IMPORT_MODULES_LIBS@
+IMPORT_MODULES_CONF:=@IMPORT_MODULES_CONF@
+IMPORT_MODULES_SRC:=@IMPORT_MODULES_SRC@
+IMPORT_MODULES_MAKE:=@IMPORT_MODULES_MAKE@
+
 COPYRIGHT_YEAR:=@COPYRIGHT_YEAR@
 
 # New (JEP-223) version information
@@ -246,6 +254,7 @@
 MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
 # This does not get overridden in a bootcycle build
 CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@
+BUILDJDK_OUTPUTDIR=$(BUILD_OUTPUT)/buildjdk
 
 HOTSPOT_DIST=@HOTSPOT_DIST@
 
@@ -255,6 +264,9 @@
 # it in sync.
 BOOT_JDK:=@BOOT_JDK@
 
+BUILD_JDK:=@BUILD_JDK@
+CREATE_BUILDJDK:=@CREATE_BUILDJDK@
+
 # When compiling Java source to be run by the boot jdk
 # use these extra flags, eg -source 6 -target 6
 BOOT_JDK_SOURCETARGET:=@BOOT_JDK_SOURCETARGET@
@@ -405,6 +417,8 @@
 BUILD_AS:=@FIXPATH@ @BUILD_AS@
 BUILD_AR:=@FIXPATH@ @BUILD_AR@
 BUILD_NM:=@FIXPATH@ @BUILD_NM@
+BUILD_OBJCOPY:=@BUILD_OBJCOPY@
+BUILD_STRIP:=@BUILD_STRIP@
 BUILD_SYSROOT_CFLAGS:=@BUILD_SYSROOT_CFLAGS@
 BUILD_SYSROOT_LDFLAGS:=@BUILD_SYSROOT_LDFLAGS@
 
@@ -502,12 +516,40 @@
 # overriding that value by using ?=.
 JAVAC_FLAGS?=@JAVAC_FLAGS@
 
+
+BUILD_JAVA_FLAGS:=-Xms64M -Xmx1100M
+BUILD_JAVA=@FIXPATH@ $(BUILD_JDK)/bin/java $(BUILD_JAVA_FLAGS)
+
+# Use ?= as this can be overridden from bootcycle-spec.gmk
+BOOT_JDK_MODULAR ?= @BOOT_JDK_MODULAR@
+
+ifeq ($(BOOT_JDK_MODULAR), true)
+  INTERIM_OVERRIDE_MODULES_ARGS = -Xpatch:$(BUILDTOOLS_OUTPUTDIR)/override_modules
+  INTERIM_LANGTOOLS_ARGS = $(INTERIM_OVERRIDE_MODULES_ARGS)
+  JAVAC_MAIN_CLASS = -m jdk.compiler/com.sun.tools.javac.Main
+  JAVADOC_MAIN_CLASS = -m jdk.javadoc/jdk.javadoc.internal.tool.Main
+else
+  INTERIM_OVERRIDE_MODULES := java.compiler jdk.compiler \
+      jdk.jdeps jdk.javadoc jdk.rmic
+  INTERIM_OVERRIDE_MODULES_ARGS = \
+      -Xbootclasspath/p:$(call PathList, \
+          $(addprefix $(BUILDTOOLS_OUTPUTDIR)/override_modules/, \
+              $(INTERIM_OVERRIDE_MODULES)))
+  INTERIM_LANGTOOLS_ARGS = $(INTERIM_OVERRIDE_MODULES_ARGS) \
+      -cp $(BUILDTOOLS_OUTPUTDIR)/override_modules/jdk.compiler
+  JAVAC_MAIN_CLASS = com.sun.tools.javac.Main
+  JAVADOC_MAIN_CLASS = jdk.javadoc.internal.tool.Main
+endif
 # You run the new javac using the boot jdk with $(BOOT_JDK)/bin/java $(NEW_JAVAC) ...
 # Use = assignment to be able to override in bootcycle-spec.gmk
-INTERIM_LANGTOOLS_JAR = $(BUILDTOOLS_OUTPUTDIR)/interim_langtools.jar
-INTERIM_LANGTOOLS_ARGS = "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
-NEW_JAVAC   = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javac.Main
-NEW_JAVADOC = $(INTERIM_LANGTOOLS_ARGS) jdk.javadoc.internal.tool.Main
+NEW_JAVAC   = $(INTERIM_LANGTOOLS_ARGS) $(JAVAC_MAIN_CLASS)
+NEW_JAVADOC = $(INTERIM_LANGTOOLS_ARGS) $(JAVADOC_MAIN_CLASS)
+
+# JLink/Jmod are run using the BUILD_JDK, which is normally the jdk output dir.
+JLINK_KEEP_PACKAGED_MODULES:=@JLINK_KEEP_PACKAGED_MODULES@
+
+JLINK = @FIXPATH@ $(BUILD_JDK)/bin/jlink $(JAVA_TOOL_FLAGS_SMALL)
+JMOD = @FIXPATH@ $(BUILD_JDK)/bin/jmod $(JAVA_TOOL_FLAGS_SMALL)
 
 # Base flags for RC
 # Guarding this against resetting value. Legacy make files include spec multiple
--- a/common/autoconf/toolchain.m4	Thu Mar 17 19:04:01 2016 +0000
+++ b/common/autoconf/toolchain.m4	Wed Jul 05 21:27:42 2017 +0200
@@ -797,6 +797,10 @@
     BASIC_FIXUP_EXECUTABLE(BUILD_NM)
     BASIC_PATH_PROGS(BUILD_AR, ar gcc-ar)
     BASIC_FIXUP_EXECUTABLE(BUILD_AR)
+    BASIC_PATH_PROGS(BUILD_OBJCOPY, objcopy)
+    BASIC_FIXUP_EXECUTABLE(BUILD_OBJCOPY)
+    BASIC_PATH_PROGS(BUILD_STRIP, strip)
+    BASIC_FIXUP_EXECUTABLE(BUILD_STRIP)
     # Assume the C compiler is the assembler
     BUILD_AS="$BUILD_CC -c"
     # Just like for the target compiler, use the compiler as linker
@@ -813,6 +817,8 @@
     BUILD_LDCXX="$LDCXX"
     BUILD_NM="$NM"
     BUILD_AS="$AS"
+    BUILD_OBJCOPY="$OBJCOPY"
+    BUILD_STRIP="$STRIP"
     BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
     BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
     BUILD_AR="$AR"
--- a/common/bin/compare.sh	Thu Mar 17 19:04:01 2016 +0000
+++ b/common/bin/compare.sh	Wed Jul 05 21:27:42 2017 +0200
@@ -290,9 +290,9 @@
 
     GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" \
         ! -name "*.zip" ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
-        ! -name "*.jimage" ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
+        ! -name "modules" ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
         ! -name "*.cpl" ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
-        ! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \
+        ! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" ! -name "*.jmod" \
         ! -name "*.obj" ! -name "*.o" ! -name "JavaControlPanelHelper" \
         ! -name "JavaUpdater" ! -name "JavaWSApplicationStub" \
         ! -name "jspawnhelper" ! -name "JavawsLauncher" ! -name "*.a" \
@@ -389,13 +389,13 @@
     $RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR
     $MKDIR -p $THIS_UNZIPDIR
     $MKDIR -p $OTHER_UNZIPDIR
-    if [ "$TYPE" = "jimage" ]
+    if [ "$TYPE" = "jar" || "$TYPE" = "war" || "$TYPE" = "zip" || "$TYPE" = "jmod"]
     then
+        (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
+        (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
+    else
         (cd $THIS_UNZIPDIR && $JIMAGE extract $THIS_ZIP)
         (cd $OTHER_UNZIPDIR && $JIMAGE extract $OTHER_ZIP)
-    else
-        (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
-        (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
     fi
 
     # Find all archives inside and unzip them as well to compare the contents rather than
@@ -526,7 +526,7 @@
 
     # TODO filter?
     ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" \
-        -o -name "*.jimage" | $SORT | $FILTER)
+        -o -name "modules" -o -name "*.jmod" | $SORT | $FILTER)
 
     if [ -n "$ZIPS" ]; then
         echo Jar files...
--- a/common/conf/jib-profiles.js	Thu Mar 17 19:04:01 2016 +0000
+++ b/common/conf/jib-profiles.js	Wed Jul 05 21:27:42 2017 +0200
@@ -421,10 +421,10 @@
 
         jtreg: {
             server: "javare",
-            revision: "4.1",
-            build_number: "b12",
+            revision: "4.2",
+            build_number: "b01",
             checksum_file: "MD5_VALUES",
-            file: "jtreg_bin-4.1.zip",
+            file: "jtreg_bin-4.2.zip",
             environment_name: "JT_HOME"
         },
 
--- a/make/CheckModules.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-#
-# Copyright (c) 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
-# 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 target declared first
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
-JDEPS_MODULES_XML := $(JDK_OUTPUTDIR)/modules/jdk.jdeps/com/sun/tools/jdeps/resources/jdeps-modules.xml
-
-#
-# Verify access across module boundaries
-#
-checkdeps:
-	$(ECHO) "Checking dependencies across JDK modules"
-	$(JAVA) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
-		-Djdeps.modules.xml=$(JDEPS_MODULES_XML) \
-		com.sun.tools.jdeps.Main \
-		-verify:access -mp $(JDK_OUTPUTDIR)/modules
-
-all: checkdeps
-
-.PHONY: all
--- a/make/CompileJavaModules.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/CompileJavaModules.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -46,6 +46,9 @@
 java.base_COPY := .icu .dat .spp content-types.properties hijrah-config-islamic-umalqura.properties
 java.base_CLEAN := intrinsic.properties
 
+java.base_EXCLUDE_FILES += \
+  $(JDK_TOPDIR)/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java
+
 java.base_EXCLUDES += java/lang/doc-files
 
 # Exclude BreakIterator classes that are just used in compile process to generate
@@ -359,8 +362,8 @@
 
 ################################################################################
 
-jdk.compiler_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:-com.sun.tools.*' -XDstringConcat=inline
-jdk.compiler_COPY := javax.tools.JavaCompilerTool
+jdk.compiler_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:-com.sun.tools.*' \
+    -XDstringConcat=inline
 jdk.compiler_CLEAN_FILES := $(wildcard \
     $(patsubst %, $(JDK_TOPDIR)/src/jdk.compiler/share/classes/%/*.properties, \
         sun/tools/serialver/resources))
@@ -480,31 +483,28 @@
 # source before static source and platform specific source before shared.
 #
 GENERATED_SRC_DIRS += \
-    $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE) \
-    $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(MODULE) \
+    $(SUPPORT_OUTPUTDIR)/gensrc \
     #
 
-OS_SRC_DIRS += $(JDK_TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS)/classes
-ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
-  OS_TYPE_SRC_DIRS += $(JDK_TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/classes
-endif
-
-SHARE_SRC_DIRS += \
-    $(HOTSPOT_TOPDIR)/src/$(MODULE)/share/classes \
-    $(JDK_TOPDIR)/src/$(MODULE)/share/classes \
-    $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes \
-    $(CORBA_TOPDIR)/src/$(MODULE)/share/classes \
-    $(JAXP_TOPDIR)/src/$(MODULE)/share/classes \
-    $(JAXWS_TOPDIR)/src/$(MODULE)/share/classes \
-    $(NASHORN_TOPDIR)/src/$(MODULE)/share/classes \
+TOP_SRC_DIRS += \
+    $(HOTSPOT_TOPDIR)/src \
+    $(CORBA_TOPDIR)/src \
+    $(JDK_TOPDIR)/src \
+    $(LANGTOOLS_TOPDIR)/src \
+    $(JAXP_TOPDIR)/src \
+    $(JAXWS_TOPDIR)/src \
+    $(NASHORN_TOPDIR)/src \
     #
 
-ALL_SRC_DIRS = \
-    $(GENERATED_SRC_DIRS) \
-    $(OS_SRC_DIRS) \
-    $(OS_TYPE_SRC_DIRS) \
-    $(SHARE_SRC_DIRS) \
-    #
+SRC_SUBDIRS += $(OPENJDK_TARGET_OS)/classes
+ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
+  SRC_SUBDIRS += $(OPENJDK_TARGET_OS_TYPE)/classes
+endif
+SRC_SUBDIRS += share/classes
+
+MODULE_SRC_DIRS := $(strip \
+    $(addsuffix /$(MODULE), $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \
+    $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /$(MODULE)/$(sub), $(TOP_SRC_DIRS))))
 
 # The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
 # JDK_FILTER at the make command line, only a subset of the JDK java files will
@@ -512,32 +512,41 @@
 # space separated list.
 JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))
 
-# Create an empty directory to set the bootclasspath to.
-EMPTY_DIR := $(SUPPORT_OUTPUTDIR)/empty-dir
-$(call MakeDir, $(EMPTY_DIR))
+# Rewrite the MODULE_SRC_DIRS with a wildcard for the module so that all module
+# source dirs are available on the path.
+MODULESOURCEPATH := $(subst $(SPACE),$(PATH_SEP),$(subst $(MODULE),*,$(MODULE_SRC_DIRS)))
 
-# Find the module dependencies by parsing modules.list file
-DEPS := $(call FindDepsForModule, $(MODULE))
+# Add imported modules to the moduleclasspath
+MODULECLASSPATH := $(subst $(SPACE),$(PATH_SEP), $(IMPORT_MODULES_CLASSES))
 
-CLASSPATH := $(foreach d, $(DEPS), $(if $($d_BIN), $($d_BIN), \
-    $(JDK_OUTPUTDIR)/modules/$d))
-  # When crypto classes are prebuilt, need to look for classes already in
-  # output dir.
-  ifneq ($(BUILD_CRYPTO), true)
-  CLASSPATH += $(JDK_OUTPUTDIR)/modules/$(MODULE)
-  endif
-JAVAC_FLAGS_BOOTCLASSPATH := -bootclasspath $(EMPTY_DIR) -extdirs $(EMPTY_DIR) \
-    -endorseddirs $(EMPTY_DIR) $($(MODULE)_ADD_JAVAC_FLAGS)
+ifeq ($(MODULE), jdk.vm.ci)
+  ## WORKAROUND jdk.vm.ci source structure issue
+  JVMCI_MODULESOURCEPATH := $(MODULESOURCEPATH) \
+      $(subst /$(MODULE)/,/*/, $(filter-out %processor/src, \
+          $(wildcard $(HOTSPOT_TOPDIR)/src/jdk.vm.ci/share/classes/*/src)))
+  MODULESOURCEPATH := $(subst $(SPACE),$(PATH_SEP), $(JVMCI_MODULESOURCEPATH))
+endif
+
+# Make sure the generated source base dirs exist. Not all modules have generated
+# source in all of these directories and because of timing, all of them might not
+# exist at the time this makefile gets called. Javac will complain if there are
+# missing directories in the moduleclasspath.
+$(call MakeDir, $(GENERATED_SRC_DIRS))
 
 $(eval $(call SetupJavaCompilation, $(MODULE), \
     SETUP := $(if $($(MODULE)_SETUP), $($(MODULE)_SETUP), GENERATE_JDKBYTECODE), \
-    SRC := $(if $($(MODULE)_SRC), $($(MODULE)_SRC), $(wildcard $(ALL_SRC_DIRS))), \
-      INCLUDES := $(JDK_USER_DEFINED_FILTER),\
-    BIN := $(if $($(MODULE)_BIN), $($(MODULE)_BIN), $(JDK_OUTPUTDIR)/modules/$(MODULE)), \
-    HEADERS := $(SUPPORT_OUTPUTDIR)/headers/$(MODULE), \
-    CLASSPATH := $(CLASSPATH), \
-    ADD_JAVAC_FLAGS := $($(MODULE)_ADD_JAVAC_FLAGS) $(JAVAC_FLAGS_BOOTCLASSPATH) \
+    MODULE := $(MODULE), \
+    SRC := $(wildcard $(MODULE_SRC_DIRS)), \
+    INCLUDES := $(JDK_USER_DEFINED_FILTER),\
+    BIN := $(if $($(MODULE)_BIN), $($(MODULE)_BIN), $(JDK_OUTPUTDIR)/modules), \
+    HEADERS := $(SUPPORT_OUTPUTDIR)/headers, \
+    ADD_JAVAC_FLAGS := \
+        $($(MODULE)_ADD_JAVAC_FLAGS) \
+        -modulesourcepath "$(MODULESOURCEPATH)" \
+        $(if $(MODULECLASSPATH), -modulepath "$(MODULECLASSPATH)") \
+        -system none, \
 ))
+
 TARGETS += $($(MODULE)) $($(MODULE)_COPY_EXTRA)
 
 # Declare dependencies between java compilations of different modules.
@@ -545,7 +554,7 @@
 # use the macro to find the correct target file to depend on.
 # Only the javac compilation actually depends on other modules so limit
 # dependency declaration to that by using the *_COMPILE_TARGET variable.
-$($(MODULE)_COMPILE_TARGET): $(foreach d, $($(MODULE)_DEPS), \
+$($(MODULE)_COMPILE_TARGET): $(foreach d, $(call FindDepsForModule, $(MODULE)), \
     $(call SetupJavaCompilationCompileTarget, $d, \
         $(if $($d_BIN), $($d_BIN), $(JDK_OUTPUTDIR)/modules/$d)))
 
@@ -569,6 +578,29 @@
 endif
 
 ################################################################################
+# If this is an imported module, copy the pre built classes and resources into
+# the modules output dir
+
+ifneq ($(wildcard $(IMPORT_MODULES_CLASSES)/$(MODULE)), )
+  $(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker: \
+      $(call CacheFind, $(IMPORT_MODULES_CLASSES)/$(MODULE))
+	$(RM) -r $(@D)
+	$(MKDIR) -p $(@D)
+	$(CP) -R $(IMPORT_MODULES_CLASSES)/$(MODULE)/* $(@D)/
+	$(TOUCH) $@
+
+  TARGETS += $(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker
+
+  # Add this dependency to avoid a race between compiling module-info.java and
+  # importing the classes.
+  $($(MODULE)_COMPILE_TARGET): $(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker
+endif
+
+################################################################################
+
+$(eval $(call IncludeCustomExtension, , CompileJavaModules-post.gmk))
+
+################################################################################
 
 all: $(TARGETS)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/CopyImportModules.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -0,0 +1,86 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+# This makefile is called for every imported module to copy the non class
+# contents into the exploded jdk image.
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+LIBS_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_LIBS)))
+CMDS_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_CMDS)))
+CONF_DIR := $(wildcard $(addsuffix /$(MODULE), $(IMPORT_MODULES_CONF)))
+
+$(eval $(call FillCacheFind, $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR)))
+
+ifneq ($(LIBS_DIR), )
+  ifeq ($(OPENJDK_TARGET_OS), windows)
+    TO_BIN_FILTER := %$(SHARED_LIBRARY_SUFFIX) %.diz %.pdb %.map
+
+    $(eval $(call SetupCopyFiles,COPY_LIBS_TO_BIN, \
+        SRC := $(LIBS_DIR), \
+        DEST := $(JDK_OUTPUTDIR)/bin, \
+        FILES := $(filter $(TO_BIN_FILTER), \
+            $(call CacheFind, $(LIBS_DIR))) \
+    ))
+
+    $(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
+        SRC := $(LIBS_DIR), \
+        DEST := $(JDK_OUTPUTDIR)/lib, \
+        FILES := $(filter-out $(TO_BIN_FILTER), \
+            $(call CacheFind, $(LIBS_DIR))) \
+    ))
+    TARGETS += $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB)
+  else
+    $(eval $(call SetupCopyFiles, COPY_LIBS, \
+        SRC := $(LIBS_DIR), \
+        DEST := $(JDK_OUTPUTDIR)/lib, \
+        FILES := $(call CacheFind, $(LIBS_DIR)), \
+    ))
+    TARGETS += $(COPY_LIBS)
+  endif
+endif
+
+ifneq ($(CMDS_DIR), )
+  $(eval $(call SetupCopyFiles, COPY_CMDS, \
+      SRC := $(CMDS_DIR), \
+      DEST := $(JDK_OUTPUTDIR)/bin, \
+      FILES := $(call CacheFind, $(CMDS_DIR)), \
+  ))
+  TARGETS += $(COPY_CMDS)
+endif
+
+ifneq ($(CONF_DIR), )
+  $(eval $(call SetupCopyFiles, COPY_CONF, \
+      SRC := $(CONF_DIR), \
+      DEST := $(JDK_OUTPUTDIR)/lib, \
+      FILES := $(call CacheFind, $(CONF_DIR)), \
+  ))
+  TARGETS += $(COPY_CONF)
+endif
+
+all: $(TARGETS)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/CreateBuildJdkCopy.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -0,0 +1,86 @@
+#
+# Copyright (c) 2015, 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
+include Modules.gmk
+
+MODULES_TO_COPY := $(call FindTransitiveDepsForModule, jdk.jlink) jdk.jlink
+
+################################################################################
+# Copy the modules needed to run jlink and jmod. Use bulk copy instead of
+# SetupCopyFiles since there are so many files.
+
+COPY_CLASSES_TARGET := $(BUILDJDK_OUTPUTDIR)/jdk/modules/_buildjdk-copy-maker
+
+$(COPY_CLASSES_TARGET): $(call CacheFind, $(wildcard \
+    $(addprefix $(JDK_OUTPUTDIR)/modules/, $(MODULES_TO_COPY))))
+	$(ECHO) $(LOG_INFO) "Copying java modules to buildjdk: $(MODULES_TO_COPY)"
+	$(RM) -r $(BUILDJDK_OUTPUTDIR)/jdk/modules
+	$(MKDIR) -p $(BUILDJDK_OUTPUTDIR)/jdk/modules
+	$(foreach m, $(MODULES_TO_COPY), \
+	    $(CP) -R $(JDK_OUTPUTDIR)/modules/$m \
+	        $(BUILDJDK_OUTPUTDIR)/jdk/modules/ $(NEWLINE))
+	$(TOUCH) $@
+
+TARGETS += $(COPY_CLASSES_TARGET)
+
+#$(eval $(call SetupCopyFiles, COPY_JDK_MODULES, \
+    SRC := $(BUILD_OUTPUT), \
+    DEST := $(BUILDJDK_OUTPUTDIR), \
+    FILES := $(call DoubleDollar, $(call DoubleDollar, $(call CacheFind, $(wildcard \
+        $(addprefix $(JDK_OUTPUTDIR)/modules/, $(MODULES_TO_COPY)))))), \
+))
+
+#TARGETS += $(COPY_JDK_MODULES)
+
+################################################################################
+
+$(eval $(call SetupCopyFiles, COPY_SUPPORT_HEADERS, \
+    SRC := $(BUILD_OUTPUT), \
+    DEST := $(BUILDJDK_OUTPUTDIR), \
+    FILES := $(call CacheFind, $(wildcard \
+        $(addprefix $(SUPPORT_OUTPUTDIR)/headers/, $(MODULES_TO_COPY)))), \
+))
+
+TARGETS += $(COPY_SUPPORT_HEADERS)
+
+################################################################################
+
+$(eval $(call SetupCopyFiles, COPY_JDK_LIB_FILES, \
+    SRC := $(BUILD_OUTPUT), \
+    DEST := $(BUILDJDK_OUTPUTDIR), \
+    FILES := $(JDK_OUTPUTDIR)/lib/tzdb.dat, \
+))
+
+TARGETS += $(COPY_JDK_LIB_FILES)
+
+################################################################################
+
+all: $(TARGETS)
+
+.PHONY: default all
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/CreateJmods.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -0,0 +1,95 @@
+#
+# Copyright (c) 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
+# 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
+include Modules.gmk
+
+ifeq ($(MODULE), )
+  $(error MODULE must be set when calling CreateJmods.gmk)
+endif
+
+################################################################################
+
+LIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
+    $(SUPPORT_OUTPUTDIR)/modules_libs-stripped $(IMPORT_MODULES_LIBS))))
+CMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
+    $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped $(IMPORT_MODULES_CMDS))))
+CONF_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
+    $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
+CLASSES_DIR := $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
+
+$(eval $(call FillCacheFind, \
+    $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \
+))
+
+ifneq ($(LIBS_DIR), )
+  JMOD_FLAGS += --libs $(LIBS_DIR)
+  DEPS += $(call CacheFind, $(LIBS_DIR))
+endif
+ifneq ($(CMDS_DIR), )
+  JMOD_FLAGS += --cmds $(CMDS_DIR)
+  DEPS += $(call CacheFind, $(CMDS_DIR))
+endif
+ifneq ($(CONF_DIR), )
+  JMOD_FLAGS += --config $(CONF_DIR)
+  DEPS += $(call CacheFind, $(CONF_DIR))
+endif
+ifneq ($(CLASSES_DIR), )
+  JMOD_FLAGS += --class-path $(CLASSES_DIR)
+  DEPS += $(call CacheFind, $(CLASSES_DIR))
+endif
+
+# Add dependencies on other jmod files
+DEPS += $(patsubst %, $(IMAGES_OUTPUTDIR)/jmods/%.jmod, \
+    $(call FindDepsForModule, $(MODULE)))
+
+# TODO: What about headers?
+# Create jmods in a temp dir and then move them into place to keep the
+# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
+$(IMAGES_OUTPUTDIR)/jmods/$(MODULE).jmod: $(DEPS)
+	$(call LogWarn, Creating $(notdir $@))
+	$(call MakeDir, $(@D) $(SUPPORT_OUTPUTDIR)/jmods)
+	$(RM) $@ $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@)
+	$(JMOD) create \
+            --module-version $(VERSION_SHORT) \
+            --os-name $(REQUIRED_OS_NAME) \
+            --os-arch $(OPENJDK_TARGET_CPU_LEGACY) \
+            --os-version $(REQUIRED_OS_VERSION) \
+	    --modulepath $(IMAGES_OUTPUTDIR)/jmods\
+            --hash-dependencies '.*' \
+            --exclude '**_the.*' \
+	    $(JMOD_FLAGS) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@)
+	$(MV) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@) $@
+
+TARGETS += $(IMAGES_OUTPUTDIR)/jmods/$(MODULE).jmod
+
+################################################################################
+
+all: $(TARGETS)
+
+################################################################################
--- a/make/GenerateModuleDeps.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-#
-# Copyright (c) 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
-# 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.
-#
-
-# This file is included from Main.gmk only.
-
-include $(SRC_ROOT)/make/common/JavaCompilation.gmk
-include $(SRC_ROOT)/make/common/SetupJavaCompilers.gmk
-
-################################################################################
-
-$(eval $(call SetupJavaCompilation, BUILD_GENMODULESLIST, \
-    SETUP := BOOT_JAVAC, \
-    SRC := $(JDK_TOPDIR)/make/src/classes, \
-    INCLUDES := build/tools/module, \
-    EXCLUDE_FILES := ImageBuilder.java ModuleArchive.java, \
-    BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \
-    DISABLE_SJAVAC := true, \
-))
-
-TOOL_GENMODULESLIST = $(JAVA_SMALL) \
-    -cp "$(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist" \
-    build.tools.module.GenModulesList
-
-MODULES_LIST_FILE := $(MAKESUPPORT_OUTPUTDIR)/modules.list
-# The module deps makefile is used from make/common/Modules.gmk
-MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
-
-$(MODULES_LIST_FILE): $(SRC_ROOT)/modules.xml $(BUILD_GENMODULESLIST)
-	$(TOOL_GENMODULESLIST) -o $@ $(filter %.xml, $^)
-
-$(MODULE_DEPS_MAKEFILE): $(MODULES_LIST_FILE)
-	$(CAT) $^ | $(SED) -e 's/^\([^:]*\):/DEPS_\1 :=/g' > $@
-
-TARGETS += $(MODULE_DEPS_MAKEFILE)
-
-################################################################################
-
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , GenerateModuleDeps.gmk))
-
-# Trigger generation of this file and restart make if it changed.
--include $(MODULE_DEPS_MAKEFILE)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/GensrcModuleInfo.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -0,0 +1,154 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+################################################################################
+# This file makes modifications to module-info.java files based on the build
+# configuration.
+#
+# Depending on build platform, imported modules and optional parts of the build
+# being active, some modules need to have extra exports, provides or uses
+# declarations added to them. These optional extras are defined in .extra files:
+#
+# src/<module>/<share,platform>/classes/module-info.java.extra
+#
+# The contents of the .extra files are simply extra lines that could fit into
+# the module-info file.
+#
+# This makefile is called once for each from-module with the variable
+# MODULE naming the from-module.
+#
+# The modified module-info.java files are put in the gensrc directory where
+# they will automatically override the static versions in the src tree.
+#
+################################################################################
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include Modules.gmk
+#include TextFileProcessing.gmk
+
+################################################################################
+# Define this here since jdk/make/Tools.gmk cannot be included from the top
+# make directory. Should probably move some tools away from the jdk repo.
+TOOL_GENMODULEINFOSOURCE = $(JAVA_SMALL) \
+    $(INTERIM_LANGTOOLS_ARGS) \
+    -cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes" \
+    build.tools.module.GenModuleInfoSource
+
+################################################################################
+
+# Name of data file. Keep module-info.java.ext until javafx has changed.
+MOD_FILENAME := module-info.java.extra module-info.java.ext
+
+# List all the possible sub directories inside a module source directory where
+# data might be stored.
+CLASSES_SUBDIRS += $(OPENJDK_TARGET_OS)/classes
+ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
+  CLASSES_SUBDIRS += $(OPENJDK_TARGET_OS_TYPE)/classes
+endif
+CLASSES_SUBDIRS += share/classes
+
+# TODO: When the deploy build is better integrated, this will get added globally
+# but for now need to add it here.
+ifeq ($(BUILD_DEPLOY), true)
+  ALL_TOP_SRC_DIRS += $(DEPLOY_TOPDIR)/src
+endif
+
+# Construct all possible src directories for the module.
+MODULE_CLASSES_DIRS := $(strip \
+    $(foreach sub, $(CLASSES_SUBDIRS), \
+        $(addsuffix /$(MODULE)/$(sub), $(ALL_TOP_SRC_DIRS))) \
+    $(addsuffix /$(MODULE), $(IMPORT_MODULES_SRC)))
+
+# Find all the .extra files in the src dirs.
+MOD_FILES := $(wildcard $(foreach f, $(MOD_FILENAME), $(addsuffix /$(f), \
+    $(MODULE_CLASSES_DIRS))))
+
+ifneq ($(MOD_FILES), )
+  # Only make this call if modification files are found for this module
+  ALL_MODULES := $(call FindAllModules)
+
+  # Read the contents of all the files into a variable. Replace space with / to
+  # let space represent new lines in the variable as $(shell) normalizes all
+  # whitespace.
+  $(foreach f, $(MOD_FILES), \
+    $(eval MOD_FILE_CONTENTS += $(shell $(GREP) -v ".\*" $f | $(TR) ' ' '/')))
+
+  # Filter the contents for modules that are actually being built
+  MODULES_FILTER := $(addprefix %/, $(addsuffix ;, $(ALL_MODULES)))
+  MODULES_FILTER += provides%
+  MODIFICATIONS := $(filter $(MODULES_FILTER), $(MOD_FILE_CONTENTS))
+
+  # Convert the modification lines into arguments for the modification tool.
+  # Filter out modifications for non existing to-modules.
+  $(foreach line, $(MODIFICATIONS), \
+    $(eval split_line := $(subst /,$(SPACE),$(line))) \
+    $(eval command := $(word 1, $(split_line))) \
+    $(eval package := $(word 2, $(split_line))) \
+    $(eval to_module := $(patsubst %;,%,$(word 4, $(split_line)))) \
+    $(eval ARGS += -$(command) $(package)/$(to_module)))
+
+  ifneq ($(ARGS), )
+    $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java: \
+        $(firstword $(call FindAllModuleInfos, $(MODULE))) \
+        $(BUILD_TOOLS_JDK) \
+        $(call DependOnVariable, ARGS)
+		$(MKDIR) -p $(@D)
+		$(RM) $@ $@.tmp
+		$(TOOL_GENMODULEINFOSOURCE) $(ARGS) -o $@.tmp $<
+		$(MV) $@.tmp $@
+
+    TARGETS += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java
+  endif
+
+# This doesn't work because javac only accepts one single exports line per
+# exported package.
+  # Restore the modifications to separate lines with spaces
+#  MODIFICATIONS := $(subst /,$(SPACE),$(MODIFICATIONS))
+
+#  ifneq ($(MODIFICATIONS), )
+#    $(eval $(call SetupTextFileProcessing, PROCESS_MODULE_INFO, \
+#        SOURCE_FILES := $(firstword $(call FindAllModuleInfos, $(MODULE))), \
+#        OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java, \
+#        REPLACEMENTS := } => $(MODIFICATIONS) }, \
+#    ))
+
+#    TARGETS += $(PROCESS_MODULE_INFO)
+#  endif
+endif
+
+# If no modifications are found for this module, remove any module-info.java
+# created by a previous build since that is no longer valid.
+ifeq ($(MODIFICATIONS), )
+  ifneq ($(wildcard $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java), )
+    $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java)
+  endif
+endif
+
+################################################################################
+
+all: $(TARGETS)
--- a/make/HotspotWrapper.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/HotspotWrapper.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -25,7 +25,10 @@
 
 # Include the legacy hotspot-spec.gmk (which in turns includes spec.gmk)
 BASE_SPEC:=$(SPEC)
-include $(dir $(SPEC))hotspot-spec.gmk
+# Assign to HOTSPOT_SPEC so that the variable HOTSPOT_SPEC can be
+# overridden when building the buildjdk.
+HOTSPOT_SPEC := $(dir $(SPEC))hotspot-spec.gmk
+include $(HOTSPOT_SPEC)
 include MakeBase.gmk
 
 # Inclusion of this pseudo-target will cause make to execute this file
@@ -45,7 +48,7 @@
 # not doing it breaks builds on msys.
 $(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp: $(HOTSPOT_FILES)
 	@$(MKDIR) -p $(HOTSPOT_OUTPUTDIR)
-	@($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) \
+	($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) \
 	    LOG_LEVEL=$(LOG_LEVEL) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC))
 	$(TOUCH) $@
 
--- a/make/Images.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/Images.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -38,7 +38,7 @@
 
 ############################################################################
 
-MAIN_MODULES += java.se java.smartcardio jdk.httpserver jdk.sctp \
+MAIN_MODULES += java.se.ee java.smartcardio jdk.httpserver jdk.sctp \
                jdk.security.auth jdk.security.jgss jdk.pack200 jdk.xml.dom \
                jdk.accessibility jdk.internal.le jdk.dynalink \
                jdk.scripting.nashorn jdk.scripting.nashorn.shell \
@@ -49,10 +49,10 @@
                jdk.localedata jdk.naming.dns jdk.naming.rmi jdk.zipfs
 
 # tools
-TOOLS_MODULES += jdk.attach jdk.compiler jdk.dev \
+TOOLS_MODULES += jdk.attach jdk.compiler \
                jdk.javadoc jdk.jcmd jdk.jconsole jdk.hotspot.agent jdk.jartool \
-               jdk.jdeps jdk.jdi jdk.jdwp.agent jdk.jshell jdk.policytool jdk.rmic \
-               jdk.xml.bind jdk.xml.ws
+               jdk.jdeps jdk.jdi jdk.jdwp.agent jdk.jlink jdk.jshell \
+               jdk.policytool jdk.rmic jdk.xml.bind jdk.xml.ws jdk.internal.opt
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
   PROVIDER_MODULES += jdk.crypto.mscapi
@@ -65,104 +65,151 @@
 JRE_MODULES := $(filter-out $(MODULES_FILTER), $(MAIN_MODULES) $(PROVIDER_MODULES))
 JDK_MODULES := $(filter-out $(MODULES_FILTER), $(JRE_MODULES) $(TOOLS_MODULES))
 
-# compact3 builds have additional modules
-JDK_COMPACT3_MODULES := java.compact3 java.smartcardio jdk.httpserver jdk.naming.dns \
-                       jdk.naming.rmi jdk.sctp jdk.security.auth jdk.management
+# Param 1 - Name of module
+define ReadImportMetaData
+  ifneq ($$(wildcard $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties), )
+    include_in_jre :=
+    include_in_jdk :=
+    include $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties
+    ifeq ($$(include_in_jre), true)
+      JRE_MODULES += $1
+    endif
+    ifeq ($$(include_in_jdk), true)
+      JDK_MODULES += $1
+    endif
+  else
+    # Default to include in all
+    JRE_MODULES += $1
+    JDK_MODULES += $1
+  endif
+endef
+
+IMPORTED_MODULES := $(call FindImportedModules)
+$(foreach m, $(IMPORTED_MODULES), $(eval $(call ReadImportMetaData, $m)))
+
+# Compact builds have additional modules
+COMPACT_EXTRA_MODULES := jdk.localedata jdk.crypto.pkcs11 jdk.crypto.ec
+JRE_COMPACT1_MODULES := $(COMPACT_EXTRA_MODULES) java.compact1
+JRE_COMPACT2_MODULES := $(JRE_COMPACT1_MODULES) java.compact2 jdk.xml.dom jdk.httpserver
+JRE_COMPACT3_MODULES := $(JRE_COMPACT2_MODULES) java.compact3 java.smartcardio jdk.management \
+                        jdk.naming.dns jdk.naming.rmi jdk.sctp jdk.security.auth
 
 # Replacing double-comma with a single comma is to workaround the issue
 # with some version of make on windows that doesn't substitute spaces
 # with one comma properly as with make 4.0
-define SubstComma
-  $(subst $(COMMA)$(COMMA),$(COMMA),$(subst $(SPACE),$(COMMA),$(strip $1)))
-endef
+SubstComma = \
+    $(strip \
+        $(subst $(COMMA)$(COMMA),$(COMMA),$(subst $(SPACE),$(COMMA),$(strip $1))) \
+    )
+
 JRE_MODULES_LIST := $(call SubstComma, $(JRE_MODULES))
 JDK_MODULES_LIST := $(call SubstComma, $(JDK_MODULES))
+JRE_COMPACT1_MODULES_LIST := $(call SubstComma, $(JRE_COMPACT1_MODULES))
+JRE_COMPACT2_MODULES_LIST := $(call SubstComma, $(JRE_COMPACT2_MODULES))
+JRE_COMPACT3_MODULES_LIST := $(call SubstComma, $(JRE_COMPACT3_MODULES))
+
+################################################################################
+# Release file
+
+BASE_RELEASE_FILE := $(JDK_OUTPUTDIR)/release
+
+# Common way to emit a line into the release or info file
+define info-file-item # name value
+  $(PRINTF) '%s="%s"\n' $1 $2 >> $@
+endef
+
+# Param 1 - The file containing the MODULES list
+define create-info-file
+  $(call info-file-item, "JAVA_VERSION", "$(VERSION_NUMBER)")
+  $(call info-file-item, "JAVA_FULL_VERSION", "$(VERSION_STRING)")
+  $(call info-file-item, "OS_NAME", "$(REQUIRED_OS_NAME)")
+  $(call info-file-item, "OS_VERSION", "$(REQUIRED_OS_VERSION)")
+  $(call info-file-item, "OS_ARCH", "$(OPENJDK_TARGET_CPU_LEGACY)")
+  $(if $(JDK_ARCH_ABI_PROP_NAME), \
+    $(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)"))
+  $(call info-file-item, "SOURCE", "$(strip $(ALL_SOURCE_TIPS))")
+endef
+
+# Param 1 - The file containing the MODULES list
+define prepare-info-file
+  $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+  $(MKDIR) -p $(@D)
+  $(RM) $@
+endef
+
+define info-file
+  $(call prepare-info-file)
+  $(call create-info-file)
+endef
+
+# Create a variable dependency file common for all release info files.
+INFO_FILE_VARDEPS := $(call DependOnVariable, create-info-file)
+
+ALL_SOURCE_TIPS = $(shell \
+    if [ -f $(SUPPORT_OUTPUTDIR)/source_tips ] ; then \
+      $(CAT) $(SUPPORT_OUTPUTDIR)/source_tips ; \
+    fi)
+
+$(BASE_RELEASE_FILE): $(INFO_FILE_VARDEPS) $(SUPPORT_OUTPUTDIR)/source_tips
+	$(info-file)
 
 ################################################################################
 
-JRE_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/jre-sorted-modules
-JDK_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/jdk-sorted-modules
-JRE_COMPACT1_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact1-sorted-modules
-JRE_COMPACT2_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact2-sorted-modules
-JRE_COMPACT3_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact3-sorted-modules
-
-
-MODULES_CMDS := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
-MODULES_LIBS := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
-MODULES_CONF := $(SUPPORT_OUTPUTDIR)/modules_conf
-
-JIMAGE_TOOL := $(JAVA_SMALL) \
-    -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
-    -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.module.ImageBuilder \
-    --cmds $(MODULES_CMDS) \
-    --libs $(MODULES_LIBS) \
-    --configs $(MODULES_CONF) \
-    --classes $(JDK_OUTPUTDIR)/modules \
-    --endian $(OPENJDK_TARGET_CPU_ENDIAN) \
-    #
-
-MODULES_XML += $(SRC_ROOT)/modules.xml
-DEPENDENCIES := $(call CacheFind, \
-    $(SUPPORT_OUTPUTDIR)/modules_cmds \
-    $(SUPPORT_OUTPUTDIR)/modules_conf \
-    $(SUPPORT_OUTPUTDIR)/modules_libs) \
-    $(wildcard $(JDK_OUTPUTDIR)/modules/*/_*) \
-    $(MODULES_XML)
-    #
+JMODS := $(wildcard $(IMAGES_OUTPUTDIR)/jmods/*.jmod)
 
 # Use this file inside the image as target for make rule
 JIMAGE_TARGET_FILE := bin/java$(EXE_SUFFIX)
 
-$(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES) \
-    $(call DependOnVariable, JDK_MODULES_LIST)
+JLINK_TOOL := $(JLINK) --modulepath $(IMAGES_OUTPUTDIR)/jmods \
+              --endian $(OPENJDK_BUILD_CPU_ENDIAN) \
+              --release-info $(BASE_RELEASE_FILE)
+
+ifeq ($(JLINK_KEEP_PACKAGED_MODULES), true)
+  JLINK_EXTRA_OPTS := --keep-packaged-modules $(JDK_IMAGE_DIR)/jmods
+endif
+
+$(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
+    $(call DependOnVariable, JDK_MODULES_LIST) $(BASE_RELEASE_FILE)
 	$(ECHO) Creating jdk jimage
-	$(RM) -r $(JDK_IMAGE_DIR) $(JDK_SORTED_MODULES)
-	$(JIMAGE_TOOL) --mods $(JDK_MODULES_LIST) --output $(JDK_IMAGE_DIR) \
-	    $(MODULES_XML) > $(JDK_SORTED_MODULES)
+	$(RM) -r $(JDK_IMAGE_DIR)
+	$(JLINK_TOOL) --output $(JDK_IMAGE_DIR) \
+	    --addmods $(JDK_MODULES_LIST) $(JLINK_EXTRA_OPTS)
 	$(TOUCH) $@
 
-$(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES) \
-    $(call DependOnVariable, JRE_MODULES_LIST)
+$(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
+    $(call DependOnVariable, JRE_MODULES_LIST) $(BASE_RELEASE_FILE)
 	$(ECHO) Creating jre jimage
-	$(RM) -r $(JRE_IMAGE_DIR) $(JRE_SORTED_MODULES)
-	$(JIMAGE_TOOL) --mods $(JRE_MODULES_LIST) --output $(JRE_IMAGE_DIR) \
-	    $(MODULES_XML) > $(JRE_SORTED_MODULES)
+	$(RM) -r $(JRE_IMAGE_DIR)
+	$(JLINK_TOOL) --output $(JRE_IMAGE_DIR) \
+	    --addmods $(JRE_MODULES_LIST)
 	$(TOUCH) $@
 
 JRE_COMPACT1_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact1
 JRE_COMPACT2_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact2
 JRE_COMPACT3_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact3
 
-COMPACT_EXTRA_MODULES := jdk.localedata jdk.crypto.pkcs11 jdk.crypto.ec
-
-$(JRE_COMPACT1_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES) \
-    $(call DependOnVariable, JRE_COMPACT1_MODULES_LIST)
+$(JRE_COMPACT1_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
+    $(call DependOnVariable, JRE_COMPACT1_MODULES_LIST) $(BASE_RELEASE_FILE)
 	$(ECHO) Creating jre compact1 jimage
-	$(RM) -r $(JRE_COMPACT1_IMAGE_DIR) $(JRE_COMPACT1_SORTED_MODULES)
-	$(JIMAGE_TOOL) \
-	    --mods $(call SubstComma, java.compact1 $(COMPACT_EXTRA_MODULES)) \
-	    --output $(JRE_COMPACT1_IMAGE_DIR) \
-	    $(MODULES_XML) > $(JRE_COMPACT1_SORTED_MODULES)
+	$(RM) -r $(JRE_COMPACT1_IMAGE_DIR)
+	$(JLINK_TOOL) --addmods $(JRE_COMPACT1_MODULES_LIST) \
+	    --output $(JRE_COMPACT1_IMAGE_DIR)
 	$(TOUCH) $@
 
-$(JRE_COMPACT2_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES) \
-    $(call DependOnVariable, JRE_COMPACT2_MODULES_LIST)
+$(JRE_COMPACT2_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
+    $(call DependOnVariable, JRE_COMPACT2_MODULES_LIST) $(BASE_RELEASE_FILE)
 	$(ECHO) Creating jre compact2 jimage
-	$(RM) -r $(JRE_COMPACT2_IMAGE_DIR) $(JRE_COMPACT2_SORTED_MODULES)
-	$(JIMAGE_TOOL) \
-	    --mods $(call SubstComma, java.compact2 $(COMPACT_EXTRA_MODULES)) \
-	    --output $(JRE_COMPACT2_IMAGE_DIR) \
-	    $(MODULES_XML) > $(JRE_COMPACT2_SORTED_MODULES)
+	$(RM) -r $(JRE_COMPACT2_IMAGE_DIR)
+	$(JLINK_TOOL) --addmods $(JRE_COMPACT2_MODULES_LIST) \
+	    --output $(JRE_COMPACT2_IMAGE_DIR)
 	$(TOUCH) $@
 
-$(JRE_COMPACT3_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES) \
-    $(call DependOnVariable, JRE_COMPACT3_MODULES_LIST)
+$(JRE_COMPACT3_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
+    $(call DependOnVariable, JRE_COMPACT3_MODULES_LIST) $(BASE_RELEASE_FILE)
 	$(ECHO) Creating jre compact3 jimage
-	$(RM) -r $(JRE_COMPACT3_IMAGE_DIR) $(JRE_COMPACT3_SORTED_MODULES)
-	$(JIMAGE_TOOL) \
-	    --mods $(call SubstComma, $(JDK_COMPACT3_MODULES) $(COMPACT_EXTRA_MODULES)) \
-	    --output $(JRE_COMPACT3_IMAGE_DIR) \
-	    $(MODULES_XML) > $(JRE_COMPACT3_SORTED_MODULES)
+	$(RM) -r $(JRE_COMPACT3_IMAGE_DIR)
+	$(JLINK_TOOL) --addmods $(JRE_COMPACT3_MODULES_LIST) \
+	    --output $(JRE_COMPACT3_IMAGE_DIR)
 	$(TOUCH) $@
 
 TOOL_JRE_TARGETS := $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
@@ -346,79 +393,6 @@
 JDK_TARGETS += $(JDK_DOC_TARGETS)
 
 ################################################################################
-# Release file
-
-JRE_INFO_FILE := $(JRE_IMAGE_DIR)/release
-JDK_INFO_FILE := $(JDK_IMAGE_DIR)/release
-JRE_COMPACT1_INFO_FILE := $(JRE_COMPACT1_IMAGE_DIR)/release
-JRE_COMPACT2_INFO_FILE := $(JRE_COMPACT2_IMAGE_DIR)/release
-JRE_COMPACT3_INFO_FILE := $(JRE_COMPACT3_IMAGE_DIR)/release
-
-# Common way to emit a line into the release or info file
-define info-file-item # name value
-  $(PRINTF) '%s="%s"\n' $1 $2 >> $@
-endef
-
-# Param 1 - The file containing the MODULES list
-define create-info-file
-  $(call info-file-item, "JAVA_VERSION", "$(VERSION_NUMBER)")
-  $(call info-file-item, "JAVA_FULL_VERSION", "$(VERSION_STRING)")
-  $(call info-file-item, "OS_NAME", "$(REQUIRED_OS_NAME)")
-  $(call info-file-item, "OS_VERSION", "$(REQUIRED_OS_VERSION)")
-  $(call info-file-item, "OS_ARCH", "$(OPENJDK_TARGET_CPU_LEGACY)")
-  $(if $(JDK_ARCH_ABI_PROP_NAME), \
-    $(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)"))
-  $(call info-file-item, "SOURCE", "$(strip $(ALL_SOURCE_TIPS))")
-  $(call info-file-item, "MODULES", "`$(CAT) $1`")
-endef
-
-# Param 1 - The file containing the MODULES list
-define prepare-info-file
-  $(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
-  $(MKDIR) -p $(@D)
-  $(RM) $@
-endef
-
-define info-file
-  $(call prepare-info-file, $1)
-  $(call create-info-file, $1)
-endef
-
-# Create a variable dependency file common for all release info files. The
-# sorted module list will only change if the image is regenerated, which will
-# trigger a rebuild of these files anyway.
-INFO_FILE_VARDEPS := $(call DependOnVariable, create-info-file)
-
-ALL_SOURCE_TIPS = $(shell \
-    if [ -f $(SUPPORT_OUTPUTDIR)/source_tips ] ; then \
-      $(CAT) $(SUPPORT_OUTPUTDIR)/source_tips ; \
-    fi)
-
-$(JRE_INFO_FILE): $(INFO_FILE_VARDEPS) $(SUPPORT_OUTPUTDIR)/source_tips
-	$(call info-file, $(JRE_SORTED_MODULES))
-
-$(JDK_INFO_FILE): $(INFO_FILE_VARDEPS) $(SUPPORT_OUTPUTDIR)/source_tips
-	$(call info-file, $(JDK_SORTED_MODULES))
-
-$(JRE_COMPACT1_INFO_FILE): $(INFO_FILE_VARDEPS) $(SUPPORT_OUTPUTDIR)/source_tips
-	$(call info-file, $(JRE_COMPACT1_SORTED_MODULES))
-	$(call info-file-item, "JAVA_PROFILE", "compact1")
-
-$(JRE_COMPACT2_INFO_FILE): $(INFO_FILE_VARDEPS) $(SUPPORT_OUTPUTDIR)/source_tips
-	$(call info-file, $(JRE_COMPACT2_SORTED_MODULES))
-	$(call info-file-item, "JAVA_PROFILE", "compact2")
-
-$(JRE_COMPACT3_INFO_FILE): $(INFO_FILE_VARDEPS) $(SUPPORT_OUTPUTDIR)/source_tips
-	$(call info-file, $(JRE_COMPACT3_SORTED_MODULES))
-	$(call info-file-item, "JAVA_PROFILE", "compact3")
-
-JRE_TARGETS += $(JRE_INFO_FILE)
-JDK_TARGETS += $(JDK_INFO_FILE)
-JRE_COMPACT1_TARGETS += $(JRE_COMPACT1_INFO_FILE)
-JRE_COMPACT2_TARGETS += $(JRE_COMPACT2_INFO_FILE)
-JRE_COMPACT3_TARGETS += $(JRE_COMPACT3_INFO_FILE)
-
-################################################################################
 # src.zip
 
 $(JDK_IMAGE_DIR)/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
@@ -435,7 +409,7 @@
       DEST := $(JDK_IMAGE_DIR)/demo, \
       FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
           $(call DoubleDollar, $(call DoubleDollar, \
-          $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
+      $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
           -type f -a ! \( -name "_the*" -o -name "javac_state" \) )))), \
   ))
 
@@ -445,7 +419,7 @@
 ################################################################################
 # /sample dir
 
-$(eval $(call SetupCopyFiles, COPY_SAMPLES, \
+$(eval $(call SetupCopyFiles,COPY_SAMPLES, \
     SRC := $(SUPPORT_OUTPUTDIR)/sample/image, \
     DEST := $(JDK_IMAGE_DIR)/sample, \
     FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample/image), \
--- a/make/Javadoc.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/Javadoc.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -1,4 +1,4 @@
-# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -138,26 +138,48 @@
 # to $(PATH_SEP) being interpreted as an end of
 # command (newline or shell ; character)
 ALL_SOURCE_DIRS := $(wildcard \
-      $(JDK_TOPDIR)/src/*/share/classes \
+      $(SUPPORT_OUTPUTDIR)/gensrc/j* \
+      $(if $(IMPORT_MODULES_SRC), $(IMPORT_MODULES_SRC)/*) \
       $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \
       $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_TYPE)/classes \
+      $(JDK_TOPDIR)/src/*/share/classes \
+      $(HOTSPOT_TOPDIR)/src/*/share/classes \
       $(LANGTOOLS_TOPDIR)/src/*/share/classes \
       $(NASHORN_TOPDIR)/src/*/share/classes \
       $(CORBA_TOPDIR)/src/*/share/classes \
       $(JAXP_TOPDIR)/src/*/share/classes \
       $(JAXWS_TOPDIR)/src/*/share/classes \
-      $(SUPPORT_OUTPUTDIR)/gensrc/j* \
       $(SUPPORT_OUTPUTDIR)/rmic/j* \
       $(JDK_TOPDIR)/src/*/share/doc/stub \
       ) \
       #
 
+ALL_MODULE_SOURCE_DIRS := \
+      $(SUPPORT_OUTPUTDIR)/gensrc/* \
+      $(if $(IMPORT_MODULES_SRC), $(IMPORT_MODULES_SRC)/*) \
+      $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \
+      $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_TYPE)/classes \
+      $(JDK_TOPDIR)/src/*/share/classes \
+      $(HOTSPOT_TOPDIR)/src/*/share/classes \
+      $(LANGTOOLS_TOPDIR)/src/*/share/classes \
+      $(NASHORN_TOPDIR)/src/*/share/classes \
+      $(CORBA_TOPDIR)/src/*/share/classes \
+      $(JAXP_TOPDIR)/src/*/share/classes \
+      $(JAXWS_TOPDIR)/src/*/share/classes \
+      $(SUPPORT_OUTPUTDIR)/rmic/* \
+      $(JDK_TOPDIR)/src/*/share/doc/stub \
+      #
+
+
 # List with classpath separator between them
 EMPTY:=
 SPACE:= $(EMPTY) $(EMPTY)
 RELEASEDOCS_SOURCEPATH = \
     $(subst $(SPACE),$(PATH_SEP),$(strip $(ALL_SOURCE_DIRS)))
 
+RELEASEDOCS_MODULESOURCEPATH = \
+    $(subst $(SPACE),$(PATH_SEP),$(strip $(ALL_MODULE_SOURCE_DIRS)))
+
 define prep-target
 	$(MKDIR) -p $(@D)
 	$(RM) $@
@@ -372,6 +394,9 @@
 COREAPI_OPTIONS_FILE = $(DOCSTMPDIR)/coredocs.options
 COREAPI_PACKAGES_FILE = $(DOCSTMPDIR)/coredocs.packages
 
+# The modules required to be documented
+COREAPI_MODULES = java.se.ee
+
 coredocs: $(COREAPI_INDEX_FILE)
 
 # Set relative location to core api document root
@@ -391,7 +416,9 @@
           $(call COMMON_JAVADOCTAGS) ; \
           $(call OptionOnly,-Xdoclint:reference) ; \
           $(call OptionOnly,-Xdoclint/package:-org.omg.*) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(COREAPI_MODULES)) ; \
 	  $(call OptionPair,-encoding,ISO-8859-1) ; \
 	  $(call OptionOnly,-splitIndex) ; \
 	  $(call OptionPair,-overview,$(COREAPI_OVERVIEW)) ; \
@@ -431,6 +458,9 @@
 DOCLETAPI_OPTIONS_FILE = $(DOCSTMPDIR)/docletapi.options
 DOCLETAPI_PACKAGES_FILE = $(DOCSTMPDIR)/docletapi.packages
 
+# The modules required to be documented
+DOCLETAPI_MODULES = jdk.javadoc
+
 docletapidocs: $(DOCLETAPI_INDEX_FILE)
 
 # Set relative location to core api document root
@@ -449,7 +479,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:all) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(DOCLETAPI_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-breakiterator) ; \
 	  $(call OptionPair,-doctitle,$(DOCLETAPI_DOCTITLE)) ; \
@@ -488,6 +520,9 @@
 OLD_DOCLETAPI_OPTIONS_FILE = $(DOCSTMPDIR)/old-docletapi.options
 OLD_DOCLETAPI_PACKAGES_FILE = $(DOCSTMPDIR)/old-docletapi.packages
 
+# The modules required to be documented
+OLD_DOCLETAPI_MODULES = jdk.javadoc
+
 olddocletapidocs: $(OLD_DOCLETAPI_INDEX_FILE)
 
 # Set relative location to core api document root
@@ -506,7 +541,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:all) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(OLD_DOCLETAPI_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-breakiterator) ; \
 	  $(call OptionPair,-doctitle,$(OLD_DOCLETAPI_DOCTITLE)) ; \
@@ -541,6 +578,9 @@
 TAGLETAPI_OPTIONS_FILE = $(DOCSTMPDIR)/tagletapi.options
 TAGLETAPI_PACKAGES_FILE = $(DOCSTMPDIR)/tagletapi.packages
 
+# The modules required to be documented
+TAGLETAPI_MODULES = jdk.javadoc
+
 tagletapidocs: $(TAGLETAPI_INDEX_FILE)
 
 # Set relative location to core api document root
@@ -564,7 +604,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:all) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(TAGLETAPI_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nonavbar) ; \
 	  $(call OptionOnly,-noindex) ; \
@@ -599,6 +641,9 @@
 DOMAPI_OPTIONS_FILE = $(DOCSTMPDIR)/domapi.options
 DOMAPI_PACKAGES_FILE = $(DOCSTMPDIR)/domapi.packages
 
+# The modules required to be documented
+DOMAPI_MODULES = java.xml,jdk.xml.dom
+
 domapidocs: $(DOMAPI_INDEX_FILE)
 
 # Set relative location to core api document root
@@ -617,7 +662,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:none) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(DOMAPI_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-splitIndex) ; \
 	  $(call OptionPair,-doctitle,$(DOMAPI_DOCTITLE)) ; \
@@ -663,6 +710,9 @@
 JDI_OPTIONS_FILE = $(DOCSTMPDIR)/jdi.options
 JDI_PACKAGES_FILE = $(DOCSTMPDIR)/jdi.packages
 
+# The modules required to be documented
+JDI_MODULES = jdk.jdi
+
 jdidocs: $(JDI_INDEX_FILE)
 
 # Set relative location to core api document root
@@ -681,7 +731,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:none) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(JDI_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionPair,-overview,$(JDI_OVERVIEW)) ; \
 	  $(call OptionPair,-doctitle,$(JDI_DOCTITLE)) ; \
@@ -751,6 +803,9 @@
 JAAS_OPTIONS_FILE = $(DOCSTMPDIR)/jaas.options
 JAAS_PACKAGES_FILE = $(DOCSTMPDIR)/jaas.packages
 
+# The modules required to be documented
+JAAS_MODULES = jdk.security.auth
+
 jaasdocs: $(JAAS_INDEX_FILE)
 
 # Set relative location to core api document root
@@ -769,7 +824,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:none) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(JAAS_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionPair,-overview,$(JAAS_OVERVIEW)) ; \
 	  $(call OptionPair,-doctitle,$(JAAS_DOCTITLE)) ; \
@@ -805,6 +862,9 @@
 JGSS_OPTIONS_FILE = $(DOCSTMPDIR)/jgss.options
 JGSS_PACKAGES_FILE = $(DOCSTMPDIR)/jgss.packages
 
+# The modules required to be documented
+JGSS_MODULES = jdk.security.jgss
+
 jgssdocs: $(JGSS_INDEX_FILE)
 
 # Set relative location to core api document root
@@ -823,7 +883,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:none) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(JGSS_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
 	  $(call OptionPair,-overview,$(JGSS_OVERVIEW)) ; \
@@ -859,6 +921,9 @@
 SMARTCARDIO_OPTIONS_FILE = $(DOCSTMPDIR)/smartcardio.options
 SMARTCARDIO_PACKAGES_FILE = $(DOCSTMPDIR)/smartcardio.packages
 
+# The modules required to be documented
+SMARTCARDIO_MODULES = java.smartcardio
+
 smartcardiodocs: $(SMARTCARDIO_INDEX_FILE)
 
 # Set relative location to core api document root
@@ -877,7 +942,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:none) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(SMARTCARDIO_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
 	  $(call OptionPair,-doctitle,$(SMARTCARDIO_DOCTITLE)) ; \
@@ -911,6 +978,9 @@
 HTTPSERVER_OPTIONS_FILE = $(DOCSTMPDIR)/httpserver.options
 HTTPSERVER_PACKAGES_FILE = $(DOCSTMPDIR)/httpserver.packages
 
+# The modules required to be documented
+HTTPSERVER_MODULES = jdk.httpserver
+
 httpserverdocs: $(HTTPSERVER_INDEX_HTML)
 
 # Set relative location to core api document root
@@ -929,7 +999,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:none) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(HTTPSERVER_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
 	  $(call OptionPair,-doctitle,$(HTTPSERVER_DOCTITLE)) ; \
@@ -967,6 +1039,9 @@
 MGMT_OPTIONS_FILE = $(DOCSTMPDIR)/mgmt.options
 MGMT_PACKAGES_FILE = $(DOCSTMPDIR)/mgmt.packages
 
+# The modules required to be documented
+MGMT_MODULES = jdk.management
+
 mgmtdocs: $(MGMT_INDEX_FILE)
 
 # Set relative location to core api document root
@@ -990,7 +1065,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:none) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(MGMT_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
 	  $(call OptionPair,-overview,$(MGMT_OVERVIEW)) ; \
@@ -1025,6 +1102,9 @@
 ATTACH_OPTIONS_FILE = $(DOCSTMPDIR)/attach.options
 ATTACH_PACKAGES_FILE = $(DOCSTMPDIR)/attach.packages
 
+# The modules required to be documented
+ATTACH_MODULES = jdk.attach
+
 attachdocs: $(ATTACH_INDEX_HTML)
 
 # Set relative location to core api document root
@@ -1043,7 +1123,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:none) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(ATTACH_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
 	  $(call OptionPair,-doctitle,$(ATTACH_DOCTITLE)) ; \
@@ -1077,6 +1159,9 @@
 JCONSOLE_OPTIONS_FILE = $(DOCSTMPDIR)/jconsole.options
 JCONSOLE_PACKAGES_FILE = $(DOCSTMPDIR)/jconsole.packages
 
+# The modules required to be documented
+JCONSOLE_MODULES = jdk.jconsole
+
 jconsoledocs: $(JCONSOLE_INDEX_HTML)
 
 # Set relative location to core api document root
@@ -1095,7 +1180,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:none) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(JCONSOLE_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
 	  $(call OptionPair,-doctitle,$(JCONSOLE_DOCTITLE)) ; \
@@ -1131,6 +1218,9 @@
 TREEAPI_OPTIONS_FILE = $(DOCSTMPDIR)/treeapi.options
 TREEAPI_PACKAGES_FILE = $(DOCSTMPDIR)/treeapi.packages
 
+# The modules required to be documented
+TREEAPI_MODULES = jdk.compiler
+
 treeapidocs: $(TREEAPI_INDEX_HTML)
 
 # Set relative location to core api document root
@@ -1149,7 +1239,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:all) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(TREEAPI_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionPair,-doctitle,$(TREEAPI_DOCTITLE)) ; \
 	  $(call OptionPair,-windowtitle,$(TREEAPI_WINDOWTITLE) $(DRAFT_WINTITLE)); \
@@ -1185,6 +1277,9 @@
 NASHORNAPI_OPTIONS_FILE = $(DOCSTMPDIR)/nashornapi.options
 NASHORNAPI_PACKAGES_FILE = $(DOCSTMPDIR)/nashornapi.packages
 
+# The modules required to be documented
+NASHORNAPI_MODULES = jdk.scripting.nashorn
+
 nashornapidocs: $(NASHORNAPI_INDEX_HTML)
 
 # Set relative location to core api document root
@@ -1203,7 +1298,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:all) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(NASHORNAPI_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionPair,-doctitle,$(NASHORNAPI_DOCTITLE)) ; \
 	  $(call OptionPair,-windowtitle,$(NASHORNAPI_WINDOWTITLE) $(DRAFT_WINTITLE)); \
@@ -1239,6 +1336,9 @@
 DYNALINKAPI_OPTIONS_FILE = $(DOCSTMPDIR)/dynalinkapi.options
 DYNALINKAPI_PACKAGES_FILE = $(DOCSTMPDIR)/dynalinkapi.packages
 
+# The modules required to be documented
+DYNALINKAPI_MODULES = jdk.dynalink
+
 dynalinkapidocs: $(DYNALINKAPI_INDEX_HTML)
 
 # Set relative location to core api document root
@@ -1257,7 +1357,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:all) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(DYNALINKAPI_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionPair,-doctitle,$(DYNALINKAPI_DOCTITLE)) ; \
 	  $(call OptionPair,-windowtitle,$(DYNALINKAPI_WINDOWTITLE) $(DRAFT_WINTITLE)); \
@@ -1291,6 +1393,9 @@
 SCTPAPI_OPTIONS_FILE = $(DOCSTMPDIR)/sctp.options
 SCTPAPI_PACKAGES_FILE = $(DOCSTMPDIR)/sctp.packages
 
+# The modules required to be documented
+SCTPAPI_MODULES = jdk.sctp
+
 sctpdocs: $(SCTPAPI_INDEX_HTML)
 
 # Set relative location to core api document root
@@ -1309,7 +1414,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:none) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(SCTPAPI_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
 	  $(call OptionPair,-doctitle,$(SCTPAPI_DOCTITLE)) ; \
@@ -1343,6 +1450,9 @@
 JACCESSAPI_OPTIONS_FILE = $(DOCSTMPDIR)/jaccess.options
 JACCESSAPI_PACKAGES_FILE = $(DOCSTMPDIR)/jaccess.packages
 
+# The modules required to be documented
+JACCESSAPI_MODULES = jdk.accessibility
+
 jaccessdocs: $(JACCESSAPI_INDEX_HTML)
 
 # Set relative location to core api document root
@@ -1361,7 +1471,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
 	  $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:all) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(JACCESSAPI_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
 	  $(call OptionPair,-doctitle,$(JACCESSAPI_DOCTITLE)) ; \
@@ -1395,6 +1507,9 @@
 JDKNET_OPTIONS_FILE = $(DOCSTMPDIR)/jdknet.options
 JDKNET_PACKAGES_FILE = $(DOCSTMPDIR)/jdknet.packages
 
+# The modules required to be documented
+JDKNET_MODULES = java.base
+
 jdknetdocs: $(JDKNET_INDEX_HTML)
 
 # Set relative location to core api document root
@@ -1413,7 +1528,9 @@
 	@($(call COMMON_JAVADOCFLAGS) ; \
           $(call COMMON_JAVADOCTAGS) ; \
 	  $(call OptionOnly,-Xdoclint:none) ; \
-	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(JDKNET_MODULES)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nodeprecatedlist) ; \
 	  $(call OptionPair,-doctitle,$(JDKNET_DOCTITLE)) ; \
@@ -1428,6 +1545,69 @@
 	$(prep-target)
 	$(call PackageFilter,$(JDKNET_PKGS))
 
+#############################################################
+#
+# jlink plugin API docs
+#
+# TODO: Need to decide when the plugin API is ready to publish as experimental API.
+# This target is temporarily added for internal use for now.
+#        
+
+ALL_OTHER_TARGETS += jlinkdocs
+
+JLINK_PLUGIN_FIRST_COPYRIGHT_YEAR = 2015
+JLINK_PLUGIN_DOCDIR := $(JDK_API_DOCSDIR)/jlink
+JLINK_PLUGIN2COREAPI := ../$(JDKJRE2COREAPI)
+JLINK_PLUGIN_DOCTITLE := JLink Plugin API - EXPERIMENTAL
+JLINK_PLUGIN_WINDOWTITLE := JLink Plugin API - EXPERIMENTAL
+JLINK_PLUGIN_HEADER := <strong>JLink Plugin API - EXPERIMENTAL</strong>
+JLINK_PLUGIN_BOTTOM := $(call CommonBottom,$(JLINK_PLUGIN_FIRST_COPYRIGHT_YEAR))
+JLINK_PLUGIN_PKGS = jdk.tools.jlink \
+    jdk.tools.jlink.builder \
+    jdk.tools.jlink.plugin
+
+JLINK_PLUGIN_INDEX_HTML = $(JLINK_PLUGIN_DOCDIR)/index.html
+JLINK_PLUGIN_OPTIONS_FILE = $(DOCSTMPDIR)/jlinkplugins.options
+JLINK_PLUGIN_PACKAGES_FILE = $(DOCSTMPDIR)/jlinkplugins.packages
+
+# The modules required to be documented
+JLINK_PLUGIN_MODULES = jdk.jlink
+
+jlinkdocs: $(JLINK_PLUGIN_INDEX_HTML)
+
+# Set relative location to core api document root
+$(JLINK_PLUGIN_INDEX_HTML): GET2DOCSDIR=$(JLINK_PLUGIN2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(JLINK_PLUGIN_INDEX_HTML): $(JLINK_PLUGIN_OPTIONS_FILE) $(JLINK_PLUGIN_PACKAGES_FILE) $(COREAPI_INDEX_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(JLINK_PLUGIN_OPTIONS_FILE),$(JLINK_PLUGIN_PACKAGES_FILE))
+	$(JAVADOC_CMD_SMALL) -d $(@D) \
+	    @$(JLINK_PLUGIN_OPTIONS_FILE) @$(JLINK_PLUGIN_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(JLINK_PLUGIN_OPTIONS_FILE):
+	$(prep-target)
+	@($(call COMMON_JAVADOCFLAGS) ; \
+          $(call COMMON_JAVADOCTAGS) ; \
+	  $(call OptionOnly,-Xdoclint:none) ; \
+          $(call OptionPair,-system,none) ; \
+	  $(call OptionPair,-modulesourcepath,$(RELEASEDOCS_MODULESOURCEPATH)) ; \
+	  $(call OptionPair,-addmods,$(JLINK_PLUGIN_MODULES)) ; \
+	  $(call OptionPair,-encoding,ascii) ; \
+	  $(call OptionOnly,-nodeprecatedlist) ; \
+	  $(call OptionPair,-doctitle,$(JLINK_PLUGIN_DOCTITLE)) ; \
+	  $(call OptionPair,-windowtitle,$(JLINK_PLUGIN_WINDOWTITLE) $(DRAFT_WINTITLE)); \
+	  $(call OptionPair,-header,$(JLINK_PLUGIN_HEADER)$(DRAFT_HEADER)); \
+	  $(call OptionPair,-bottom,$(JLINK_PLUGIN_BOTTOM)$(DRAFT_BOTTOM)); \
+	  $(call OptionTrip,-linkoffline,$(JLINK_PLUGIN2COREAPI),$(COREAPI_DOCSDIR)/); \
+	) >> $@
+
+# Create a file with the package names in it
+$(JLINK_PLUGIN_PACKAGES_FILE): $(call PackageDependencies,$(JLINK_PLUGIN_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(JLINK_PLUGIN_PKGS))
+
 
 otherdocs: $(ALL_OTHER_TARGETS)
 
--- a/make/Jprt.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/Jprt.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -36,6 +36,10 @@
     override JPRT_ARCHIVE_INSTALL_BUNDLE := \
         $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_INSTALL_BUNDLE))
   endif
+  ifdef JPRT_ARCHIVE_MODULES_BUNDLE
+    override JPRT_ARCHIVE_MODULES_BUNDLE := \
+        $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_MODULES_BUNDLE))
+  endif
   ifdef JPRT_ARCHIVE_TEST_BUNDLE
     override JPRT_ARCHIVE_TEST_BUNDLE := \
         $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_TEST_BUNDLE))
@@ -54,6 +58,9 @@
 ifndef JPRT_ARCHIVE_INSTALL_BUNDLE
   JPRT_ARCHIVE_INSTALL_BUNDLE=/tmp/jprt_bundles/product-install.zip
 endif
+ifndef JPRT_ARCHIVE_MODULES_BUNDLE
+  JPRT_ARCHIVE_MODULES_BUNDLE=/tmp/jprt_bundles/modules.zip
+endif
 ifndef JPRT_ARCHIVE_TEST_BUNDLE
   JPRT_ARCHIVE_TEST_BUNDLE=/tmp/jprt_bundles/test-image.zip
 endif
@@ -66,7 +73,8 @@
 endif
 
 # This target must be called in the context of a SPEC file
-jprt_bundle: $(JPRT_ARCHIVE_BUNDLE) $(JPRT_ARCHIVE_TEST_BUNDLE)
+jprt_bundle: $(JPRT_ARCHIVE_BUNDLE) $(JPRT_ARCHIVE_TEST_BUNDLE) \
+    $(JPRT_ARCHIVE_MODULES_BUNDLE)
 
 ifeq ($(GCOV_ENABLED), true)
   jprt_bundle: $(JPRT_ARCHIVE_SYMBOLS_BUNDLE)
@@ -78,6 +86,11 @@
 	$(RM) $@
 	$(CP) $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip $@
 
+$(JPRT_ARCHIVE_MODULES_BUNDLE): bundles
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(CP) $(BUILD_OUTPUT)/bundles/modules.zip $@
+
 $(JPRT_ARCHIVE_TEST_BUNDLE): bundles
 	$(MKDIR) -p $(@D)
 	$(RM) $@
@@ -104,6 +117,8 @@
 	    $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip .
 	$(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIP) -y -q -r \
 	    $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip .
+	$(CD) $(IMAGES_OUTPUTDIR)/jmods && $(ZIP) -y -q -r \
+	    $(BUILD_OUTPUT)/bundles/modules.zip .
 	if [ -d $(BUILD_OUTPUT)/install/bundles ] ; then \
 	  $(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -y -q -r \
 	      $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \
--- a/make/JrtfsJar.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/JrtfsJar.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -28,6 +28,7 @@
 include $(SPEC)
 include MakeBase.gmk
 include JarArchive.gmk
+include SetupJavaCompilers.gmk
 include TextFileProcessing.gmk
 
 # This rule will be depended on due to the MANIFEST line
@@ -40,10 +41,32 @@
       @@COMPANY_NAME@@ => $(COMPANY_NAME) , \
 ))
 
-$(eval $(call SetupJarArchive, JRTFS_JAR, \
-    SRCS := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes, \
+JIMAGE_PKGS := \
+    jdk/internal/jimage \
+    jdk/internal/jrtfs \
+    #
+
+$(eval $(call SetupJavaCompilation,BUILD_JRTFS, \
+    SETUP := GENERATE_OLDBYTECODE, \
+    SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
+    EXCLUDE_FILES := module-info.java, \
+    INCLUDES := $(JIMAGE_PKGS), \
+    BIN := $(SUPPORT_OUTPUTDIR)/jrtfs_classes))
+
+# Because of the explicit INCLUDES in the compilation setup above, the service provider
+# file will not be copied unless META-INF/services would also be added to the INCLUDES.
+# Adding META-INF/services would include all files in that directory when only the one
+# is needed, which is why this explicit copy is defined instead.
+$(eval $(call SetupCopyFiles,COPY_JIMAGE_SERVICE_PROVIDER, \
+    SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
+    DEST := $(SUPPORT_OUTPUTDIR)/jrtfs_classes, \
+    FILES := META-INF/services/java.nio.file.spi.FileSystemProvider))
+
+$(eval $(call SetupJarArchive,BUILD_JRTFS_JAR, \
+    DEPENDENCIES := $(BUILD_JRTFS) $(COPY_JIMAGE_SERVICE_PROVIDER), \
+    SRCS := $(SUPPORT_OUTPUTDIR)/jrtfs_classes, \
     JAR := $(SUPPORT_OUTPUTDIR)/jrt-fs.jar, \
     MANIFEST := $(SUPPORT_OUTPUTDIR)/java-main-manifest.mf, \
 ))
 
-all: $(JRTFS_JAR)
+all: $(BUILD_JRTFS_JAR)
--- a/make/Main.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/Main.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -42,8 +42,6 @@
 
 # Load the vital tools for all the makefiles.
 include $(SRC_ROOT)/make/common/MakeBase.gmk
-# Explicitly generate module deps makefile data
-include $(SRC_ROOT)/make/GenerateModuleDeps.gmk
 include $(SRC_ROOT)/make/common/Modules.gmk
 
 # Declare ALL_TARGETS as an immediate variable. This variable is a list of all
@@ -113,6 +111,24 @@
 CORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
 HOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS))
 
+GENSRC_MODULEINFO_MODULES := $(ALL_MODULES)
+GENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \
+    $(GENSRC_MODULEINFO_MODULES))
+
+GENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES)
+GENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \
+    $(addsuffix -gensrc, $(GENSRC_MODULES)))
+
+define DeclareModuleInfoRecipe
+  $1-gensrc-moduleinfo:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
+	    -f GensrcModuleInfo.gmk MODULE=$1)
+
+  $1-gensrc: $1-gensrc-moduleinfo
+endef
+
+$(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
+
 ALL_TARGETS += $(GENSRC_TARGETS)
 
 ################################################################################
@@ -136,11 +152,27 @@
     USE_WRAPPER := true, \
     MULTIPLE_MAKEFILES := true))
 
-ALL_TARGETS += $(COPY_TARGETS)
+ALL_COPY_MODULES += $(COPY_MODULES)
+ALL_COPY_TARGETS += $(COPY_TARGETS)
+
+IMPORT_COPY_MODULES := $(call FindImportedModules)
+IMPORT_COPY_TARGETS := $(addsuffix -copy, $(IMPORT_COPY_MODULES))
+ALL_COPY_MODULES += $(IMPORT_COPY_MODULES)
+ALL_COPY_TARGETS += $(IMPORT_COPY_TARGETS)
+
+define DeclareImportCopyRecipe
+  $1-copy:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
+	    -f CopyImportModules.gmk MODULE=$1)
+endef
+
+$(foreach m, $(IMPORT_COPY_MODULES), $(eval $(call DeclareImportCopyRecipe,$m)))
+
+ALL_TARGETS += $(ALL_COPY_TARGETS)
 
 ################################################################################
 # Targets for compiling all java modules. Nashorn is treated separately.
-JAVA_MODULES := $(call FindJavaModules)
+JAVA_MODULES := $(ALL_MODULES)
 JAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
 
 define DeclareCompileJavaRecipe
@@ -214,7 +246,48 @@
 ALL_TARGETS += demos-jdk samples-jdk
 
 ################################################################################
-# Image targets
+# Jigsaw specific data and analysis targets.
+
+generate-summary:
+	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) -f GenerateModuleSummary.gmk)
+
+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)
+JMOD_TARGETS := $(addsuffix -jmod, $(JMOD_MODULES))
+
+define DeclareJmodRecipe
+  $1-jmod:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateJmods.gmk \
+	    MODULE=$1)
+endef
+
+$(foreach m, $(JMOD_MODULES), $(eval $(call DeclareJmodRecipe,$m)))
+
+ALL_TARGETS += $(JMOD_TARGETS)
+
+################################################################################
+# Images targets
 
 # Stores the tips for each repository. This file is be used when constructing the jdk image and can be
 # used to track the exact sources used to build that image.
@@ -236,9 +309,6 @@
 zip-source:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
 
-strip-binaries:
-	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk)
-
 jrtfs-jar:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
 
@@ -251,7 +321,7 @@
 mac-bundles-jdk:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
 
-ALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
+ALL_TARGETS += source-tips bootcycle-images zip-security zip-source \
     jrtfs-jar jimages profiles mac-bundles-jdk
 
 ################################################################################
@@ -266,6 +336,28 @@
 ALL_TARGETS += docs-javadoc docs-jvmtidoc
 
 ################################################################################
+# Cross compilation support
+
+ifeq ($(CREATE_BUILDJDK), true)
+  # This target is only called by the recursive call below.
+  create-buildjdk-compile-hotspot-helper: hotspot
+  create-buildjdk-compile-modules-helper: jdk.jlink-launchers java.base-copy
+endif
+
+create-buildjdk-copy:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateBuildJdkCopy.gmk)
+
+create-buildjdk-compile-hotspot create-buildjdk-compile-modules:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk \
+	    $@-helper \
+	    SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
+	    HOTSPOT_SPEC=$(dir $(SPEC))buildjdk-spec.gmk \
+	    CREATING_BUILDJDK=true)
+
+ALL_TARGETS += create-buildjdk-copy create-buildjdk-compile-hotspot \
+    create-buildjdk-compile-modules
+
+################################################################################
 # Build tests
 #
 
@@ -322,16 +414,6 @@
     test-hotspot-internal test-jdk-jtreg-native test-make
 
 ################################################################################
-# Verification targets
-
-verify-modules:
-	@$(call TargetEnter)
-	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CheckModules.gmk)
-	@$(call TargetExit)
-
-ALL_TARGETS += verify-modules
-
-################################################################################
 # Install targets
 
 install:
@@ -370,6 +452,8 @@
 
   $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
 
+  $(GENSRC_MODULEINFO_TARGETS): buildtools-jdk
+
   $(GENDATA_TARGETS): interim-langtools buildtools-jdk
 
   interim-rmic: interim-langtools
@@ -407,8 +491,11 @@
   $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
 
   # Declare dependencies from <module>-lib to <module>-java
-  # Skip modules that do not have java source.
+  # Skip modules that do not have java source. When creating a BUILD_JDK, the
+  # java compilation has already been done by the normal build and copied in.
+  ifneq ($(CREATING_BUILDJDK), true)
   $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs: $m-java))
+  endif
 
   # Declare dependencies from all other <module>-lib to java.base-lib
   $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
@@ -438,31 +525,57 @@
 
   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
+  $(foreach m, $(JMOD_MODULES), \
+      $(eval $m-jmod: $(addsuffix -jmod, $(call FindDepsForModule,$m))))
+
+  # Declare dependencies from <module>-jmod to all other module targets
+  $(foreach m, $(STRIP_MODULES), $(eval $m-jmod: $m-strip))
+  $(foreach m, $(JAVA_MODULES), $(eval $m-jmod: $m-java))
+  $(foreach m, $(GENDATA_MODULES), $(eval $m-jmod: $m-gendata))
+  $(foreach m, $(RMIC_MODULES), $(eval $m-jmod: $m-rmic))
+  $(foreach m, $(LIBS_MODULES), $(eval $m-jmod: $m-libs))
+  $(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.
+  $(JMOD_TARGETS): java java.base-libs jdk.jlink-launchers
+
+  ifeq ($(CREATE_BUILDJDK), true)
+    $(JMOD_TARGETS): create-buildjdk
+  endif
+
   zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
       $(filter jdk.crypto%, $(JAVA_TARGETS))
 
   zip-source: gensrc rmic
 
-  strip-binaries: libs launchers gendata copy
-
-  jrtfs-jar: buildtools-jdk
+  jrtfs-jar: interim-langtools
 
-  jimages: exploded-image zip-source strip-binaries source-tips demos samples \
-      jrtfs-jar
+  jimages: jmods zip-source source-tips demos samples jrtfs-jar
 
-  profiles: exploded-image strip-binaries source-tips
+  profiles: jmods zip-source source-tips jrtfs-jar
 
   mac-bundles-jdk: jimages
 
   bootcycle-images: jimages
 
-  docs-javadoc: gensrc rmic
+  docs-javadoc: $(GENSRC_TARGETS) rmic
 
   docs-jvmtidoc: hotspot
 
   test: jimages test-image
 
-  verify-modules: exploded-image
+  create-buildjdk-copy: jdk.jlink-java java.base-gendata
+
+  create-buildjdk-compile-modules: create-buildjdk-copy create-buildjdk-compile-hotspot
 
   test-make: clean-test-make
 
@@ -482,6 +595,8 @@
 
   install: product-images
 
+  generate-summary: jmods
+
 endif
 
 ################################################################################
@@ -494,7 +609,7 @@
 
 gendata: $(GENDATA_TARGETS)
 
-copy: $(COPY_TARGETS)
+copy: $(ALL_COPY_TARGETS)
 
 java: $(JAVA_TARGETS)
 
@@ -504,6 +619,10 @@
 
 launchers: $(LAUNCHER_TARGETS)
 
+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
@@ -516,8 +635,7 @@
 $(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
 $(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
 $(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
-$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
-
+$(foreach m, $(ALL_COPY_MODULES), $(eval $m: $m-copy))
 demos: demos-jdk
 
 samples: samples-jdk
@@ -525,6 +643,9 @@
 # The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
 exploded-image: $(ALL_MODULES)
 
+create-buildjdk: create-buildjdk-compile-modules create-buildjdk-copy \
+    create-buildjdk-compile-hotspot
+
 mac-bundles: mac-bundles-jdk
 
 # The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
@@ -532,7 +653,13 @@
 
 # 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 verify-modules
+product-images: jimages demos samples zip-security exploded-image
+
+# When cross compiling and building a partial BUILDJDK for the build host,
+# the summary generation cannot be run.
+ifneq ($(CREATE_BUILDJDK), true)
+  product-images: generate-summary
+endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
   product-images: mac-bundles
@@ -548,9 +675,9 @@
 # all-images is the top-most target, it builds all our deliverables ("images").
 all-images: product-images test-image docs-image
 
-ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
+ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers jmods \
     jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples exploded-image \
-    mac-bundles product-images docs-image test-image all-images
+    create-buildjdk mac-bundles product-images docs-image test-image all-images
 
 ################################################################################
 
@@ -575,7 +702,7 @@
 # file.
 
 CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
-    images make-support test-make bundles
+    images make-support test-make bundles buildjdk
 CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
 CLEAN_SUPPORT_DIRS += demos
 CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
--- a/make/MainSupport.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/MainSupport.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -67,7 +67,6 @@
 	@$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..."
 	@$(PRINTF) "\n" $(LOG_DEBUG)
 	$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)
-	$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1)
 	@$(PRINTF) " done\n"
 endef
 
--- a/make/StripBinaries.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/StripBinaries.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -57,25 +57,29 @@
 NO_STRIP_CMDS_FILTER += %.cgi
 
 # Don't include debug info for executables.
-
-# 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 \( -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))
+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
 
-# 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 \
+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 -type f -o -type l))
+
+  # 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, \
--- a/make/common/CORE_PKGS.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/common/CORE_PKGS.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2015, 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
@@ -99,6 +99,7 @@
     java.lang.instrument \
     java.lang.invoke \
     java.lang.management \
+    java.lang.module \
     java.lang.ref \
     java.lang.reflect \
     java.math \
--- a/make/common/JavaCompilation.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/common/JavaCompilation.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -75,13 +75,13 @@
   ifneq ($$($1_COPY_$$($2_TARGET)), 1)
     $1_COPY_$$($2_TARGET) := 1
     # Now we can setup the dependency that will trigger the copying.
-    $$($1_BIN)$$($2_TARGET) : $2
+    $$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET) : $2
 	$(MKDIR) -p $$(@D)
 	$(CP) $$< $$@
 	$(CHMOD) -f ug+w $$@
 
     # And do not forget this target
-    $1_ALL_COPY_TARGETS += $$($1_BIN)$$($2_TARGET)
+    $1_ALL_COPY_TARGETS += $$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET)
   endif
 endef
 
@@ -133,7 +133,7 @@
 	$(CHMOD) -f ug+w $$@
 
     # And do not forget this target
-    $1_ALL_COPY_CLEAN_TARGETS += $$($1_BIN)$$($2_TARGET)
+    $1_ALL_COPY_CLEAN_TARGETS += $$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET)
   endif
 endef
 
@@ -154,6 +154,7 @@
 #   SRC:=one or more directories to search for sources. The order of the source roots
 #        is significant. The first found file of a certain name has priority.
 #   BIN:=store classes here
+#   MODULE:=Name of module being compiled. If set, classes are put in BIN/MODULE.
 #   CLASSPATH:=a list of additional entries to set as classpath to javac
 #   INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages.
 #   EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages.
@@ -190,6 +191,10 @@
   $1_SJAVAC_PORTFILE := $$($$($1_SETUP)_SJAVAC_PORTFILE)
   $1_SERVER_JVM := $$($$($1_SETUP)_SERVER_JVM)
   $1_DISABLE_SJAVAC := $$($$($1_SETUP)_DISABLE_SJAVAC)
+ 
+  ifneq ($$($1_MODULE), )
+    $1_MODULE_SUBDIR := /$$($1_MODULE)
+  endif
 
   # Make sure the dirs exist.
   $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupJavaCompilation $1 contains missing directory >$$d<)))
@@ -303,7 +308,7 @@
   $1_REMOTE:=--server:portfile=$$($1_SJAVAC_PORTFILE),id=$1,sjavac=$$(subst \
       $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_SJAVAC))))
 
-  $1_COMPILE_TARGET := $$($1_BIN)/_the.$1_batch
+  $1_COMPILE_TARGET := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_batch
 
   ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes)
     # Using sjavac to compile.
@@ -336,7 +341,8 @@
     $1_VARDEPS := $$($1_JVM) $$($1_SJAVAC) $$($1_SJAVAC_ARGS_STRING) $$($1_FLAGS) \
         $$($1_HEADERS_ARG) $$($1_BIN) $$($1_EXCLUDES) $$($1_INCLUDES) \
         $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
-    $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_BIN)/_the.$1.vardeps)
+    $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
+        $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.vardeps)
 
     $$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE)
 	$$(call MakeDir, $$(@D) $$(dir $$($1_SJAVAC_PORTFILE)))
@@ -345,7 +351,7 @@
 	  $$(eval $$(call ListPathsSafely,$1_SJAVAC_ARGS_STRING, $$($1_SJAVAC_ARGS_FILE)))
         endif
 	$$(call LogWarn, Compiling $1)
-	$$(call ExecuteWithLog, $$($1_BIN)/_the.$$($1_SAFE_NAME)_batch, \
+	$$(call ExecuteWithLog, $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)_batch, \
 	    $$($1_JVM) $$($1_SJAVAC) \
 	        $$($1_REMOTE) \
 	        -j 1 \
@@ -353,7 +359,7 @@
 	        --permit-sources-without-package \
 	        --compare-found-sources $$@.tmp \
 	        --log=$(LOG_LEVEL) \
-	        --state-dir=$$($1_BIN) \
+	        --state-dir=$$($1_BIN)$$($1_MODULE_SUBDIR) \
 	        $$($1_SJAVAC_ARGS) \
 	        $$($1_FLAGS) \
 	        $$($1_HEADERS_ARG) \
@@ -362,11 +368,13 @@
         # Create a pubapi file that only changes when the pubapi changes. Dependent
         # compilations can use this file to only get recompiled when pubapi has changed.
         # Grep returns 1 if no matching lines are found. Do not fail for this.
-	$(GREP) -e "^I" $$($1_BIN)/javac_state > $$($1_BIN)/_the.$1_pubapi.tmp \
+	$(GREP) -e "^I" $$($1_BIN)$$($1_MODULE_SUBDIR)/javac_state > $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp \
 	    || test "$$$$?" = "1"
-	if [ ! -f $$($1_BIN)/_the.$1_pubapi ] \
-	    || [ "`$(DIFF) $$($1_BIN)/_the.$1_pubapi $$($1_BIN)/_the.$1_pubapi.tmp`" != "" ]; then \
-	  $(MV) $$($1_BIN)/_the.$1_pubapi.tmp $$($1_BIN)/_the.$1_pubapi; \
+	if [ ! -f $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi ] \
+	    || [ "`$(DIFF) $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi \
+	        $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp`" != "" ]; then \
+	  $(MV) $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp \
+	      $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi; \
 	fi
 
   else
@@ -380,11 +388,12 @@
       $$($1_HEADERS)/_the.$1_headers: $$($1_COMPILE_TARGET)
 		$(MKDIR) -p $$(@D)
 		if [ -d "$$($1_HEADERS).$1.tmp" ]; then \
-		  for f in `ls $$($1_HEADERS).$1.tmp`; do \
+		  for f in `$(CD) $$($1_HEADERS).$1.tmp && $(FIND) . -type f`; do \
 		    if [ ! -f "$$($1_HEADERS)/$$$$f" ] \
 		        || [ "`$(DIFF) $$($1_HEADERS)/$$$$f $$($1_HEADERS).$1.tmp/$$$$f`" != "" ]; then \
-		    $(CP) -f $$($1_HEADERS).$1.tmp/$$$$f $$($1_HEADERS)/$$$$f; \
-		  fi; \
+		      $(MKDIR) -p `$(DIRNAME) $$($1_HEADERS)/$$$$f`; \
+		      $(CP) -f $$($1_HEADERS).$1.tmp/$$$$f $$($1_HEADERS)/$$$$f; \
+		    fi; \
 		  done; \
 		fi
 		$(RM) -r $$($1_HEADERS).$1.tmp
@@ -396,7 +405,8 @@
     $1_VARDEPS := $$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) $$($1_BIN) \
         $$($1_HEADERS_ARG) $$($1_EXCLUDES) $$($1_INCLUDES) \
         $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
-    $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_BIN)/_the.$1.vardeps)
+    $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
+        $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.vardeps)
 
     ifeq ($$($1_DISABLE_SJAVAC)x$(ENABLE_JAVAC_SERVER), xyes)
       $1_JAVAC_CMD := $$($1_SJAVAC) $$($1_REMOTE)
@@ -409,7 +419,7 @@
 	$$(call MakeDir, $$(@D))
 	$$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp))
 	$$(call LogWarn, Compiling $$(words $$($1_SRCS)) files for $1)
-	$$(call ExecuteWithLog, $$($1_BIN)/_the.$$($1_SAFE_NAME)_batch, \
+	$$(call ExecuteWithLog, $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)_batch, \
 	    $$($1_JVM) $$($1_JAVAC_CMD) $$($1_FLAGS) \
 	        -implicit:none \
 		-d $$($1_BIN) $$($1_HEADERS_ARG) @$$@.tmp) && \
@@ -431,7 +441,7 @@
 
     $$(eval $$(call SetupJarArchive, ARCHIVE_$1, \
         DEPENDENCIES:=$$($1), \
-        SRCS:=$$($1_BIN), \
+        SRCS:=$$($1_BIN)$$($1_MODULE_SUBDIR), \
         SUFFIXES:=$$($1_SUFFIXES), \
         EXCLUDE:=$$($1_EXCLUDES), \
         INCLUDES:=$$($1_INCLUDES), \
--- a/make/common/MakeBase.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/common/MakeBase.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -247,7 +247,7 @@
             $(HG_SEARCH:%/REPO=%/$(HGTIP_FILENAME)) \
         2> /dev/null)))))
 
-# Emit the repo:tip pairs to $@
+# Emit the repo:tip pairs to $@, but only if they changed since last time
 define GetSourceTips
 	$(CD) $(SRC_ROOT) ; \
 	for i in $(REPO_LIST) IGNORE ; do \
@@ -260,8 +260,13 @@
 	    $(PRINTF) " %s:%s" \
 	        "$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \
 	  fi; \
-	done >> $@
-	$(PRINTF) "\n" >> $@
+	done > $@.tmp
+	$(PRINTF) "\n" >> $@.tmp
+	if [ ! -f $@ ] || [ "`$(CAT) $@`" != "`$(CAT) $@.tmp`" ]; then \
+	  $(MV) $@.tmp $@ ; \
+	else \
+	  $(RM) $@.tmp ; \
+	fi
 endef
 
 # Create the HGTIP_FILENAME file. Called from closed/make/SourceBundles.gmk
@@ -644,10 +649,10 @@
 
 # Defines the sub directory structure to store variable value file in
 DependOnVariableDirName = \
-    $(strip $(subst $(SRC_ROOT)/,,\
-        $(if $(filter /%, $(firstword $(MAKEFILE_LIST))), \
+    $(strip $(addsuffix $(if $(MODULE),/$(MODULE)), \
+        $(subst $(SRC_ROOT)/,, $(if $(filter /%, $(firstword $(MAKEFILE_LIST))), \
           $(firstword $(MAKEFILE_LIST)), \
-          $(CURDIR)/$(firstword $(MAKEFILE_LIST)))))
+          $(CURDIR)/$(firstword $(MAKEFILE_LIST))))))
 
 # Defines the name of the file to store variable value in. Generates a name
 # unless parameter 2 is given.
--- a/make/common/Modules.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/common/Modules.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -26,6 +26,9 @@
 ifndef _MODULES_GMK
 _MODULES_GMK := 1
 
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, , common/Modules.gmk))
+
 ################################################################################
 # Some platforms don't have the serviceability agent
 ifeq ($(INCLUDE_SA), false)
@@ -35,7 +38,9 @@
 ################################################################################
 # Module list macros
 
-ALL_TOP_SRC_DIRS := \
+# Use append so that the custom extension may add to this variable
+
+ALL_TOP_SRC_DIRS += \
     $(HOTSPOT_TOPDIR)/src \
     $(JDK_TOPDIR)/src \
     $(LANGTOOLS_TOPDIR)/src \
@@ -45,37 +50,74 @@
     $(NASHORN_TOPDIR)/src \
     #
 
-# Find all modules with java sources by looking in the source dirs
-define FindJavaModules
-  $(filter-out $(MODULES_FILTER), $(sort $(notdir \
-      $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir \
-      $(wildcard $(patsubst %,%/*/share/classes/*, $(ALL_TOP_SRC_DIRS)) \
-          $(patsubst %,%/*/$(OPENJDK_TARGET_OS)/classes/*, $(ALL_TOP_SRC_DIRS)) \
-          $(patsubst %,%/*/$(OPENJDK_TARGET_OS_TYPE)/classes/*, $(ALL_TOP_SRC_DIRS))))))))))))
-endef
+# Find all module-info.java files for the current build target platform and
+# configuration.
+# Param 1 - Module to find for, set to * for finding all
+FindAllModuleInfos = \
+    $(wildcard \
+        $(patsubst %,%/$(strip $1)/$(OPENJDK_TARGET_OS)/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \
+        $(patsubst %,%/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \
+        $(patsubst %,%/$(strip $1)/share/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \
+        $(patsubst %,%/$(strip $1)/module-info.java, $(IMPORT_MODULES_SRC)))
 
-# Find all modules with source for the target platform.
-define FindAllModules
-  $(sort $(filter-out $(MODULES_FILTER) closed demo sample, \
-      $(notdir $(patsubst %/,%, $(dir \
-      $(wildcard $(patsubst %, %/*/share, $(ALL_TOP_SRC_DIRS)) \
-      $(patsubst %, %/*/$(OPENJDK_TARGET_OS), $(ALL_TOP_SRC_DIRS)) \
-      $(patsubst %, %/*/$(OPENJDK_TARGET_OS_TYPE), $(ALL_TOP_SRC_DIRS))))))))
-endef
+# Extract the module names from the paths of module-info.java files. The
+# position of the module directory differs depending on if this is an imported
+# src dir or not.
+GetModuleNameFromModuleInfo = \
+    $(strip $(foreach mi, $1, \
+      $(if $(filter $(addsuffix %, $(IMPORT_MODULES_SRC)), $(mi)), \
+        $(notdir $(patsubst %/,%, $(dir $(mi)))), \
+        $(notdir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(mi)))))))))))
+
+# Find all modules by looking for module-info.java files and looking at parent
+# directories.
+FindAllModules = \
+    $(sort $(filter-out $(MODULES_FILTER), \
+    $(call GetModuleNameFromModuleInfo, $(MODULE_INFOS))))
+
+FindImportedModules = \
+    $(if $(IMPORT_MODULES_CLASSES), $(notdir $(wildcard $(IMPORT_MODULES_CLASSES)/*)))
 
 ################################################################################
-# The module deps makefile is generated in make/GenerateModuleDeps.gmk
+# Extract module dependencies from module-info.java files.
+
 MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
+
+MODULE_INFOS := $(call FindAllModuleInfos, *)
+
+$(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
+    $(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(foreach m, $(MODULE_INFOS), \
+	    ( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \
+	      $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
+	          BEGIN      { if (MODULE != "java.base") printf(" java.base"); } \
+	          /requires/ { sub(/;/, ""); \
+	                       sub(/requires/, ""); \
+	                       sub(/public/, ""); \
+	                       sub(/\/\/.*/, ""); \
+	                       sub(/\/\*.*\*\//, ""); \
+	                       gsub(/ /, ""); \
+	                       printf(" %s", $$0) } \
+	          END        { printf("\n") }' $m \
+	    ) >> $@ $(NEWLINE))
+
 -include $(MODULE_DEPS_MAKEFILE)
 
 # Param 1: Module to find deps for
-define FindDepsForModule
+FindDepsForModule = \
   $(DEPS_$(strip $1))
-endef
+
+# Finds transitive dependencies in 3 levels.
+# Param 1: Module to find transitive deps for
+FindTransitiveDepsForModule = \
+    $(sort $(call FindDepsForModule, $1) \
+        $(foreach m, $(call FindDepsForModule, $1), \
+            $(call FindDepsForModule, $m) \
+            $(foreach n, $(call FindDepsForModule, $m), \
+                 $(call FindDepsForModule, $n))))
 
 ################################################################################
 
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , common/Modules.gmk))
-
 endif # _MODULES_GMK
--- a/make/common/NativeCompilation.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/common/NativeCompilation.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -74,6 +74,7 @@
 #   AS - Assembler
 #   MT - Windows MT tool
 #   RC - Windows RC tool
+#   OBJCOPY - The objcopy tool for debug symbol handling
 #   STRIP - The tool to use for stripping debug symbols
 #   SYSROOT_CFLAGS - Compiler flags for using the specific sysroot
 #   SYSROOT_LDFLAGS - Linker flags for using the specific sysroot
@@ -90,6 +91,7 @@
     $$(call SetIfEmpty, $1_AS, $$($$($1_EXTENDS)_AS))
     $$(call SetIfEmpty, $1_MT, $$($$($1_EXTENDS)_MT))
     $$(call SetIfEmpty, $1_RC, $$($$($1_EXTENDS)_RC))
+    $$(call SetIfEmpty, $1_OBJCOPY, $$($$($1_EXTENDS)_OBJCOPY))
     $$(call SetIfEmpty, $1_STRIP, $$($$($1_EXTENDS)_STRIP))
     $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_EXTENDS)_SYSROOT_CFLAGS))
     $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_EXTENDS)_SYSROOT_LDFLAGS))
@@ -105,6 +107,7 @@
     AS := $(AS), \
     MT := $(MT), \
     RC := $(RC), \
+    OBJCOPY := $(OBJCOPY), \
     STRIP := $(STRIP), \
     SYSROOT_CFLAGS := $(SYSROOT_CFLAGS), \
     SYSROOT_LDFLAGS := $(SYSROOT_LDFLAGS), \
@@ -118,13 +121,14 @@
 
 # Create a toolchain with the BUILD compiler, used for build tools that
 # are to be run during the build.
-# The BUILD_SYSROOT_*FLAGS variables are empty for now.
 $(eval $(call DefineNativeToolchain, TOOLCHAIN_BUILD, \
     CC := $(BUILD_CC), \
     CXX := $(BUILD_CXX), \
     LD := $(BUILD_LD), \
     AR := $(BUILD_AR), \
     AS := $(BUILD_AS), \
+    OBJCOPY := $(BUILD_OBJCOPY), \
+    STRIP := $(BUILD_STRIP), \
     SYSROOT_CFLAGS := $(BUILD_SYSROOT_CFLAGS), \
     SYSROOT_LDFLAGS := $(BUILD_SYSROOT_LDFLAGS), \
 ))
@@ -437,6 +441,7 @@
   $$(call SetIfEmpty, $1_AS, $$($$($1_TOOLCHAIN)_AS))
   $$(call SetIfEmpty, $1_MT, $$($$($1_TOOLCHAIN)_MT))
   $$(call SetIfEmpty, $1_RC, $$($$($1_TOOLCHAIN)_RC))
+  $$(call SetIfEmpty, $1_OBJCOPY, $$($$($1_TOOLCHAIN)_OBJCOPY))
   $$(call SetIfEmpty, $1_STRIP, $$($$($1_TOOLCHAIN)_STRIP))
   $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_CFLAGS))
   $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_LDFLAGS))
@@ -720,9 +725,9 @@
           # 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 := \
-              $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
-              $(CD) $$($1_OUTPUT_DIR) && \
-                  $(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
--- a/make/common/SetupJavaCompilers.gmk	Thu Mar 17 19:04:01 2016 +0000
+++ b/make/common/SetupJavaCompilers.gmk	Wed Jul 05 21:27:42 2017 +0200
@@ -38,7 +38,8 @@
 # and the interim javac, to be run by the boot jdk.
 $(eval $(call SetupJavaCompiler,BOOT_JAVAC, \
     JAVAC := $(JAVAC), \
-    FLAGS := -XDignore.symbol.file=true -g -Xlint:all$(COMMA)-deprecation -Werror, \
+    FLAGS := $(BOOT_JDK_SOURCETARGET) -XDignore.symbol.file=true -g \
+        -Xlint:all$(COMMA)-deprecation$(COMMA)-options -Werror, \
     DISABLE_SJAVAC := true, \
 ))
 
@@ -80,9 +81,6 @@
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
 
-JDK_BOOTCLASSPATH := $(call PathList, \
-    $(filter-out $(JDK_OUTPUTDIR)/modules/_%, $(wildcard $(JDK_OUTPUTDIR)/modules/*)))
-
 # After the jdk is built, we want to build demos using only the recently
 # generated jdk classes and nothing else, no jdk source, etc etc.
 # I.e. the rt.jar, but since rt.jar has not yet been generated
@@ -90,7 +88,7 @@
 $(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \
     JVM := $(JAVA_SMALL), \
     JAVAC := $(NEW_JAVAC), \
-    FLAGS := -bootclasspath $(JDK_BOOTCLASSPATH) $(DISABLE_WARNINGS), \
+    FLAGS := -upgrademodulepath $(JDK_OUTPUTDIR)/modules -system none $(DISABLE_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
 
--- a/modules.xml	Thu Mar 17 19:04:01 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2139 +0,0 @@
-<?xml version="1.0" encoding="us-ascii"?>
-
-<!--
-
-   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.
-
-  -->
-
-<!--
-
-   This document defines the modular structure of the JDK as described
-   in JEP 200: The Modular JDK (http://openjdk.java.net/jeps/200).
-
-   Changes to this file must be reviewed by a Project Jigsaw Committer
-   (http://openjdk.java.net/census#jigsaw).
-
-  -->
-
-<modules>
-  <module>
-    <name>java.activation</name>
-    <depend>java.base</depend>
-    <depend re-exports="true">java.datatransfer</depend>
-    <depend>java.desktop</depend>
-    <depend>java.logging</depend>
-    <export>
-      <name>javax.activation</name>
-    </export>
-  </module>
-  <module>
-    <name>java.annotations.common</name>
-    <depend>java.base</depend>
-    <export>
-      <name>javax.annotation</name>
-    </export>
-  </module>
-  <module>
-    <name>java.base</name>
-    <export>
-      <name>java.io</name>
-    </export>
-    <export>
-      <name>java.lang</name>
-    </export>
-    <export>
-      <name>java.lang.annotation</name>
-    </export>
-    <export>
-      <name>java.lang.invoke</name>
-    </export>
-    <export>
-      <name>java.lang.ref</name>
-    </export>
-    <export>
-      <name>java.lang.reflect</name>
-    </export>
-    <export>
-      <name>java.math</name>
-    </export>
-    <export>
-      <name>java.net</name>
-    </export>
-    <export>
-      <name>java.nio</name>
-    </export>
-    <export>
-      <name>java.nio.channels</name>
-    </export>
-    <export>
-      <name>java.nio.channels.spi</name>
-    </export>
-    <export>
-      <name>java.nio.charset</name>
-    </export>
-    <export>
-      <name>java.nio.charset.spi</name>
-    </export>
-    <export>
-      <name>java.nio.file</name>
-    </export>
-    <export>
-      <name>java.nio.file.attribute</name>
-    </export>
-    <export>
-      <name>java.nio.file.spi</name>
-    </export>
-    <export>
-      <name>java.security</name>
-    </export>
-    <export>
-      <name>java.security.acl</name>
-    </export>
-    <export>
-      <name>java.security.cert</name>
-    </export>
-    <export>
-      <name>java.security.interfaces</name>
-    </export>
-    <export>
-      <name>java.security.spec</name>
-    </export>
-    <export>
-      <name>java.text</name>
-    </export>
-    <export>
-      <name>java.text.spi</name>
-    </export>
-    <export>
-      <name>java.time</name>
-    </export>
-    <export>
-      <name>java.time.chrono</name>
-    </export>
-    <export>
-      <name>java.time.format</name>
-    </export>
-    <export>
-      <name>java.time.temporal</name>
-    </export>
-    <export>
-      <name>java.time.zone</name>
-    </export>
-    <export>
-      <name>java.util</name>
-    </export>
-    <export>
-      <name>java.util.concurrent</name>
-    </export>
-    <export>
-      <name>java.util.concurrent.atomic</name>
-    </export>
-    <export>
-      <name>java.util.concurrent.locks</name>
-    </export>
-    <export>
-      <name>java.util.function</name>
-    </export>
-    <export>
-      <name>java.util.jar</name>
-    </export>
-    <export>
-      <name>java.util.regex</name>
-    </export>
-    <export>
-      <name>java.util.spi</name>
-    </export>
-    <export>
-      <name>java.util.stream</name>
-    </export>
-    <export>
-      <name>java.util.zip</name>
-    </export>
-    <export>
-      <name>javax.crypto</name>
-    </export>
-    <export>
-      <name>javax.crypto.interfaces</name>
-    </export>
-    <export>
-      <name>javax.crypto.spec</name>
-    </export>
-    <export>
-      <name>javax.net</name>
-    </export>
-    <export>
-      <name>javax.net.ssl</name>
-    </export>
-    <export>
-      <name>javax.security.auth</name>
-    </export>
-    <export>
-      <name>javax.security.auth.callback</name>
-    </export>
-    <export>
-      <name>javax.security.auth.login</name>
-    </export>
-    <export>
-      <name>javax.security.auth.spi</name>
-    </export>
-    <export>
-      <name>javax.security.auth.x500</name>
-    </export>
-    <export>
-      <name>javax.security.cert</name>
-    </export>
-    <export>
-      <name>jdk</name>
-    </export>
-    <export>
-      <name>jdk.net</name>
-    </export>
-    <export>
-      <name>com.sun.security.ntlm</name>
-      <to>java.security.sasl</to>
-    </export>
-    <export>
-      <name>jdk.internal.jimage</name>
-      <to>jdk.dev</to>
-    </export>
-    <export>
-      <name>jdk.internal.jimage.decompressor</name>
-      <to>jdk.dev</to>
-    </export>
-    <export>
-      <name>jdk.internal.math</name>
-      <to>java.desktop</to>
-    </export>
-    <export>
-      <name>jdk.internal.misc</name>
-      <to>java.corba</to>
-      <to>java.desktop</to>
-      <to>java.logging</to>
-      <to>java.management</to>
-      <to>java.naming</to>
-      <to>java.rmi</to>
-      <to>java.security.jgss</to>
-      <to>java.sql</to>
-      <to>java.xml</to>
-      <to>jdk.charsets</to>
-      <to>jdk.management.resource</to>
-      <to>jdk.jfr</to>
-      <to>jdk.net</to>
-      <to>jdk.scripting.nashorn</to>
-      <to>jdk.vm.ci</to>
-    </export>
-    <export>
-      <name>jdk.internal.perf</name>
-      <to>java.desktop</to>
-      <to>java.management</to>
-      <to>jdk.jvmstat</to>
-    </export>
-    <export>
-      <name>jdk.internal.org.xml.sax</name>
-      <to>jdk.jfr</to>
-    </export>
-    <export>
-      <name>jdk.internal.org.xml.sax.helpers</name>
-      <to>jdk.jfr</to>
-    </export>
-    <export>
-      <name>jdk.internal.util.xml</name>
-      <to>jdk.jfr</to>
-    </export>
-    <export>
-      <name>jdk.internal.util.xml.impl</name>
-      <to>jdk.jfr</to>
-    </export>
-    <export>
-      <name>jdk.internal.org.objectweb.asm</name>
-      <to>java.instrument</to>
-      <to>jdk.jfr</to>
-      <to>jdk.scripting.nashorn</to>
-      <to>jdk.vm.ci</to>
-    </export>
-    <export>
-      <name>jdk.internal.org.objectweb.asm.commons</name>
-      <to>java.instrument</to>
-      <to>jdk.jfr</to>
-      <to>jdk.scripting.nashorn</to>
-    </export>
-    <export>
-      <name>jdk.internal.org.objectweb.asm.signature</name>
-      <to>jdk.scripting.nashorn</to>
-    </export>
-    <export>
-      <name>jdk.internal.org.objectweb.asm.tree</name>
-      <to>java.instrument</to>
-      <to>jdk.jfr</to>
-    </export>
-    <export>
-      <name>jdk.internal.org.objectweb.asm.util</name>
-      <to>java.instrument</to>
-      <to>jdk.jfr</to>
-      <to>jdk.scripting.nashorn</to>
-    </export>
-    <export>
-      <name>jdk.internal.ref</name>
-      <to>java.desktop</to>
-    </export>
-    <export>
-      <name>jdk.internal</name>
-      <to>jdk.jfr</to>
-    </export>
-    <export>
-      <name>sun.misc</name>
-      <to>java.corba</to>
-      <to>java.desktop</to>
-      <to>java.instrument</to>
-      <to>java.logging</to>
-      <to>java.management</to>
-      <to>java.naming</to>
-      <to>java.prefs</to>
-      <to>java.rmi</to>
-      <to>java.security.jgss</to>
-      <to>java.security.sasl</to>
-      <to>java.xml</to>
-      <to>jdk.charsets</to>
-      <to>jdk.crypto.pkcs11</to>
-      <to>jdk.httpserver</to>
-      <to>jdk.jartool</to>
-      <to>jdk.jconsole</to>
-      <to>jdk.jvmstat</to>
-      <to>jdk.management.resource</to>
-      <to>jdk.pack200</to>
-      <to>jdk.scripting.nashorn</to>
-      <to>jdk.security.auth</to>
-      <to>jdk.security.jgss</to>
-      <to>jdk.snmp</to>
-      <to>jdk.vm.ci</to>
-      <to>jdk.zipfs</to>
-      <to>java.instrument</to>
-      <to>jdk.jfr</to>
-    </export>
-    <export>
-      <name>sun.net</name>
-      <to>java.httpclient</to>
-    </export>
-    <export>
-      <name>sun.net.dns</name>
-      <to>java.security.jgss</to>
-      <to>jdk.naming.dns</to>
-    </export>
-    <export>
-      <name>sun.net.sdp</name>
-      <to>jdk.net</to>
-    </export>
-    <export>
-      <name>sun.net.spi.nameservice</name>
-      <to>jdk.naming.dns</to>
-    </export>
-    <export>
-      <name>sun.net.util</name>
-      <to>java.desktop</to>
-      <to>jdk.jconsole</to>
-      <to>jdk.naming.dns</to>
-    </export>
-    <export>
-      <name>sun.net.www</name>
-      <to>java.desktop</to>
-      <to>jdk.compiler</to>
-      <to>jdk.jartool</to>
-    </export>
-    <export>
-      <name>sun.net.www.protocol.http</name>
-      <to>java.security.jgss</to>
-    </export>
-    <export>
-      <name>sun.nio.ch</name>
-      <to>java.management</to>
-      <to>jdk.crypto.pkcs11</to>
-      <to>jdk.crypto.ucrypto</to>
-      <to>jdk.management.resource</to>
-      <to>jdk.net</to>
-      <to>jdk.sctp</to>
-    </export>
-    <export>
-      <name>sun.nio.cs</name>
-      <to>java.desktop</to>
-      <to>jdk.charsets</to>
-    </export>
-    <export>
-      <name>sun.reflect</name>
-      <to>java.corba</to>
-      <to>java.instrument</to>
-      <to>java.logging</to>
-      <to>java.sql</to>
-      <to>java.sql.rowset</to>
-      <to>jdk.dynalink</to>
-      <to>jdk.scripting.nashorn</to>
-      <to>jdk.vm.cds</to>
-    </export>
-    <export>
-      <name>sun.reflect.annotation</name>
-      <to>jdk.compiler</to>
-    </export>
-    <export>
-      <name>sun.reflect.generics.reflectiveObjects</name>
-      <to>java.desktop</to>
-    </export>
-    <export>
-      <name>sun.reflect.misc</name>
-      <to>java.corba</to>
-      <to>java.datatransfer</to>
-      <to>java.desktop</to>
-      <to>java.management</to>
-      <to>java.rmi</to>
-      <to>java.sql.rowset</to>
-      <to>java.xml</to>
-    </export>
-    <export>
-      <name>sun.security.action</name>
-      <to>java.desktop</to>
-      <to>java.security.jgss</to>
-      <to>jdk.crypto.ec</to>
-      <to>jdk.crypto.pkcs11</to>
-      <to>jdk.crypto.ucrypto</to>
-    </export>
-    <export>
-      <name>sun.security.internal.interfaces</name>
-      <to>jdk.crypto.pkcs11</to>
-    </export>
-    <export>
-      <name>sun.security.internal.spec</name>
-      <to>jdk.crypto.mscapi</to>
-      <to>jdk.crypto.pkcs11</to>
-      <to>jdk.crypto.ucrypto</to>
-    </export>
-    <export>
-      <name>sun.security.jca</name>
-      <to>java.smartcardio</to>
-      <to>java.xml.crypto</to>
-      <to>jdk.crypto.ec</to>
-      <to>jdk.crypto.pkcs11</to>
-      <to>jdk.crypto.ucrypto</to>
-      <to>jdk.naming.dns</to>
-    </export>
-    <export>
-      <name>sun.security.pkcs</name>
-      <to>jdk.crypto.ec</to>
-      <to>jdk.jartool</to>
-    </export>
-    <export>
-      <name>sun.security.provider</name>
-      <to>java.rmi</to>
-      <to>java.security.jgss</to>
-      <to>jdk.crypto.pkcs11</to>
-      <to>jdk.jartool</to>
-      <to>jdk.policytool</to>
-      <to>jdk.security.auth</to>
-    </export>
-    <export>
-      <name>sun.security.provider.certpath</name>
-      <to>java.naming</to>
-    </export>
-    <export>
-      <name>sun.security.rsa</name>
-      <to>jdk.crypto.mscapi</to>
-      <to>jdk.crypto.pkcs11</to>
-    </export>
-    <export>
-      <name>sun.security.ssl</name>
-      <to>java.security.jgss</to>
-    </export>
-    <export>
-      <name>sun.security.tools</name>
-      <to>jdk.jartool</to>
-    </export>
-    <export>
-      <name>sun.security.util</name>
-      <to>java.desktop</to>
-      <to>java.naming</to>
-      <to>java.rmi</to>
-      <to>java.security.jgss</to>
-      <to>java.security.sasl</to>
-      <to>java.smartcardio</to>
-      <to>jdk.crypto.ec</to>
-      <to>jdk.crypto.mscapi</to>
-      <to>jdk.crypto.pkcs11</to>
-      <to>jdk.crypto.ucrypto</to>
-      <to>jdk.jartool</to>
-      <to>jdk.policytool</to>
-      <to>jdk.security.auth</to>
-      <to>jdk.security.jgss</to>
-    </export>
-    <export>
-      <name>sun.security.x509</name>
-      <to>java.naming</to>
-      <to>jdk.crypto.ec</to>
-      <to>jdk.crypto.pkcs11</to>
-      <to>jdk.jartool</to>
-      <to>jdk.security.auth</to>
-    </export>
-    <export>
-      <name>sun.text</name>
-      <to>java.desktop</to>
-    </export>
-    <export>
-      <name>sun.util</name>
-      <to>java.desktop</to>
-    </export>
-    <export>
-      <name>sun.util.locale.provider</name>
-      <to>java.desktop</to>
-      <to>jdk.localedata</to>
-    </export>
-    <export>
-      <name>jdk.internal.logger</name>
-      <to>java.logging</to>
-    </export>
-    <export>
-      <name>sun.util.logging</name>
-      <to>java.desktop</to>
-      <to>java.logging</to>
-      <to>java.management</to>
-      <to>java.prefs</to>
-      <to>java.httpclient</to>
-    </export>
-    <export>
-      <name>sun.util.resources</name>
-      <to>jdk.localedata</to>
-    </export>
-  </module>
-  <module>
-    <name>java.compact1</name>
-    <depend re-exports="true">java.base</depend>
-    <depend re-exports="true">java.logging</depend>
-    <depend re-exports="true">java.scripting</depend>
-  </module>
-  <module>
-    <name>java.compact2</name>
-    <depend re-exports="true">java.compact1</depend>
-    <depend re-exports="true">java.rmi</depend>
-    <depend re-exports="true">java.sql</depend>
-    <depend re-exports="true">java.xml</depend>
-  </module>
-  <module>
-    <name>java.compact3</name>
-    <depend re-exports="true">java.compact2</depend>
-    <depend re-exports="true">java.compiler</depend>
-    <depend re-exports="true">java.instrument</depend>
-    <depend re-exports="true">java.httpclient</depend>
-    <depend re-exports="true">java.management</depend>
-    <depend re-exports="true">java.naming</depend>
-    <depend re-exports="true">java.prefs</depend>
-    <depend re-exports="true">java.security.jgss</depend>
-    <depend re-exports="true">java.security.sasl</depend>
-    <depend re-exports="true">java.sql.rowset</depend>
-    <depend re-exports="true">java.xml.crypto</depend>
-  </module>
-  <module>
-    <name>java.compiler</name>
-    <depend>java.base</depend>
-    <depend>java.logging</depend>
-    <export>
-      <name>javax.annotation.processing</name>
-    </export>
-    <export>
-      <name>javax.lang.model</name>
-    </export>
-    <export>
-      <name>javax.lang.model.element</name>
-    </export>
-    <export>
-      <name>javax.lang.model.type</name>
-    </export>
-    <export>
-      <name>javax.lang.model.util</name>
-    </export>
-    <export>
-      <name>javax.tools</name>
-    </export>
-  </module>
-  <module>
-    <name>java.corba</name>
-    <depend>java.base</depend>
-    <depend re-exports="true">java.desktop</depend>
-    <depend>java.logging</depend>
-    <depend>java.naming</depend>
-    <depend re-exports="true">java.rmi</depend>
-    <depend>java.transaction</depend>
-    <export>
-      <name>javax.activity</name>
-    </export>
-    <export>
-      <name>javax.rmi</name>
-    </export>
-    <export>
-      <name>javax.rmi.CORBA</name>
-    </export>
-    <export>
-      <name>org.omg.CORBA</name>
-    </export>
-    <export>
-      <name>org.omg.CORBA.DynAnyPackage</name>
-    </export>
-    <export>
-      <name>org.omg.CORBA.ORBPackage</name>
-    </export>
-    <export>
-      <name>org.omg.CORBA.TypeCodePackage</name>
-    </export>
-    <export>
-      <name>org.omg.CORBA.portable</name>
-    </export>
-    <export>
-      <name>org.omg.CORBA_2_3</name>
-    </export>
-    <export>
-      <name>org.omg.CORBA_2_3.portable</name>
-    </export>
-    <export>
-      <name>org.omg.CosNaming</name>
-    </export>
-    <export>
-      <name>org.omg.CosNaming.NamingContextExtPackage</name>
-    </export>
-    <export>
-      <name>org.omg.CosNaming.NamingContextPackage</name>
-    </export>
-    <export>
-      <name>org.omg.Dynamic</name>
-    </export>
-    <export>
-      <name>org.omg.DynamicAny</name>
-    </export>
-    <export>
-      <name>org.omg.DynamicAny.DynAnyFactoryPackage</name>
-    </export>
-    <export>
-      <name>org.omg.DynamicAny.DynAnyPackage</name>
-    </export>
-    <export>
-      <name>org.omg.IOP</name>
-    </export>
-    <export>
-      <name>org.omg.IOP.CodecFactoryPackage</name>
-    </export>
-    <export>
-      <name>org.omg.IOP.CodecPackage</name>
-    </export>
-    <export>
-      <name>org.omg.Messaging</name>
-    </export>
-    <export>
-      <name>org.omg.PortableInterceptor</name>
-    </export>
-    <export>
-      <name>org.omg.PortableInterceptor.ORBInitInfoPackage</name>
-    </export>
-    <export>
-      <name>org.omg.PortableServer</name>
-    </export>
-    <export>
-      <name>org.omg.PortableServer.CurrentPackage</name>
-    </export>
-    <export>
-      <name>org.omg.PortableServer.POAManagerPackage</name>
-    </export>
-    <export>
-      <name>org.omg.PortableServer.POAPackage</name>
-    </export>
-    <export>
-      <name>org.omg.PortableServer.ServantLocatorPackage</name>
-    </export>
-    <export>
-      <name>org.omg.PortableServer.portable</name>
-    </export>
-    <export>
-      <name>org.omg.SendingContext</name>
-    </export>
-    <export>
-      <name>org.omg.stub.java.rmi</name>
-    </export>
-    <export>
-      <name>com.sun.corba.se.impl.util</name>
-      <to>jdk.rmic</to>
-    </export>
-  </module>
-  <module>
-    <name>java.datatransfer</name>
-    <depend>java.base</depend>
-    <export>
-      <name>java.awt.datatransfer</name>
-    </export>
-    <export>
-      <name>sun.datatransfer</name>
-      <to>java.desktop</to>
-    </export>
-  </module>
-  <module>
-    <name>java.desktop</name>
-    <depend>java.base</depend>
-    <depend>java.logging</depend>
-    <depend>java.prefs</depend>
-    <depend re-exports="true">java.xml</depend>
-    <depend re-exports="true">java.datatransfer</depend>
-    <export>
-      <name>java.applet</name>
-    </export>
-    <export>
-      <name>java.awt</name>
-    </export>
-    <export>
-      <name>java.awt.color</name>
-    </export>
-    <export>
-      <name>java.awt.dnd</name>
-    </export>
-    <export>
-      <name>java.awt.event</name>
-    </export>
-    <export>
-      <name>java.awt.font</name>
-    </export>
-    <export>
-      <name>java.awt.geom</name>
-    </export>
-    <export>
-      <name>java.awt.im</name>
-    </export>
-    <export>
-      <name>java.awt.im.spi</name>
-    </export>
-    <export>
-      <name>java.awt.image</name>
-    </export>
-    <export>
-      <name>java.awt.image.renderable</name>
-    </export>
-    <export>
-      <name>java.awt.print</name>
-    </export>
-    <export>
-      <name>java.beans</name>
-    </export>
-    <export>
-      <name>java.beans.beancontext</name>
-    </export>
-    <export>
-      <name>javax.accessibility</name>
-    </export>
-    <export>
-      <name>javax.imageio</name>
-    </export>
-    <export>
-      <name>javax.imageio.event</name>
-    </export>
-    <export>
-      <name>javax.imageio.metadata</name>
-    </export>
-    <export>
-      <name>javax.imageio.plugins.bmp</name>
-    </export>
-    <export>
-      <name>javax.imageio.plugins.jpeg</name>
-    </export>
-    <export>
-      <name>javax.imageio.spi</name>
-    </export>
-    <export>
-      <name>javax.imageio.stream</name>
-    </export>
-    <export>
-      <name>javax.print</name>
-    </export>
-    <export>
-      <name>javax.print.attribute</name>
-    </export>
-    <export>
-      <name>javax.print.attribute.standard</name>
-    </export>
-    <export>
-      <name>javax.print.event</name>
-    </export>
-    <export>
-      <name>javax.sound.midi</name>
-    </export>
-    <export>
-      <name>javax.sound.midi.spi</name>
-    </export>
-    <export>
-      <name>javax.sound.sampled</name>
-    </export>
-    <export>
-      <name>javax.sound.sampled.spi</name>
-    </export>
-    <export>
-      <name>javax.swing</name>
-    </export>
-    <export>
-      <name>javax.swing.border</name>
-    </export>
-    <export>
-      <name>javax.swing.colorchooser</name>
-    </export>
-    <export>
-      <name>javax.swing.event</name>
-    </export>
-    <export>
-      <name>javax.swing.filechooser</name>
-    </export>
-    <export>
-      <name>javax.swing.plaf</name>
-    </export>
-    <export>
-      <name>javax.swing.plaf.basic</name>
-    </export>
-    <export>
-      <name>javax.swing.plaf.metal</name>
-    </export>
-    <export>
-      <name>javax.swing.plaf.multi</name>
-    </export>
-    <export>
-      <name>javax.swing.plaf.nimbus</name>
-    </export>
-    <export>
-      <name>javax.swing.plaf.synth</name>
-    </export>
-    <export>
-      <name>javax.swing.table</name>
-    </export>
-    <export>
-      <name>javax.swing.text</name>
-    </export>
-    <export>
-      <name>javax.swing.text.html</name>
-    </export>
-    <export>
-      <name>javax.swing.text.html.parser</name>
-    </export>
-    <export>
-      <name>javax.swing.text.rtf</name>
-    </export>
-    <export>
-      <name>javax.swing.tree</name>
-    </export>
-    <export>
-      <name>javax.swing.undo</name>
-    </export>
-    <export>
-      <name>sun.awt</name>
-      <to>jdk.accessibility</to>
-    </export>
-  </module>
-  <module>
-    <name>jdk.jshell</name>
-    <depend>java.base</depend>
-    <depend re-exports="true">java.compiler</depend>
-    <depend>jdk.compiler</depend>
-    <depend>java.desktop</depend>
-    <depend>java.prefs</depend>
-    <depend>jdk.jdi</depend>
-    <depend>jdk.internal.le</depend>
-    <export>
-      <name>jdk.jshell</name>
-    </export>
-  </module>
-  <module>
-    <name>jdk.jsobject</name>
-    <depend>java.base</depend>
-    <depend re-exports="true">java.desktop</depend>
-    <export>
-      <name>netscape.javascript</name>
-    </export>
-    <export>
-      <name>jdk.internal.netscape.javascript.spi</name>
-      <to>jdk.plugin</to>
-    </export>
-  </module>
-  <module>
-    <name>java.httpclient</name>
-    <depend>java.base</depend>
-    <export>
-      <name>java.net.http</name>
-    </export>
-  </module>
-  <module>
-    <name>java.instrument</name>
-    <depend>java.base</depend>
-    <export>
-      <name>java.lang.instrument</name>
-    </export>
-    <export>
-      <name>jdk.internal.instrumentation</name>
-      <to>jdk.jfr</to>
-      <to>jdk.management.resource</to>
-    </export>
-  </module>
-  <module>
-    <name>java.logging</name>
-    <depend>java.base</depend>
-    <export>
-      <name>java.util.logging</name>
-    </export>
-  </module>
-  <module>
-    <name>java.management</name>
-    <depend>java.base</depend>
-    <depend>java.logging</depend>
-    <depend>java.naming</depend>
-    <depend re-exports="true">java.rmi</depend>
-    <export>
-      <name>java.lang.management</name>
-    </export>
-    <export>
-      <name>javax.management</name>
-    </export>
-    <export>
-      <name>javax.management.loading</name>
-    </export>
-    <export>
-      <name>javax.management.modelmbean</name>
-    </export>
-    <export>
-      <name>javax.management.monitor</name>
-    </export>
-    <export>
-      <name>javax.management.openmbean</name>
-    </export>
-    <export>
-      <name>javax.management.relation</name>
-    </export>
-    <export>
-      <name>javax.management.remote</name>
-    </export>
-    <export>
-      <name>javax.management.remote.rmi</name>
-    </export>
-    <export>
-      <name>javax.management.timer</name>
-    </export>
-    <export>
-      <name>sun.management</name>
-      <to>jdk.jconsole</to>
-      <to>jdk.management</to>
-    </export>
-    <export>
-      <name>sun.management.spi</name>
-      <to>jdk.management</to>
-      <to>jdk.management.cmm</to>
-      <to>jdk.management.jfr</to>
-    </export>
-  </module>
-  <module>
-    <name>java.naming</name>
-    <depend>java.base</depend>
-    <depend>java.security.sasl</depend>
-    <export>
-      <name>javax.naming</name>
-    </export>
-    <export>
-      <name>javax.naming.directory</name>
-    </export>
-    <export>
-      <name>javax.naming.event</name>
-    </export>
-    <export>
-      <name>javax.naming.ldap</name>
-    </export>
-    <export>
-      <name>javax.naming.spi</name>
-    </export>
-    <export>
-      <name>com.sun.jndi.toolkit.ctx</name>
-      <to>jdk.naming.dns</to>
-    </export>
-    <export>
-      <name>com.sun.jndi.toolkit.url</name>
-      <to>java.corba</to>
-      <to>jdk.naming.dns</to>
-      <to>jdk.naming.rmi</to>
-    </export>
-  </module>
-  <module>
-    <name>java.prefs</name>
-    <depend>java.base</depend>
-    <depend>java.xml</depend>
-    <export>
-      <name>java.util.prefs</name>
-    </export>
-  </module>
-  <module>
-    <name>java.rmi</name>
-    <depend>java.base</depend>
-    <depend>java.logging</depend>
-    <export>
-      <name>java.rmi</name>
-    </export>
-    <export>
-      <name>java.rmi.activation</name>
-    </export>
-    <export>
-      <name>java.rmi.dgc</name>
-    </export>
-    <export>
-      <name>java.rmi.registry</name>
-    </export>
-    <export>
-      <name>java.rmi.server</name>
-    </export>
-    <export>
-      <name>javax.rmi.ssl</name>
-    </export>
-    <export>
-      <name>sun.rmi.registry</name>
-      <to>java.management</to>
-    </export>
-    <export>
-      <name>sun.rmi.server</name>
-      <to>java.management</to>
-      <to>jdk.jconsole</to>
-    </export>
-    <export>
-      <name>sun.rmi.transport</name>
-      <to>java.management</to>
-      <to>jdk.jconsole</to>
-    </export>
-  </module>
-  <module>
-    <name>java.scripting</name>
-    <depend>java.base</depend>
-    <export>
-      <name>javax.script</name>
-    </export>
-  </module>
-  <module>
-    <name>java.se</name>
-    <depend re-exports="true">java.activation</depend>
-    <depend re-exports="true">java.compact3</depend>
-    <depend re-exports="true">java.corba</depend>
-    <depend re-exports="true">java.datatransfer</depend>
-    <depend re-exports="true">java.desktop</depend>
-    <depend re-exports="true">java.transaction</depend>
-    <depend re-exports="true">java.xml.bind</depend>
-    <depend re-exports="true">java.xml.ws</depend>
-  </module>
-  <module>
-    <name>java.security.jgss</name>
-    <depend>java.base</depend>
-    <depend>java.naming</depend>
-    <export>
-      <name>javax.security.auth.kerberos</name>
-    </export>
-    <export>
-      <name>org.ietf.jgss</name>
-    </export>
-    <export>
-      <name>sun.security.jgss.krb5</name>
-      <to>jdk.security.auth</to>
-    </export>
-    <export>
-      <name>sun.security.krb5</name>
-      <to>jdk.security.auth</to>
-    </export>
-    <export>
-      <name>sun.security.krb5.internal.ktab</name>
-      <to>jdk.security.auth</to>
-    </export>
-    <export>
-      <name>sun.security.jgss</name>
-      <to>jdk.security.jgss</to>
-    </export>
-    <export>
-      <name>sun.security.krb5.internal</name>
-      <to>jdk.security.jgss</to>
-    </export>
-  </module>
-  <module>
-    <name>java.security.sasl</name>
-    <depend>java.base</depend>
-    <depend>java.logging</depend>
-    <export>
-      <name>javax.security.sasl</name>
-    </export>
-    <export>
-      <name>com.sun.security.sasl.util</name>
-      <to>jdk.security.jgss</to>
-    </export>
-  </module>
-  <module>
-    <name>java.smartcardio</name>
-    <depend>java.base</depend>
-    <export>
-      <name>javax.smartcardio</name>
-    </export>
-  </module>
-  <module>
-    <name>java.sql</name>
-    <depend>java.base</depend>
-    <depend re-exports="true">java.logging</depend>
-    <depend re-exports="true">java.xml</depend>
-    <export>
-      <name>java.sql</name>
-    </export>
-    <export>
-      <name>javax.sql</name>
-    </export>
-    <export>
-      <name>javax.transaction.xa</name>
-    </export>
-  </module>
-  <module>
-    <name>java.sql.rowset</name>
-    <depend>java.base</depend>
-    <depend re-exports="true">java.logging</depend>
-    <depend re-exports="true">java.naming</depend>
-    <depend re-exports="true">java.sql</depend>
-    <depend>java.xml</depend>
-    <export>
-      <name>javax.sql.rowset</name>
-    </export>
-    <export>
-      <name>javax.sql.rowset.serial</name>
-    </export>
-    <export>
-      <name>javax.sql.rowset.spi</name>
-    </export>
-  </module>
-  <module>
-    <name>java.transaction</name>
-    <depend>java.base</depend>
-    <depend re-exports="true">java.rmi</depend>
-    <export>
-      <name>javax.transaction</name>
-    </export>
-  </module>
-  <module>
-    <name>java.xml</name>
-    <depend>java.base</depend>
-    <export>
-      <name>javax.xml</name>
-    </export>
-    <export>
-      <name>javax.xml.catalog</name>
-    </export>
-    <export>
-      <name>javax.xml.datatype</name>
-    </export>
-    <export>
-      <name>javax.xml.namespace</name>
-    </export>
-    <export>
-      <name>javax.xml.parsers</name>
-    </export>
-    <export>
-      <name>javax.xml.stream</name>
-    </export>
-    <export>
-      <name>javax.xml.stream.events</name>
-    </export>
-    <export>
-      <name>javax.xml.stream.util</name>
-    </export>
-    <export>
-      <name>javax.xml.transform</name>
-    </export>
-    <export>
-      <name>javax.xml.transform.dom</name>
-    </export>
-    <export>
-      <name>javax.xml.transform.sax</name>
-    </export>
-    <export>
-      <name>javax.xml.transform.stax</name>
-    </export>
-    <export>
-      <name>javax.xml.transform.stream</name>
-    </export>
-    <export>
-      <name>javax.xml.validation</name>
-    </export>
-    <export>
-      <name>javax.xml.xpath</name>
-    </export>
-    <export>
-      <name>org.w3c.dom</name>
-    </export>
-    <export>
-      <name>org.w3c.dom.bootstrap</name>
-    </export>
-    <export>
-      <name>org.w3c.dom.events</name>
-    </export>
-    <export>
-      <name>org.w3c.dom.ls</name>
-    </export>
-    <export>
-      <name>org.w3c.dom.ranges</name>
-    </export>
-    <export>
-      <name>org.w3c.dom.traversal</name>
-    </export>
-    <export>
-      <name>org.w3c.dom.views</name>
-    </export>
-    <export>
-      <name>org.xml.sax</name>
-    </export>
-    <export>
-      <name>org.xml.sax.ext</name>
-    </export>
-    <export>
-      <name>org.xml.sax.helpers</name>
-    </export>
-     <export>
-       <name>com.sun.org.apache.xerces.internal.dom</name>
-       <to>java.xml.ws</to>
-     </export>
-     <export>
-       <name>com.sun.org.apache.xerces.internal.jaxp</name>
-       <to>java.xml.ws</to>
-     </export>
-     <export>
-       <name>com.sun.org.apache.xerces.internal.util</name>
-       <to>java.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.org.apache.xml.internal.dtm</name>
-      <to>java.xml.crypto</to>
-    </export>
-    <export>
-      <name>com.sun.org.apache.xml.internal.resolver</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-    </export>
-    <export>
-      <name>com.sun.org.apache.xml.internal.resolver.tools</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-    </export>
-    <export>
-      <name>com.sun.org.apache.xml.internal.utils</name>
-      <to>java.xml.crypto</to>
-    </export>
-    <export>
-      <name>com.sun.org.apache.xpath.internal</name>
-      <to>java.xml.crypto</to>
-    </export>
-    <export>
-      <name>com.sun.org.apache.xpath.internal.compiler</name>
-      <to>java.xml.crypto</to>
-    </export>
-    <export>
-      <name>com.sun.org.apache.xpath.internal.functions</name>
-      <to>java.xml.crypto</to>
-    </export>
-    <export>
-      <name>com.sun.org.apache.xpath.internal.objects</name>
-      <to>java.xml.crypto</to>
-    </export>
-    <export>
-      <name>com.sun.org.apache.xpath.internal.res</name>
-      <to>java.xml.crypto</to>
-    </export>
-  </module>
-  <module>
-    <name>java.xml.bind</name>
-    <depend re-exports="true">java.activation</depend>
-    <depend>java.base</depend>
-    <depend>java.compiler</depend>
-    <depend>java.datatransfer</depend>
-    <depend>java.desktop</depend>
-    <depend>java.logging</depend>
-    <depend re-exports="true">java.xml</depend>
-    <export>
-      <name>javax.xml.bind</name>
-    </export>
-    <export>
-      <name>javax.xml.bind.annotation</name>
-    </export>
-    <export>
-      <name>javax.xml.bind.annotation.adapters</name>
-    </export>
-    <export>
-      <name>javax.xml.bind.attachment</name>
-    </export>
-    <export>
-      <name>javax.xml.bind.helpers</name>
-    </export>
-    <export>
-      <name>javax.xml.bind.util</name>
-    </export>
-    <export>
-      <name>com.sun.istack.internal</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.istack.internal.localization</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.istack.internal.logging</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.annotation</name>
-      <to>jdk.xml.bind</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.api</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.api.impl</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.marshaller</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.unmarshaller</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.util</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.v2</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.v2.model.annotation</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.v2.model.core</name>
-      <to>jdk.xml.bind</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.v2.model.impl</name>
-      <to>jdk.xml.bind</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.v2.model.nav</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.v2.model.runtime</name>
-      <to>java.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.v2.model.util</name>
-      <to>jdk.xml.bind</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.v2.runtime</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.v2.runtime.unmarshaller</name>
-      <to>java.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.v2.schemagen</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.v2.schemagen.episode</name>
-      <to>jdk.xml.bind</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.v2.schemagen.xmlschema</name>
-      <to>java.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.bind.v2.util</name>
-      <to>jdk.xml.bind</to>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.fastinfoset.stax</name>
-      <to>java.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.fastinfoset.vocab</name>
-      <to>java.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.org.jvnet.fastinfoset</name>
-      <to>java.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.org.jvnet.mimepull</name>
-      <to>java.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.org.jvnet.staxex</name>
-      <to>java.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.org.jvnet.staxex.util</name>
-      <to>java.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.txw2</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.txw2.annotation</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.txw2.output</name>
-      <to>java.xml.ws</to>
-      <to>jdk.xml.bind</to>
-      <to>jdk.xml.ws</to>
-    </export>
-  </module>
-  <module>
-    <name>java.xml.crypto</name>
-    <depend>java.base</depend>
-    <depend>java.logging</depend>
-    <depend re-exports="true">java.xml</depend>
-    <export>
-      <name>javax.xml.crypto</name>
-    </export>
-    <export>
-      <name>javax.xml.crypto.dom</name>
-    </export>
-    <export>
-      <name>javax.xml.crypto.dsig</name>
-    </export>
-    <export>
-      <name>javax.xml.crypto.dsig.dom</name>
-    </export>
-    <export>
-      <name>javax.xml.crypto.dsig.keyinfo</name>
-    </export>
-    <export>
-      <name>javax.xml.crypto.dsig.spec</name>
-    </export>
-  </module>
-  <module>
-    <name>java.xml.ws</name>
-    <depend>java.annotations.common</depend>
-    <depend>java.base</depend>
-    <depend>java.datatransfer</depend>
-    <depend>java.desktop</depend>
-    <depend>java.logging</depend>
-    <depend>java.management</depend>
-    <depend>java.rmi</depend>
-    <depend re-exports="true">java.activation</depend>
-    <depend re-exports="true">java.xml</depend>
-    <depend re-exports="true">java.xml.bind</depend>
-    <depend>jdk.httpserver</depend>
-    <export>
-      <name>javax.jws</name>
-    </export>
-    <export>
-      <name>javax.jws.soap</name>
-    </export>
-    <export>
-      <name>javax.xml.soap</name>
-    </export>
-    <export>
-      <name>javax.xml.ws</name>
-    </export>
-    <export>
-      <name>javax.xml.ws.handler</name>
-    </export>
-    <export>
-      <name>javax.xml.ws.handler.soap</name>
-    </export>
-    <export>
-      <name>javax.xml.ws.http</name>
-    </export>
-    <export>
-      <name>javax.xml.ws.soap</name>
-    </export>
-    <export>
-      <name>javax.xml.ws.spi</name>
-    </export>
-    <export>
-      <name>javax.xml.ws.spi.http</name>
-    </export>
-    <export>
-      <name>javax.xml.ws.wsaddressing</name>
-    </export>
-    <export>
-      <name>com.oracle.webservices.internal.api.databinding</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.addressing</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.addressing.v200408</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.api</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.api.addressing</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.api.databinding</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.api.model</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.api.server</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.api.streaming</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.api.wsdl.parser</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.api.wsdl.writer</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.binding</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.db</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.model</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.policy.sourcemodel.wspolicy</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.spi.db</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.streaming</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.util</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.util.exception</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.util.xml</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.wsdl.parser</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.ws.wsdl.writer</name>
-      <to>jdk.xml.ws</to>
-    </export>
-  </module>
-  <module>
-    <name>jdk.attach</name>
-    <depend>java.base</depend>
-    <depend>jdk.jvmstat</depend>
-    <export>
-      <name>com.sun.tools.attach</name>
-    </export>
-    <export>
-      <name>com.sun.tools.attach.spi</name>
-    </export>
-    <export>
-      <name>sun.tools.attach</name>
-      <to>jdk.jcmd</to>
-    </export>
-  </module>
-  <module>
-    <name>jdk.charsets</name>
-    <depend>java.base</depend>
-  </module>
-  <module>
-    <name>jdk.compiler</name>
-    <depend>java.base</depend>
-    <depend re-exports="true">java.compiler</depend>
-    <export>
-      <name>com.sun.source.doctree</name>
-    </export>
-    <export>
-      <name>com.sun.source.tree</name>
-    </export>
-    <export>
-      <name>com.sun.source.util</name>
-    </export>
-    <export>
-      <name>com.sun.tools.javac</name>
-    </export>
-    <export>
-      <name>com.sun.tools.doclint</name>
-      <to>jdk.javadoc</to>
-    </export>
-    <export>
-      <name>com.sun.tools.javac.api</name>
-      <to>jdk.jshell</to>
-      <to>jdk.javadoc</to>
-    </export>
-    <export>
-      <name>com.sun.tools.javac.code</name>
-      <to>jdk.jshell</to>
-      <to>jdk.javadoc</to>
-    </export>
-    <export>
-      <name>com.sun.tools.javac.comp</name>
-      <to>jdk.jshell</to>
-      <to>jdk.javadoc</to>
-    </export>
-    <export>
-      <name>com.sun.tools.javac.file</name>
-      <to>jdk.javadoc</to>
-      <to>jdk.jdeps</to>
-    </export>
-    <export>
-      <name>com.sun.tools.javac.jvm</name>
-      <to>jdk.jshell</to>
-      <to>jdk.javadoc</to>
-    </export>
-    <export>
-      <name>com.sun.tools.javac.main</name>
-      <to>jdk.jshell</to>
-      <to>jdk.javadoc</to>
-    </export>
-    <export>
-      <name>com.sun.tools.javac.nio</name>
-      <to>jdk.javadoc</to>
-    </export>
-    <export>
-      <name>com.sun.tools.javac.parser</name>
-      <to>jdk.jshell</to>
-    </export>
-    <export>
-      <name>com.sun.tools.javac.platform</name>
-      <to>jdk.javadoc</to>
-    </export>
-    <export>
-      <name>com.sun.tools.javac.sym</name>
-      <to>jdk.javadoc</to>
-    </export>
-    <export>
-      <name>com.sun.tools.javac.tree</name>
-      <to>jdk.jshell</to>
-      <to>jdk.javadoc</to>
-    </export>
-    <export>
-      <name>com.sun.tools.javac.util</name>
-      <to>jdk.jshell</to>
-      <to>jdk.javadoc</to>
-      <to>jdk.jdeps</to>
-    </export>
-    <export>
-      <name>com.sun.tools.javac.model</name>
-      <to>jdk.javadoc</to>
-    </export>
-  </module>
-  <module>
-    <name>jdk.crypto.ec</name>
-    <depend>java.base</depend>
-    <export>
-      <name>sun.security.ec</name>
-      <to>jdk.crypto.pkcs11</to>
-    </export>
-  </module>
-  <module>
-    <name>jdk.crypto.mscapi</name>
-    <depend>java.base</depend>
-  </module>
-  <module>
-    <name>jdk.crypto.pkcs11</name>
-    <depend>java.base</depend>
-    <depend>jdk.crypto.ec</depend>
-  </module>
-  <module>
-    <name>jdk.crypto.ucrypto</name>
-    <depend>java.base</depend>
-  </module>
-  <module>
-    <name>jdk.dev</name>
-    <depend>java.base</depend>
-  </module>
-  <module>
-    <name>jdk.dynalink</name>
-    <depend>java.base</depend>
-    <depend>java.logging</depend>
-    <export>
-      <name>jdk.dynalink</name>
-    </export>
-    <export>
-      <name>jdk.dynalink.beans</name>
-    </export>
-    <export>
-      <name>jdk.dynalink.linker</name>
-    </export>
-    <export>
-      <name>jdk.dynalink.linker.support</name>
-    </export>
-    <export>
-      <name>jdk.dynalink.support</name>
-    </export>
-  </module>
-  <module>
-    <name>jdk.hotspot.agent</name>
-    <depend>java.base</depend>
-    <depend>java.datatransfer</depend>
-    <depend>java.desktop</depend>
-    <depend>java.rmi</depend>
-    <depend>java.scripting</depend>
-    <depend>jdk.jdi</depend>
-  </module>
-  <module>
-    <name>jdk.httpserver</name>
-    <depend>java.base</depend>
-    <depend>java.logging</depend>
-    <export>
-      <name>com.sun.net.httpserver</name>
-    </export>
-    <export>
-      <name>com.sun.net.httpserver.spi</name>
-    </export>
-  </module>
-  <module>
-    <name>jdk.internal.le</name>
-    <depend>java.base</depend>
-    <export>
-      <name>jdk.internal.jline</name>
-      <to>jdk.jshell</to>
-      <to>jdk.scripting.nashorn.shell</to>
-    </export>
-    <export>
-      <name>jdk.internal.jline.console</name>
-      <to>jdk.jshell</to>
-      <to>jdk.scripting.nashorn.shell</to>
-    </export>
-    <export>
-      <name>jdk.internal.jline.console.completer</name>
-      <to>jdk.jshell</to>
-      <to>jdk.scripting.nashorn.shell</to>
-    </export>
-    <export>
-      <name>jdk.internal.jline.console.history</name>
-      <to>jdk.jshell</to>
-      <to>jdk.scripting.nashorn.shell</to>
-    </export>
-    <export>
-      <name>jdk.internal.jline.internal</name>
-      <to>jdk.jshell</to>
-      <to>jdk.scripting.nashorn.shell</to>
-    </export>
-  </module>
-  <module>
-    <name>jdk.internal.opt</name>
-    <depend>java.base</depend>
-  </module>
-  <module>
-    <name>jdk.jartool</name>
-    <depend>java.base</depend>
-    <export>
-      <name>com.sun.jarsigner</name>
-    </export>
-    <export>
-      <name>jdk.security.jarsigner</name>
-    </export>
-  </module>
-  <module>
-    <name>jdk.javadoc</name>
-    <depend>java.base</depend>
-    <depend re-exports="true">java.compiler</depend>
-    <depend>java.xml</depend>
-    <depend re-exports="true">jdk.compiler</depend>
-    <export>
-      <name>com.sun.javadoc</name>
-    </export>
-    <export>
-      <name>com.sun.tools.doclets</name>
-    </export>
-    <export>
-      <name>com.sun.tools.javadoc</name>
-    </export>
-    <export>
-      <name>jdk.javadoc.doclet</name>
-    </export>
-    <export>
-      <name>jdk.javadoc.doclet.taglet</name>
-    </export>
-  </module>
-  <module>
-    <name>jdk.jcmd</name>
-    <depend>java.base</depend>
-    <depend>jdk.attach</depend>
-    <depend>jdk.jvmstat</depend>
-  </module>
-  <module>
-    <name>jdk.jconsole</name>
-    <depend>java.base</depend>
-    <depend re-exports="true">java.desktop</depend>
-    <depend>java.logging</depend>
-    <depend re-exports="true">java.management</depend>
-    <depend>java.rmi</depend>
-    <depend>jdk.attach</depend>
-    <depend>jdk.jvmstat</depend>
-    <depend>jdk.management</depend>
-    <export>
-      <name>com.sun.tools.jconsole</name>
-    </export>
-  </module>
-  <module>
-    <name>jdk.jdeps</name>
-    <depend>java.base</depend>
-    <depend>java.compiler</depend>
-    <depend>java.xml</depend>
-    <depend>jdk.compiler</depend>
-  </module>
-  <module>
-    <name>jdk.jdi</name>
-    <depend>java.base</depend>
-    <depend>jdk.attach</depend>
-    <export>
-      <name>com.sun.jdi</name>
-    </export>
-    <export>
-      <name>com.sun.jdi.connect</name>
-    </export>
-    <export>
-      <name>com.sun.jdi.connect.spi</name>
-    </export>
-    <export>
-      <name>com.sun.jdi.event</name>
-    </export>
-    <export>
-      <name>com.sun.jdi.request</name>
-    </export>
-    <export>
-      <name>com.sun.tools.jdi</name>
-      <to>jdk.hotspot.agent</to>
-    </export>
-  </module>
-  <module>
-    <name>jdk.jdwp.agent</name>
-    <depend>java.base</depend>
-  </module>
-  <module>
-    <name>jdk.jvmstat</name>
-    <depend>java.base</depend>
-    <export>
-      <name>sun.jvmstat.monitor</name>
-      <to>jdk.attach</to>
-      <to>jdk.jcmd</to>
-      <to>jdk.jconsole</to>
-      <to>jdk.jvmstat.rmi</to>
-    </export>
-    <export>
-      <name>sun.jvmstat.monitor.event</name>
-      <to>jdk.jcmd</to>
-      <to>jdk.jvmstat.rmi</to>
-    </export>
-    <export>
-      <name>sun.jvmstat.perfdata.monitor</name>
-      <to>jdk.jvmstat.rmi</to>
-    </export>
-  </module>
-  <module>
-    <name>jdk.jvmstat.rmi</name>
-    <depend>java.base</depend>
-    <depend>java.rmi</depend>
-    <depend>jdk.jvmstat</depend>
-    <export>
-      <name>sun.jvmstat.monitor.remote</name>
-      <to>java.rmi</to>
-    </export>
-  </module>
-  <module>
-    <name>jdk.localedata</name>
-    <depend>java.base</depend>
-  </module>
-  <module>
-    <name>jdk.management</name>
-    <depend>java.base</depend>
-    <depend re-exports="true">java.management</depend>
-    <export>
-      <name>com.sun.management</name>
-    </export>
-  </module>
-  <module>
-    <name>jdk.naming.dns</name>
-    <depend>java.base</depend>
-    <depend>java.naming</depend>
-  </module>
-  <module>
-    <name>jdk.naming.rmi</name>
-    <depend>java.base</depend>
-    <depend>java.naming</depend>
-    <depend>java.rmi</depend>
-  </module>
-  <module>
-    <name>jdk.pack200</name>
-    <depend>java.base</depend>
-  </module>
-  <module>
-    <name>jdk.policytool</name>
-    <depend>java.base</depend>
-    <depend>java.desktop</depend>
-    <depend>java.logging</depend>
-    <depend>java.management</depend>
-    <depend>java.security.jgss</depend>
-    <depend>java.sql</depend>
-    <depend>jdk.security.jgss</depend>
-  </module>
-  <module>
-    <name>jdk.rmic</name>
-    <depend>java.base</depend>
-    <depend>java.corba</depend>
-    <depend>jdk.compiler</depend>
-    <depend>jdk.javadoc</depend>
-  </module>
-  <module>
-    <name>jdk.scripting.nashorn</name>
-    <depend>java.base</depend>
-    <depend>java.logging</depend>
-    <depend>jdk.dynalink</depend>
-    <depend re-exports="true">java.scripting</depend>
-    <export>
-      <name>jdk.nashorn.internal.runtime</name>
-      <to>jdk.scripting.nashorn.shell</to>
-    </export>
-    <export>
-      <name>jdk.nashorn.internal.objects</name>
-      <to>jdk.scripting.nashorn.shell</to>
-    </export>
-    <export>
-      <name>jdk.nashorn.tools</name>
-      <to>jdk.scripting.nashorn.shell</to>
-    </export>
-    <export>
-      <name>jdk.nashorn.api.scripting</name>
-    </export>
-    <export>
-      <name>jdk.nashorn.api.tree</name>
-    </export>
-  </module>
-  <module>
-    <name>jdk.scripting.nashorn.shell</name>
-    <depend>java.base</depend>
-    <depend>jdk.scripting.nashorn</depend>
-    <depend>jdk.internal.le</depend> <!-- jline -->
-    <depend>java.desktop</depend> <!-- EditPad -->
-    <depend>java.compiler</depend> <!-- java package completion -->
-  </module>
-  <module>
-    <name>jdk.sctp</name>
-    <depend>java.base</depend>
-    <export>
-      <name>com.sun.nio.sctp</name>
-    </export>
-  </module>
-  <module>
-    <name>jdk.security.auth</name>
-    <depend>java.base</depend>
-    <depend re-exports="true">java.naming</depend>
-    <depend>java.security.jgss</depend>
-    <export>
-      <name>com.sun.security.auth</name>
-    </export>
-    <export>
-      <name>com.sun.security.auth.callback</name>
-    </export>
-    <export>
-      <name>com.sun.security.auth.login</name>
-    </export>
-    <export>
-      <name>com.sun.security.auth.module</name>
-    </export>
-  </module>
-  <module>
-    <name>jdk.security.jgss</name>
-    <depend>java.base</depend>
-    <depend>java.logging</depend>
-    <depend re-exports="true">java.security.jgss</depend>
-    <depend>java.security.sasl</depend>
-    <export>
-      <name>com.sun.security.jgss</name>
-    </export>
-  </module>
-  <module>
-    <name>jdk.vm.ci</name>
-    <depend>java.base</depend>
-    <export>
-      <name>jdk.vm.ci.hotspot</name>
-      <to>jdk.jfr</to>
-    </export>
-    <export>
-      <name>jdk.vm.ci.hotspot.events</name>
-      <to>jdk.jfr</to>
-    </export>
-  </module>
-  <module>
-    <name>jdk.xml.bind</name>
-    <depend>java.activation</depend>
-    <depend>java.base</depend>
-    <depend>java.compiler</depend>
-    <depend>java.datatransfer</depend>
-    <depend>java.desktop</depend>
-    <depend>java.logging</depend>
-    <depend>java.xml</depend>
-    <depend>java.xml.bind</depend>
-    <depend>jdk.compiler</depend>
-    <export>
-      <name>com.sun.codemodel.internal</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.codemodel.internal.writer</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.istack.internal.tools</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.tools.internal.jxc.ap</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.tools.internal.jxc.model.nav</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.tools.internal.xjc</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.tools.internal.xjc.api</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.tools.internal.xjc.api.util</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.tools.internal.xjc.reader</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.tools.internal.xjc.reader.internalizer</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.tools.internal.xjc.util</name>
-      <to>jdk.xml.ws</to>
-    </export>
-    <export>
-      <name>com.sun.xml.internal.xsom.parser</name>
-      <to>jdk.xml.ws</to>
-    </export>
-  </module>
-  <module>
-    <name>jdk.xml.dom</name>
-    <depend>java.base</depend>
-    <depend re-exports="true">java.xml</depend>
-    <export>
-      <name>org.w3c.dom.css</name>
-    </export>
-    <export>
-      <name>org.w3c.dom.html</name>
-    </export>
-    <export>
-      <name>org.w3c.dom.stylesheets</name>
-    </export>
-    <export>
-      <name>org.w3c.dom.xpath</name>
-    </export>
-  </module>
-  <module>
-    <name>jdk.xml.ws</name>
-    <depend>java.base</depend>
-    <depend>java.compiler</depend>
-    <depend>java.logging</depend>
-    <depend>java.rmi</depend>
-    <depend>java.xml</depend>
-    <depend>java.xml.bind</depend>
-    <depend>java.xml.ws</depend>
-    <depend>jdk.xml.bind</depend>
-  </module>
-  <module>
-    <name>jdk.zipfs</name>
-    <depend>java.base</depend>
-  </module>
-  <module>
-    <name>jdk.accessibility</name>
-    <depend>java.base</depend>
-    <depend>java.desktop</depend>
-  </module>
-</modules>
--- a/test/lib/sun/hotspot/WhiteBox.java	Thu Mar 17 19:04:01 2016 +0000
+++ b/test/lib/sun/hotspot/WhiteBox.java	Wed Jul 05 21:27:42 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
@@ -32,7 +32,6 @@
 import java.util.function.Function;
 import java.security.BasicPermission;
 import java.util.Objects;
-import jdk.internal.HotSpotIntrinsicCandidate;
 
 import sun.hotspot.parser.DiagnosticCommand;
 
@@ -211,8 +210,6 @@
   public native int     deoptimizeFrames(boolean makeNotEntrant);
   public native void    deoptimizeAll();
 
-  @HotSpotIntrinsicCandidate
-  public        void    deoptimize() {}
   public        boolean isMethodCompiled(Executable method) {
     return isMethodCompiled(method, false /*not osr*/);
   }
@@ -422,6 +419,19 @@
                        .findAny()
                        .orElse(null);
   }
+
+  // Jigsaw
+  public native void DefineModule(Object module, String version, String location,
+                                  Object[] packages);
+  public native void AddModuleExports(Object from_module, String pkg, Object to_module);
+  public native void AddReadsModule(Object from_module, Object source_module);
+  public native boolean CanReadModule(Object asking_module, Object source_module);
+  public native boolean IsExportedToModule(Object from_module, String pkg, Object to_module);
+  public native void AddModulePackage(Object module, String pkg);
+  public native void AddModuleExportsToAllUnnamed(Object module, String pkg);
+  public native void AddModuleExportsToAll(Object module, String pkg);
+  public native Object GetModuleByPackageName(Object ldr, String pkg);
+
   public native int getOffsetForName0(String name);
   public int getOffsetForName(String name) throws Exception {
     int offset = getOffsetForName0(name);
@@ -452,7 +462,7 @@
   public native void assertMatchingSafepointCalls(boolean mutexSafepointValue, boolean attemptedNoSafepointValue);
 
   // Sharing
+  public native boolean isShared(Object o);
   public native boolean isSharedClass(Class<?> c);
-  public native boolean isShared(Object o);
   public native boolean areSharedStringsIgnored();
 }