changeset 1947:a2a3930ed7c3

8149647: Incremental enhancements from build-infra Reviewed-by: erikj
author ihse
date Fri, 12 Feb 2016 11:07:35 +0100
parents ec02649eada6
children 54575d8783b3
files common/autoconf/basics.m4 common/autoconf/build-performance.m4 common/autoconf/configure common/autoconf/configure.ac common/autoconf/flags.m4 common/autoconf/generated-configure.sh common/autoconf/help.m4 common/autoconf/hotspot.m4 common/autoconf/jdk-options.m4 common/autoconf/spec.gmk.in common/autoconf/toolchain.m4 common/bin/compare.sh common/bin/compare_exceptions.sh.incl make/Main.gmk make/StripBinaries.gmk make/common/NativeCompilation.gmk
diffstat 16 files changed, 473 insertions(+), 179 deletions(-) [+]
line wrap: on
line diff
--- a/common/autoconf/basics.m4	Thu Feb 11 16:05:16 2016 -0800
+++ b/common/autoconf/basics.m4	Fri Feb 12 11:07:35 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -36,11 +36,11 @@
 # "ARG_FOO".
 #
 # The generated function can be called like this:
-# MYFUNC(FOO: [foo-val], BAR:
-#     [
+# MYFUNC(FOO: [foo-val],
+#     BAR: [
 #         $ECHO hello world
 #     ])
-#
+# Note that the argument value must start on the same line as the argument name.
 #
 # Argument 1: Name of the function to define
 # Argument 2: List of legal named arguments, with a * prefix for required arguments
--- a/common/autoconf/build-performance.m4	Thu Feb 11 16:05:16 2016 -0800
+++ b/common/autoconf/build-performance.m4	Fri Feb 12 11:07:35 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -72,7 +72,7 @@
     FOUND_MEM=yes
   elif test -x /usr/sbin/prtconf; then
     # Looks like a Solaris or AIX system
-    MEMORY_SIZE=`/usr/sbin/prtconf | grep "^Memory [[Ss]]ize" | awk '{ print [$]3 }'`
+    MEMORY_SIZE=`/usr/sbin/prtconf 2> /dev/null | grep "^Memory [[Ss]]ize" | awk '{ print [$]3 }'`
     FOUND_MEM=yes
   elif test -x /usr/sbin/sysctl; then
     # Looks like a MacOSX system
@@ -260,8 +260,8 @@
 #
 AC_DEFUN([BPERF_RUN_ICECC_CREATE_ENV],
 [
-  cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
-      && ${ICECC_CREATE_ENV} $1 > $2 2>&1
+  ( cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
+      && ${ICECC_CREATE_ENV} $1 > $2 2>&1 )
   if test "$?" != "0"; then
     AC_MSG_NOTICE([icecc-create-env output:])
     cat $2
--- a/common/autoconf/configure	Thu Feb 11 16:05:16 2016 -0800
+++ b/common/autoconf/configure	Fri Feb 12 11:07:35 2016 +0100
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright (c) 2012, 2014, 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
@@ -283,8 +283,9 @@
 
 EOT
 
-    # Print list of toolchains. This must be done by the autoconf script.
-    ( CONFIGURE_PRINT_TOOLCHAIN_LIST=true . $conf_script_to_run PRINTF=printf )
+    # Print additional help, e.g. a list of toolchains.
+    # This must be done by the autoconf script.
+    ( CONFIGURE_PRINT_ADDITIONAL_HELP=true . $conf_script_to_run PRINTF=printf )
 
     cat <<EOT
 
--- a/common/autoconf/configure.ac	Thu Feb 11 16:05:16 2016 -0800
+++ b/common/autoconf/configure.ac	Fri Feb 12 11:07:35 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -189,8 +189,6 @@
 
 FLAGS_SETUP_INIT_FLAGS
 
-# FIXME: Currently we must test this after toolchain but before flags. Fix!
-
 # Now we can test some aspects on the target using configure macros.
 PLATFORM_SETUP_OPENJDK_TARGET_BITS
 PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS
--- a/common/autoconf/flags.m4	Thu Feb 11 16:05:16 2016 -0800
+++ b/common/autoconf/flags.m4	Fri Feb 12 11:07:35 2016 +0100
@@ -206,7 +206,7 @@
   # On Windows, we need to set RC flags.
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
     RC_FLAGS="-nologo -l0x409"
-    if test "x$VARIANT" = xOPT; then
+    if test "x$DEBUG_LEVEL" = xrelease; then
       RC_FLAGS="$RC_FLAGS -DNDEBUG"
     fi
 
@@ -254,7 +254,7 @@
       SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.'
       SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
       SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
-      SET_SHARED_LIBRARY_MAPFILE=''
+      SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
     else
       # Default works for linux, might work on other platforms as well.
       SHARED_LIBRARY_FLAGS='-shared'
@@ -274,7 +274,7 @@
       SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.'
       SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
       SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
-      SET_SHARED_LIBRARY_MAPFILE=''
+      SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
     else
       # Default works for linux, might work on other platforms as well.
       PICFLAG='-fPIC'
@@ -310,7 +310,7 @@
     SET_EXECUTABLE_ORIGIN=''
     SET_SHARED_LIBRARY_ORIGIN=''
     SET_SHARED_LIBRARY_NAME=''
-    SET_SHARED_LIBRARY_MAPFILE=''
+    SET_SHARED_LIBRARY_MAPFILE='-def:[$]1'
   fi
 
   AC_SUBST(C_FLAG_REORDER)
@@ -423,6 +423,10 @@
       # no adjustment
       ;;
     slowdebug )
+      # FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS it
+      # get's added conditionally on whether we produce debug symbols or not.
+      # This is most likely not really correct.
+
       # Add runtime stack smashing and undefined behavior checks.
       # Not all versions of gcc support -fstack-protector
       STACK_PROTECTOR_CFLAG="-fstack-protector-all"
@@ -463,7 +467,7 @@
       CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
       CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
       CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
-      C_O_FLAG_DEBUG=""
+      CXX_O_FLAG_DEBUG=""
       CXX_O_FLAG_NONE=""
     fi
   else
@@ -646,8 +650,8 @@
     # avoid bundling msvcpNNN.dll. Doesn't work with newer versions of visual
     # studio.
     if test "x$TOOLCHAIN_VERSION" = "x2010"; then
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
-          -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB"
+      STATIC_CPPLIB_FLAGS="-D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB"
+      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK $STATIC_CPPLIB_FLAGS"
     fi
   fi
 
@@ -715,9 +719,6 @@
   # Set some additional per-OS defines.
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
     COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
-  elif test "x$OPENJDK_TARGET_OS" = xaix; then
-    # FIXME: PPC64 should not be here.
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DPPC64"
   elif test "x$OPENJDK_TARGET_OS" = xbsd; then
     COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE"
   fi
@@ -775,36 +776,34 @@
   # Setup LDFLAGS et al.
   #
 
-  # Now this is odd. The JDK native libraries have to link against libjvm.so
-  # On 32-bit machines there is normally two distinct libjvm.so:s, client and server.
-  # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library
-  # is identical for client and server? Yes. Which is picked at runtime (client or server)?
-  # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following
-  # libraries will link to whatever is in memory. Yuck.
-  #
-  # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
-    LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no"
+    LDFLAGS_MICROSOFT="-nologo -opt:ref"
+    LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_MICROSOFT -incremental:no"
     if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then
-      LDFLAGS_JDK="$LDFLAGS_JDK -safeseh"
+      LDFLAGS_SAFESH="-safeseh"
+      LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_SAFESH"
     fi
     # TODO: make -debug optional "--disable-full-debug-symbols"
-    LDFLAGS_JDK="$LDFLAGS_JDK -debug"
+    LDFLAGS_MICROSOFT_DEBUG="-debug"
+    LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_MICROSOFT_DEBUG"
   elif test "x$TOOLCHAIN_TYPE" = xgcc; then
     # If this is a --hash-style=gnu system, use --hash-style=both, why?
     # We have previously set HAS_GNU_HASH if this is the case
     if test -n "$HAS_GNU_HASH"; then
-      LDFLAGS_JDK="${LDFLAGS_JDK} -Wl,--hash-style=both"
+      LDFLAGS_HASH_STYLE="-Wl,--hash-style=both"
+      LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_HASH_STYLE"
     fi
     if test "x$OPENJDK_TARGET_OS" = xlinux; then
       # And since we now know that the linker is gnu, then add -z defs, to forbid
       # undefined symbols in object files.
-      LDFLAGS_JDK="${LDFLAGS_JDK} -Wl,-z,defs"
+      LDFLAGS_NO_UNDEF_SYM="-Wl,-z,defs"
+      LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_NO_UNDEF_SYM"
       case $DEBUG_LEVEL in
         release )
           # tell linker to optimize libraries.
           # Should this be supplied to the OSS linker as well?
-          LDFLAGS_JDK="${LDFLAGS_JDK} -Wl,-O1"
+          LDFLAGS_DEBUGLEVEL_release="-Wl,-O1"
+          LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_DEBUGLEVEL_release"
           ;;
         slowdebug )
           if test "x$HAS_LINKER_NOW" = "xtrue"; then
@@ -831,10 +830,13 @@
         esac
     fi
   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
-    LDFLAGS_JDK="$LDFLAGS_JDK -Wl,-z,defs -xildoff -ztext"
-    LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib"
+    LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
+    LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -xildoff -ztext"
+    LDFLAGS_CXX_SOLSTUDIO="-norunpath"
+    LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
-    LDFLAGS_JDK="${LDFLAGS_JDK} -brtl -bnolibpath -bexpall -bernotok"
+    LDFLAGS_XLC="-brtl -bnolibpath -bexpall -bernotok"
+    LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_XLC"
   fi
 
   # Customize LDFLAGS for executables
@@ -1048,6 +1050,10 @@
       DISABLE_WARNING_PREFIX="-Wno-"
       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
       ;;
+    xlc)
+      DISABLE_WARNING_PREFIX="-qsuppress="
+      CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
+      ;;
   esac
   AC_SUBST(DISABLE_WARNING_PREFIX)
   AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
--- a/common/autoconf/generated-configure.sh	Thu Feb 11 16:05:16 2016 -0800
+++ b/common/autoconf/generated-configure.sh	Fri Feb 12 11:07:35 2016 +0100
@@ -784,6 +784,8 @@
 LD
 CXXCPP
 CPP
+CXX_VERSION_NUMBER
+CC_VERSION_NUMBER
 ac_ct_CXX
 CXXFLAGS
 CXX
@@ -860,6 +862,7 @@
 TEST_IN_BUILD
 COPYRIGHT_YEAR
 COMPRESS_JARS
+INCLUDE_SA
 UNLIMITED_CRYPTO
 CACERTS_FILE
 BUILD_HEADLESS
@@ -906,7 +909,6 @@
 VARIANT
 DEBUG_LEVEL
 MACOSX_UNIVERSAL
-INCLUDE_SA
 JVM_VARIANT_CORE
 JVM_VARIANT_ZEROSHARK
 JVM_VARIANT_ZERO
@@ -1926,7 +1928,7 @@
   --with-jvm-variants     JVM variants (separated by commas) to build (server,
                           client, minimal1, zero, zeroshark, core) [server]
   --with-debug-level      set the debug level (release, fastdebug, slowdebug,
-                          optimized (HotSpot build only)) [release]
+                          optimized) [release]
   --with-devkit           use this devkit for compilers, tools and resources
   --with-sys-root         alias for --with-sysroot for backwards compatability
   --with-sysroot          use this directory as sysroot
@@ -2008,7 +2010,7 @@
   --with-jtreg            Regression Test Harness [probed]
   --with-native-debug-symbols
                           set the native debug symbol configuration (none,
-                          internal, external, zipped) [zipped]
+                          internal, external, zipped) [varying]
   --with-stdc++lib=<static>,<dynamic>,<default>
                           force linking of the C++ runtime on Linux to either
                           static or dynamic, default is static with dynamic as
@@ -3424,7 +3426,7 @@
 
 # Include these first...
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -3461,11 +3463,11 @@
 # "ARG_FOO".
 #
 # The generated function can be called like this:
-# MYFUNC(FOO: [foo-val], BAR:
-#     [
+# MYFUNC(FOO: [foo-val],
+#     BAR: [
 #         $ECHO hello world
 #     ])
-#
+# Note that the argument value must start on the same line as the argument name.
 #
 # Argument 1: Name of the function to define
 # Argument 2: List of legal named arguments, with a * prefix for required arguments
@@ -3774,7 +3776,7 @@
 
 
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -3927,7 +3929,7 @@
 
 
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -4059,7 +4061,7 @@
 
 
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -4117,7 +4119,7 @@
 
 
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -4625,7 +4627,7 @@
 
 
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -4676,6 +4678,28 @@
 TOOLCHAIN_DESCRIPTION_solstudio="Oracle Solaris Studio"
 TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
 
+# Minimum supported versions, empty means unspecified
+TOOLCHAIN_MINIMUM_VERSION_clang="3.2"
+TOOLCHAIN_MINIMUM_VERSION_gcc="4.3"
+TOOLCHAIN_MINIMUM_VERSION_microsoft=""
+TOOLCHAIN_MINIMUM_VERSION_solstudio="5.12"
+TOOLCHAIN_MINIMUM_VERSION_xlc=""
+
+# Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
+# Must have CC_VERSION_NUMBER and CXX_VERSION_NUMBER.
+
+
+# Check if the configured compiler (C and C++) is of a specific version or
+# newer. TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS must have been called before.
+#
+# Arguments:
+#   VERSION:   The version string to check against the found version
+#   IF_AT_LEAST:   block to run if the compiler is at least this version (>=)
+#   IF_OLDER_THAN:   block to run if the compiler is older than this version (<)
+
+
+
+
 # Setup a number of variables describing how native output files are
 # named on this platform/toolchain.
 
@@ -4836,7 +4860,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1454994410
+DATE_WHEN_GENERATED=1455271513
 
 ###############################################################################
 #
@@ -4850,7 +4874,9 @@
 # If we are requested to print additional help, do that and then exit.
 # This must be the very first call.
 
-  if test "x$CONFIGURE_PRINT_TOOLCHAIN_LIST" != x; then
+  if test "x$CONFIGURE_PRINT_ADDITIONAL_HELP" != x; then
+
+    # Print available toolchains
     $PRINTF "The following toolchains are available as arguments to --with-toolchain-type.\n"
     $PRINTF "Which are valid to use depends on the build platform.\n"
     for toolchain in $VALID_TOOLCHAINS_all; do
@@ -15826,21 +15852,6 @@
 
 
 
-  INCLUDE_SA=true
-  if test "x$JVM_VARIANT_ZERO" = xtrue ; then
-    INCLUDE_SA=false
-  fi
-  if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then
-    INCLUDE_SA=false
-  fi
-  if test "x$OPENJDK_TARGET_OS" = xaix ; then
-    INCLUDE_SA=false
-  fi
-  if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
-    INCLUDE_SA=false
-  fi
-
-
   if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
     MACOSX_UNIVERSAL="true"
   fi
@@ -15880,7 +15891,7 @@
       test "x$DEBUG_LEVEL" != xoptimized && \
       test "x$DEBUG_LEVEL" != xfastdebug && \
       test "x$DEBUG_LEVEL" != xslowdebug; then
-    as_fn_error $? "Allowed debug levels are: release, fastdebug and slowdebug" "$LINENO" 5
+    as_fn_error $? "Allowed debug levels are: release, fastdebug, slowdebug and optimized" "$LINENO" 5
   fi
 
 
@@ -23244,6 +23255,22 @@
   fi
 
 
+  # Should we build the serviceability agent (SA)?
+  INCLUDE_SA=true
+  if test "x$JVM_VARIANT_ZERO" = xtrue ; then
+    INCLUDE_SA=false
+  fi
+  if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then
+    INCLUDE_SA=false
+  fi
+  if test "x$OPENJDK_TARGET_OS" = xaix ; then
+    INCLUDE_SA=false
+  fi
+  if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
+    INCLUDE_SA=false
+  fi
+
+
   # Compress jars
   COMPRESS_JARS=false
 
@@ -29850,6 +29877,8 @@
   # Use indirect variable referencing
   toolchain_var_name=TOOLCHAIN_DESCRIPTION_$TOOLCHAIN_TYPE
   TOOLCHAIN_DESCRIPTION=${!toolchain_var_name}
+  toolchain_var_name=TOOLCHAIN_MINIMUM_VERSION_$TOOLCHAIN_TYPE
+  TOOLCHAIN_MINIMUM_VERSION=${!toolchain_var_name}
   toolchain_var_name=TOOLCHAIN_CC_BINARY_$TOOLCHAIN_TYPE
   TOOLCHAIN_CC_BINARY=${!toolchain_var_name}
   toolchain_var_name=TOOLCHAIN_CXX_BINARY_$TOOLCHAIN_TYPE
@@ -31483,8 +31512,14 @@
     export INCLUDE="$VS_INCLUDE"
     export LIB="$VS_LIB"
   else
-    # Currently we do not define this for other toolchains. This might change as the need arise.
-    TOOLCHAIN_VERSION=
+    if test "x$XCODE_VERSION_OUTPUT" != x; then
+      # For Xcode, we set the Xcode version as TOOLCHAIN_VERSION
+      TOOLCHAIN_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | $CUT -f 2 -d ' '`
+      TOOLCHAIN_DESCRIPTION="$TOOLCHAIN_DESCRIPTION from Xcode"
+    else
+      # Currently we do not define this for other toolchains. This might change as the need arise.
+      TOOLCHAIN_VERSION=
+    fi
   fi
 
 
@@ -32191,7 +32226,7 @@
     # Collapse compiler output into a single line
     COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
     COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
-        $SED -e 's/^.*clang version \([1-9][0-9.]*\).*$/\1/'`
+        $SED -e 's/^.* version \([1-9][0-9.]*\).*$/\1/'`
   else
       as_fn_error $? "Unknown toolchain type $TOOLCHAIN_TYPE." "$LINENO" 5
   fi
@@ -33488,7 +33523,7 @@
     # Collapse compiler output into a single line
     COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
     COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
-        $SED -e 's/^.*clang version \([1-9][0-9.]*\).*$/\1/'`
+        $SED -e 's/^.* version \([1-9][0-9.]*\).*$/\1/'`
   else
       as_fn_error $? "Unknown toolchain type $TOOLCHAIN_TYPE." "$LINENO" 5
   fi
@@ -33760,6 +33795,116 @@
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
+  # This is the compiler version number on the form X.Y[.Z]
+
+
+
+
+  if test "x$CC_VERSION_NUMBER" != "x$CXX_VERSION_NUMBER"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C and C++ compiler has different version numbers, $CC_VERSION_NUMBER vs $CXX_VERSION_NUMBER." >&5
+$as_echo "$as_me: WARNING: C and C++ compiler has different version numbers, $CC_VERSION_NUMBER vs $CXX_VERSION_NUMBER." >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This typically indicates a broken setup, and is not supported" >&5
+$as_echo "$as_me: WARNING: This typically indicates a broken setup, and is not supported" >&2;}
+  fi
+
+  # We only check CC_VERSION_NUMBER since we assume CXX_VERSION_NUMBER is equal.
+  if  [[ "$CC_VERSION_NUMBER" =~ (.*\.){3} ]] ; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C compiler version number has more than three parts (X.Y.Z): $CC_VERSION_NUMBER. Comparisons might be wrong." >&5
+$as_echo "$as_me: WARNING: C compiler version number has more than three parts (X.Y.Z): $CC_VERSION_NUMBER. Comparisons might be wrong." >&2;}
+  fi
+
+  if  [[  "$CC_VERSION_NUMBER" =~ [0-9]{6} ]] ; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C compiler version number has a part larger than 99999: $CC_VERSION_NUMBER. Comparisons might be wrong." >&5
+$as_echo "$as_me: WARNING: C compiler version number has a part larger than 99999: $CC_VERSION_NUMBER. Comparisons might be wrong." >&2;}
+  fi
+
+  COMPARABLE_ACTUAL_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", $1, $2, $3) }' <<< "$CC_VERSION_NUMBER"`
+
+
+  if test "x$TOOLCHAIN_MINIMUM_VERSION" != x; then
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Execute function body
+
+  # Need to assign to a variable since m4 is blocked from modifying parts in [].
+  REFERENCE_VERSION=$TOOLCHAIN_MINIMUM_VERSION
+
+  if  [[ "$REFERENCE_VERSION" =~ (.*\.){3} ]] ; then
+    as_fn_error $? "Internal errror: Cannot compare to $TOOLCHAIN_MINIMUM_VERSION, only three parts (X.Y.Z) is supported" "$LINENO" 5
+  fi
+
+  if  [[ "$REFERENCE_VERSION" =~ [0-9]{6} ]] ; then
+    as_fn_error $? "Internal errror: Cannot compare to $TOOLCHAIN_MINIMUM_VERSION, only parts < 99999 is supported" "$LINENO" 5
+  fi
+
+  # Version comparison method inspired by http://stackoverflow.com/a/24067243
+  COMPARABLE_REFERENCE_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", $1, $2, $3) }' <<< "$REFERENCE_VERSION"`
+
+  if test $COMPARABLE_ACTUAL_VERSION -ge $COMPARABLE_REFERENCE_VERSION ; then
+    :
+
+  else
+    :
+
+          { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You are using $TOOLCHAIN_TYPE older than $TOOLCHAIN_MINIMUM_VERSION. This is not a supported configuration." >&5
+$as_echo "$as_me: WARNING: You are using $TOOLCHAIN_TYPE older than $TOOLCHAIN_MINIMUM_VERSION. This is not a supported configuration." >&2;}
+
+
+  fi
+
+
+
+
+
+
+
+
+
+
+
+
+  fi
+
   #
   # Setup the preprocessor (CPP and CXXCPP)
   #
@@ -45332,7 +45477,7 @@
   # On Windows, we need to set RC flags.
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
     RC_FLAGS="-nologo -l0x409"
-    if test "x$VARIANT" = xOPT; then
+    if test "x$DEBUG_LEVEL" = xrelease; then
       RC_FLAGS="$RC_FLAGS -DNDEBUG"
     fi
 
@@ -45358,8 +45503,6 @@
   fi
 
 
-# FIXME: Currently we must test this after toolchain but before flags. Fix!
-
 # Now we can test some aspects on the target using configure macros.
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
@@ -46015,7 +46158,7 @@
       SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.'
       SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
       SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/$1'
-      SET_SHARED_LIBRARY_MAPFILE=''
+      SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,$1'
     else
       # Default works for linux, might work on other platforms as well.
       SHARED_LIBRARY_FLAGS='-shared'
@@ -46035,7 +46178,7 @@
       SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.'
       SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
       SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/$1'
-      SET_SHARED_LIBRARY_MAPFILE=''
+      SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,$1'
     else
       # Default works for linux, might work on other platforms as well.
       PICFLAG='-fPIC'
@@ -46071,7 +46214,7 @@
     SET_EXECUTABLE_ORIGIN=''
     SET_SHARED_LIBRARY_ORIGIN=''
     SET_SHARED_LIBRARY_NAME=''
-    SET_SHARED_LIBRARY_MAPFILE=''
+    SET_SHARED_LIBRARY_MAPFILE='-def:$1'
   fi
 
 
@@ -46151,6 +46294,10 @@
       # no adjustment
       ;;
     slowdebug )
+      # FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS it
+      # get's added conditionally on whether we produce debug symbols or not.
+      # This is most likely not really correct.
+
       # Add runtime stack smashing and undefined behavior checks.
       # Not all versions of gcc support -fstack-protector
       STACK_PROTECTOR_CFLAG="-fstack-protector-all"
@@ -46311,7 +46458,7 @@
       CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
       CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
       CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
-      C_O_FLAG_DEBUG=""
+      CXX_O_FLAG_DEBUG=""
       CXX_O_FLAG_NONE=""
     fi
   else
@@ -46492,8 +46639,8 @@
     # avoid bundling msvcpNNN.dll. Doesn't work with newer versions of visual
     # studio.
     if test "x$TOOLCHAIN_VERSION" = "x2010"; then
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
-          -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB"
+      STATIC_CPPLIB_FLAGS="-D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB"
+      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK $STATIC_CPPLIB_FLAGS"
     fi
   fi
 
@@ -46561,9 +46708,6 @@
   # Set some additional per-OS defines.
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
     COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
-  elif test "x$OPENJDK_TARGET_OS" = xaix; then
-    # FIXME: PPC64 should not be here.
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DPPC64"
   elif test "x$OPENJDK_TARGET_OS" = xbsd; then
     COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE"
   fi
@@ -46621,36 +46765,34 @@
   # Setup LDFLAGS et al.
   #
 
-  # Now this is odd. The JDK native libraries have to link against libjvm.so
-  # On 32-bit machines there is normally two distinct libjvm.so:s, client and server.
-  # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library
-  # is identical for client and server? Yes. Which is picked at runtime (client or server)?
-  # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following
-  # libraries will link to whatever is in memory. Yuck.
-  #
-  # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
-    LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no"
+    LDFLAGS_MICROSOFT="-nologo -opt:ref"
+    LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_MICROSOFT -incremental:no"
     if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then
-      LDFLAGS_JDK="$LDFLAGS_JDK -safeseh"
+      LDFLAGS_SAFESH="-safeseh"
+      LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_SAFESH"
     fi
     # TODO: make -debug optional "--disable-full-debug-symbols"
-    LDFLAGS_JDK="$LDFLAGS_JDK -debug"
+    LDFLAGS_MICROSOFT_DEBUG="-debug"
+    LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_MICROSOFT_DEBUG"
   elif test "x$TOOLCHAIN_TYPE" = xgcc; then
     # If this is a --hash-style=gnu system, use --hash-style=both, why?
     # We have previously set HAS_GNU_HASH if this is the case
     if test -n "$HAS_GNU_HASH"; then
-      LDFLAGS_JDK="${LDFLAGS_JDK} -Wl,--hash-style=both"
+      LDFLAGS_HASH_STYLE="-Wl,--hash-style=both"
+      LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_HASH_STYLE"
     fi
     if test "x$OPENJDK_TARGET_OS" = xlinux; then
       # And since we now know that the linker is gnu, then add -z defs, to forbid
       # undefined symbols in object files.
-      LDFLAGS_JDK="${LDFLAGS_JDK} -Wl,-z,defs"
+      LDFLAGS_NO_UNDEF_SYM="-Wl,-z,defs"
+      LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_NO_UNDEF_SYM"
       case $DEBUG_LEVEL in
         release )
           # tell linker to optimize libraries.
           # Should this be supplied to the OSS linker as well?
-          LDFLAGS_JDK="${LDFLAGS_JDK} -Wl,-O1"
+          LDFLAGS_DEBUGLEVEL_release="-Wl,-O1"
+          LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_DEBUGLEVEL_release"
           ;;
         slowdebug )
           if test "x$HAS_LINKER_NOW" = "xtrue"; then
@@ -46677,10 +46819,13 @@
         esac
     fi
   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
-    LDFLAGS_JDK="$LDFLAGS_JDK -Wl,-z,defs -xildoff -ztext"
-    LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib"
+    LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
+    LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -xildoff -ztext"
+    LDFLAGS_CXX_SOLSTUDIO="-norunpath"
+    LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
-    LDFLAGS_JDK="${LDFLAGS_JDK} -brtl -bnolibpath -bexpall -bernotok"
+    LDFLAGS_XLC="-brtl -bnolibpath -bexpall -bernotok"
+    LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_XLC"
   fi
 
   # Customize LDFLAGS for executables
@@ -47324,6 +47469,10 @@
       DISABLE_WARNING_PREFIX="-Wno-"
       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
       ;;
+    xlc)
+      DISABLE_WARNING_PREFIX="-qsuppress="
+      CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
+      ;;
   esac
 
 
@@ -47353,7 +47502,11 @@
           # AIX doesn't support 'zipped' so use 'internal' as default
           with_native_debug_symbols="internal"
         else
-          with_native_debug_symbols="zipped"
+          if test "x$STATIC_BUILD" = xtrue; then
+            with_native_debug_symbols="none"
+          else
+            with_native_debug_symbols="zipped"
+          fi
         fi
 
 fi
@@ -58739,7 +58892,7 @@
     FOUND_MEM=yes
   elif test -x /usr/sbin/prtconf; then
     # Looks like a Solaris or AIX system
-    MEMORY_SIZE=`/usr/sbin/prtconf | grep "^Memory [Ss]ize" | awk '{ print $3 }'`
+    MEMORY_SIZE=`/usr/sbin/prtconf 2> /dev/null | grep "^Memory [Ss]ize" | awk '{ print $3 }'`
     FOUND_MEM=yes
   elif test -x /usr/sbin/sysctl; then
     # Looks like a MacOSX system
@@ -59567,9 +59720,9 @@
     fi
     if test "x${TOOLCHAIN_TYPE}" = "xgcc"; then
 
-  cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
+  ( cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
       && ${ICECC_CREATE_ENV} ${icecc_gcc_arg} ${CC} ${CXX} > \
-          ${icecc_create_env_log} 2>&1
+          ${icecc_create_env_log} 2>&1 )
   if test "$?" != "0"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: icecc-create-env output:" >&5
 $as_echo "$as_me: icecc-create-env output:" >&6;}
@@ -59786,8 +59939,8 @@
 
 
 
-  cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
-      && ${ICECC_CREATE_ENV} --clang ${CC} ${ICECC_WRAPPER} > ${icecc_create_env_log} 2>&1
+  ( cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
+      && ${ICECC_CREATE_ENV} --clang ${CC} ${ICECC_WRAPPER} > ${icecc_create_env_log} 2>&1 )
   if test "$?" != "0"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: icecc-create-env output:" >&5
 $as_echo "$as_me: icecc-create-env output:" >&6;}
@@ -59818,9 +59971,9 @@
       icecc_create_env_log_build="${CONFIGURESUPPORT_OUTPUTDIR}/icecc/icecc_create_env_build.log"
       if test "x${BUILD_CC##*/}" = "xgcc" ||  test "x${BUILD_CC##*/}" = "xcc"; then
 
-  cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
+  ( cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
       && ${ICECC_CREATE_ENV} ${icecc_gcc_arg} ${BUILD_CC} ${BUILD_CXX} > \
-            ${icecc_create_env_log_build} 2>&1
+            ${icecc_create_env_log_build} 2>&1 )
   if test "$?" != "0"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: icecc-create-env output:" >&5
 $as_echo "$as_me: icecc-create-env output:" >&6;}
@@ -59831,8 +59984,8 @@
 
       elif test "x${BUILD_CC##*/}" = "xclang"; then
 
-  cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
-      && ${ICECC_CREATE_ENV} --clang ${BUILD_CC} ${ICECC_WRAPPER} > ${icecc_create_env_log_build} 2>&1
+  ( cd ${CONFIGURESUPPORT_OUTPUTDIR}/icecc \
+      && ${ICECC_CREATE_ENV} --clang ${BUILD_CC} ${ICECC_WRAPPER} > ${icecc_create_env_log_build} 2>&1 )
   if test "$?" != "0"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: icecc-create-env output:" >&5
 $as_echo "$as_me: icecc-create-env output:" >&6;}
--- a/common/autoconf/help.m4	Thu Feb 11 16:05:16 2016 -0800
+++ b/common/autoconf/help.m4	Fri Feb 12 11:07:35 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -159,7 +159,9 @@
 # called at the very beginning in configure.ac.
 AC_DEFUN_ONCE([HELP_PRINT_ADDITIONAL_HELP_AND_EXIT],
 [
-  if test "x$CONFIGURE_PRINT_TOOLCHAIN_LIST" != x; then
+  if test "x$CONFIGURE_PRINT_ADDITIONAL_HELP" != x; then
+
+    # Print available toolchains
     $PRINTF "The following toolchains are available as arguments to --with-toolchain-type.\n"
     $PRINTF "Which are valid to use depends on the build platform.\n"
     for toolchain in $VALID_TOOLCHAINS_all; do
--- a/common/autoconf/hotspot.m4	Thu Feb 11 16:05:16 2016 -0800
+++ b/common/autoconf/hotspot.m4	Fri Feb 12 11:07:35 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -114,21 +114,6 @@
   AC_SUBST(JVM_VARIANT_ZEROSHARK)
   AC_SUBST(JVM_VARIANT_CORE)
 
-  INCLUDE_SA=true
-  if test "x$JVM_VARIANT_ZERO" = xtrue ; then
-    INCLUDE_SA=false
-  fi
-  if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then
-    INCLUDE_SA=false
-  fi
-  if test "x$OPENJDK_TARGET_OS" = xaix ; then
-    INCLUDE_SA=false
-  fi
-  if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
-    INCLUDE_SA=false
-  fi
-  AC_SUBST(INCLUDE_SA)
-
   if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
     MACOSX_UNIVERSAL="true"
   fi
--- a/common/autoconf/jdk-options.m4	Thu Feb 11 16:05:16 2016 -0800
+++ b/common/autoconf/jdk-options.m4	Fri Feb 12 11:07:35 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,7 @@
       ], [ENABLE_DEBUG="no"])
 
   AC_ARG_WITH([debug-level], [AS_HELP_STRING([--with-debug-level],
-      [set the debug level (release, fastdebug, slowdebug, optimized (HotSpot build only)) @<:@release@:>@])],
+      [set the debug level (release, fastdebug, slowdebug, optimized) @<:@release@:>@])],
       [
         DEBUG_LEVEL="${withval}"
         if test "x$ENABLE_DEBUG" = xyes; then
@@ -79,7 +79,7 @@
       test "x$DEBUG_LEVEL" != xoptimized && \
       test "x$DEBUG_LEVEL" != xfastdebug && \
       test "x$DEBUG_LEVEL" != xslowdebug; then
-    AC_MSG_ERROR([Allowed debug levels are: release, fastdebug and slowdebug])
+    AC_MSG_ERROR([Allowed debug levels are: release, fastdebug, slowdebug and optimized])
   fi
 ])
 
@@ -176,6 +176,22 @@
   fi
   AC_SUBST(UNLIMITED_CRYPTO)
 
+  # Should we build the serviceability agent (SA)?
+  INCLUDE_SA=true
+  if test "x$JVM_VARIANT_ZERO" = xtrue ; then
+    INCLUDE_SA=false
+  fi
+  if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then
+    INCLUDE_SA=false
+  fi
+  if test "x$OPENJDK_TARGET_OS" = xaix ; then
+    INCLUDE_SA=false
+  fi
+  if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
+    INCLUDE_SA=false
+  fi
+  AC_SUBST(INCLUDE_SA)
+
   # Compress jars
   COMPRESS_JARS=false
 
@@ -222,7 +238,7 @@
   AC_MSG_CHECKING([what type of native debug symbols to use])
   AC_ARG_WITH([native-debug-symbols],
       [AS_HELP_STRING([--with-native-debug-symbols],
-      [set the native debug symbol configuration (none, internal, external, zipped) @<:@zipped@:>@])],
+      [set the native debug symbol configuration (none, internal, external, zipped) @<:@varying@:>@])],
       [
         if test "x$OPENJDK_TARGET_OS" = xaix; then
           if test "x$withval" = xexternal || test "x$withval" = xzipped; then
@@ -235,7 +251,11 @@
           # AIX doesn't support 'zipped' so use 'internal' as default
           with_native_debug_symbols="internal"
         else
-          with_native_debug_symbols="zipped"
+          if test "x$STATIC_BUILD" = xtrue; then
+            with_native_debug_symbols="none"
+          else
+            with_native_debug_symbols="zipped"
+          fi
         fi
       ])
   NATIVE_DEBUG_SYMBOLS=$with_native_debug_symbols
@@ -258,7 +278,7 @@
     # Hotspot legacy support, not relevant with COPY_DEBUG_SYMBOLS=true
     DEBUG_BINARIES=false
     STRIP_POLICY=min_strip
-    
+
   elif test "x$NATIVE_DEBUG_SYMBOLS" = xnone; then
     COMPILE_WITH_DEBUG_SYMBOLS=false
     COPY_DEBUG_SYMBOLS=false
@@ -275,7 +295,7 @@
     DEBUG_BINARIES=true
     STRIP_POLICY=no_strip
     STRIP=""
-    
+
   elif test "x$NATIVE_DEBUG_SYMBOLS" = xexternal; then
 
     if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
@@ -356,7 +376,7 @@
 
 ################################################################################
 #
-# Static build support.  When enabled will generate static 
+# Static build support.  When enabled will generate static
 # libraries instead of shared libraries for all JDK libs.
 #
 AC_DEFUN_ONCE([JDKOPT_SETUP_STATIC_BUILD],
--- a/common/autoconf/spec.gmk.in	Thu Feb 11 16:05:16 2016 -0800
+++ b/common/autoconf/spec.gmk.in	Fri Feb 12 11:07:35 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -36,10 +36,12 @@
 # A self-referential reference to this file.
 SPEC:=@SPEC@
 
-# SPACE is defined in MakeBase.gmk, but it is also used in := rules here for some
-# toolchains, and is needed if MakeBase.gmk is not included before this file.
+# SPACE and COMMA are defined in MakeBase.gmk, but they are also used in
+# some definitions here, and are needed if MakeBase.gmk is not included before
+# this file.
 X:=
 SPACE:=$(X) $(X)
+COMMA:=,
 
 # What make to use for main processing, after bootstrapping top-level Makefile.
 MAKE := @MAKE@
@@ -350,10 +352,8 @@
 CXXFLAGS_JDKEXE:=@CXXFLAGS_JDKEXE@
 
 CXX:=@FIXPATH@ @CCACHE@ @ICECC@ @CXX@
-#CXXFLAGS:=@CXXFLAGS@
 
 CPP:=@FIXPATH@ @CPP@
-#CPPFLAGS:=@CPPFLAGS@
 
 # The linker can be gcc or ld on unix systems, or link.exe on windows systems.
 LD:=@FIXPATH@ @LD@
@@ -501,7 +501,7 @@
 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_JAVADOC = $(INTERIM_LANGTOOLS_ARGS) jdk.javadoc.internal.tool.Main
 
 # Base flags for RC
 # Guarding this against resetting value. Legacy make files include spec multiple
--- a/common/autoconf/toolchain.m4	Thu Feb 11 16:05:16 2016 -0800
+++ b/common/autoconf/toolchain.m4	Fri Feb 12 11:07:35 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,67 @@
 TOOLCHAIN_DESCRIPTION_solstudio="Oracle Solaris Studio"
 TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
 
+# Minimum supported versions, empty means unspecified
+TOOLCHAIN_MINIMUM_VERSION_clang="3.2"
+TOOLCHAIN_MINIMUM_VERSION_gcc="4.3"
+TOOLCHAIN_MINIMUM_VERSION_microsoft=""
+TOOLCHAIN_MINIMUM_VERSION_solstudio="5.12"
+TOOLCHAIN_MINIMUM_VERSION_xlc=""
+
+# Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
+# Must have CC_VERSION_NUMBER and CXX_VERSION_NUMBER.
+AC_DEFUN([TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS],
+[
+  if test "x$CC_VERSION_NUMBER" != "x$CXX_VERSION_NUMBER"; then
+    AC_MSG_WARN([C and C++ compiler has different version numbers, $CC_VERSION_NUMBER vs $CXX_VERSION_NUMBER.])
+    AC_MSG_WARN([This typically indicates a broken setup, and is not supported])
+  fi
+
+  # We only check CC_VERSION_NUMBER since we assume CXX_VERSION_NUMBER is equal.
+  if [ [[ "$CC_VERSION_NUMBER" =~ (.*\.){3} ]] ]; then
+    AC_MSG_WARN([C compiler version number has more than three parts (X.Y.Z): $CC_VERSION_NUMBER. Comparisons might be wrong.])
+  fi
+
+  if [ [[  "$CC_VERSION_NUMBER" =~ [0-9]{6} ]] ]; then
+    AC_MSG_WARN([C compiler version number has a part larger than 99999: $CC_VERSION_NUMBER. Comparisons might be wrong.])
+  fi
+
+  COMPARABLE_ACTUAL_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", [$]1, [$]2, [$]3) }' <<< "$CC_VERSION_NUMBER"`
+])
+
+# Check if the configured compiler (C and C++) is of a specific version or
+# newer. TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS must have been called before.
+#
+# Arguments:
+#   VERSION:   The version string to check against the found version
+#   IF_AT_LEAST:   block to run if the compiler is at least this version (>=)
+#   IF_OLDER_THAN:   block to run if the compiler is older than this version (<)
+BASIC_DEFUN_NAMED([TOOLCHAIN_CHECK_COMPILER_VERSION],
+    [*VERSION IF_AT_LEAST IF_OLDER_THAN], [$@],
+[
+  # Need to assign to a variable since m4 is blocked from modifying parts in [].
+  REFERENCE_VERSION=ARG_VERSION
+
+  if [ [[ "$REFERENCE_VERSION" =~ (.*\.){3} ]] ]; then
+    AC_MSG_ERROR([Internal errror: Cannot compare to ARG_VERSION, only three parts (X.Y.Z) is supported])
+  fi
+
+  if [ [[ "$REFERENCE_VERSION" =~ [0-9]{6} ]] ]; then
+    AC_MSG_ERROR([Internal errror: Cannot compare to ARG_VERSION, only parts < 99999 is supported])
+  fi
+
+  # Version comparison method inspired by http://stackoverflow.com/a/24067243
+  COMPARABLE_REFERENCE_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", [$]1, [$]2, [$]3) }' <<< "$REFERENCE_VERSION"`
+
+  if test $COMPARABLE_ACTUAL_VERSION -ge $COMPARABLE_REFERENCE_VERSION ; then
+    :
+    ARG_IF_AT_LEAST
+  else
+    :
+    ARG_IF_OLDER_THAN
+  fi
+])
+
 # Setup a number of variables describing how native output files are
 # named on this platform/toolchain.
 AC_DEFUN([TOOLCHAIN_SETUP_FILENAME_PATTERNS],
@@ -175,6 +236,8 @@
   # Use indirect variable referencing
   toolchain_var_name=TOOLCHAIN_DESCRIPTION_$TOOLCHAIN_TYPE
   TOOLCHAIN_DESCRIPTION=${!toolchain_var_name}
+  toolchain_var_name=TOOLCHAIN_MINIMUM_VERSION_$TOOLCHAIN_TYPE
+  TOOLCHAIN_MINIMUM_VERSION=${!toolchain_var_name}
   toolchain_var_name=TOOLCHAIN_CC_BINARY_$TOOLCHAIN_TYPE
   TOOLCHAIN_CC_BINARY=${!toolchain_var_name}
   toolchain_var_name=TOOLCHAIN_CXX_BINARY_$TOOLCHAIN_TYPE
@@ -217,8 +280,14 @@
     export INCLUDE="$VS_INCLUDE"
     export LIB="$VS_LIB"
   else
-    # Currently we do not define this for other toolchains. This might change as the need arise.
-    TOOLCHAIN_VERSION=
+    if test "x$XCODE_VERSION_OUTPUT" != x; then
+      # For Xcode, we set the Xcode version as TOOLCHAIN_VERSION
+      TOOLCHAIN_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | $CUT -f 2 -d ' '`
+      TOOLCHAIN_DESCRIPTION="$TOOLCHAIN_DESCRIPTION from Xcode"
+    else
+      # Currently we do not define this for other toolchains. This might change as the need arise.
+      TOOLCHAIN_VERSION=
+    fi
   fi
   AC_SUBST(TOOLCHAIN_VERSION)
 
@@ -257,7 +326,7 @@
 #
 # $1 = compiler to test (CC or CXX)
 # $2 = human readable name of compiler (C or C++)
-AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSION],
+AC_DEFUN([TOOLCHAIN_EXTRACT_COMPILER_VERSION],
 [
   COMPILER=[$]$1
   COMPILER_NAME=$2
@@ -354,7 +423,7 @@
     # Collapse compiler output into a single line
     COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
     COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
-        $SED -e 's/^.*clang version \(@<:@1-9@:>@@<:@0-9.@:>@*\).*$/\1/'`
+        $SED -e 's/^.* version \(@<:@1-9@:>@@<:@0-9.@:>@*\).*$/\1/'`
   else
       AC_MSG_ERROR([Unknown toolchain type $TOOLCHAIN_TYPE.])
   fi
@@ -451,7 +520,7 @@
     fi
   fi
 
-  TOOLCHAIN_CHECK_COMPILER_VERSION([$1], [$COMPILER_NAME])
+  TOOLCHAIN_EXTRACT_COMPILER_VERSION([$1], [$COMPILER_NAME])
 ])
 
 # Detect the core components of the toolchain, i.e. the compilers (CC and CXX),
@@ -471,6 +540,20 @@
   # Now that we have resolved CXX ourself, let autoconf have its go at it
   AC_PROG_CXX([$CXX])
 
+  # This is the compiler version number on the form X.Y[.Z]
+  AC_SUBST(CC_VERSION_NUMBER)
+  AC_SUBST(CXX_VERSION_NUMBER)
+
+  TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS
+
+  if test "x$TOOLCHAIN_MINIMUM_VERSION" != x; then
+    TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: $TOOLCHAIN_MINIMUM_VERSION,
+        IF_OLDER_THAN: [
+          AC_MSG_WARN([You are using $TOOLCHAIN_TYPE older than $TOOLCHAIN_MINIMUM_VERSION. This is not a supported configuration.])
+        ]
+    )
+  fi
+
   #
   # Setup the preprocessor (CPP and CXXCPP)
   #
--- a/common/bin/compare.sh	Thu Feb 11 16:05:16 2016 -0800
+++ b/common/bin/compare.sh	Fri Feb 12 11:07:35 2016 +0100
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# 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
@@ -746,6 +746,9 @@
     elif [ "$OPENJDK_TARGET_OS" = "aix" ]; then
         $OBJDUMP -T $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
         $OBJDUMP -T $ORIG_THIS_FILE  2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
+    elif [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
+        $NM -j $ORIG_OTHER_FILE 2> /dev/null | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
+        $NM -j $ORIG_THIS_FILE  2> /dev/null | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
     else
         $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
         $NM -a $ORIG_THIS_FILE  2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
@@ -1020,14 +1023,6 @@
 ################################################################################
 # Initiate configuration
 
-COMPARE_ROOT=/tmp/cimages.$USER
-$MKDIR -p $COMPARE_ROOT
-if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
-    if [ "$(uname -o)" = "Cygwin" ]; then
-        COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT)
-    fi
-fi
-
 THIS="$SCRIPT_DIR"
 echo "$THIS"
 THIS_SCRIPT="$0"
@@ -1050,6 +1045,7 @@
     echo ""
     echo "--sort-symbols      Sort all symbols before comparing"
     echo "--strip             Strip all binaries before comparing"
+    echo "--clean             Clean all previous comparison results first"
     echo ""
     echo "[FILTER]            List filenames in the image to compare, works for jars, zips, libs and execs"
     echo "Example:"
@@ -1149,6 +1145,9 @@
         --strip)
             STRIP_ALL=true
             ;;
+        --clean)
+            CLEAN_OUTPUT=true
+            ;;
         *)
             CMP_NAMES=false
             CMP_PERMS=false
@@ -1167,6 +1166,23 @@
     shift
 done
 
+if [ "$STRIP_ALL" = "true" ] && [ -z "$STRIP" ]; then
+  echo Warning: Not stripping even with --strip, since strip is missing on this platform
+  STRIP_ALL=false
+fi
+
+COMPARE_ROOT=/tmp/cimages.$USER
+if [ "$CLEAN_OUTPUT" = "true" ]; then
+    echo Cleaning old output in $COMPARE_ROOT.
+    $RM -rf $COMPARE_ROOT
+fi
+$MKDIR -p $COMPARE_ROOT
+if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
+    if [ "$(uname -o)" = "Cygwin" ]; then
+        COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT)
+    fi
+fi
+
 if [ "$CMP_2_ZIPS" = "true" ]; then
     THIS_DIR="$(dirname $THIS_FILE)"
     THIS_DIR="$(cd "$THIS_DIR" > /dev/null && pwd )"
--- a/common/bin/compare_exceptions.sh.incl	Thu Feb 11 16:05:16 2016 -0800
+++ b/common/bin/compare_exceptions.sh.incl	Fri Feb 12 11:07:35 2016 +0100
@@ -563,6 +563,7 @@
       ./Contents/Home/lib/libnpjp2.dylib
       ./Contents/Home/lib/libosx.dylib
       ./Contents/Home/lib/libosxapp.dylib
+      ./Contents/Home/lib/libosxui.dylib
       ./Contents/Home/lib/libverify.dylib
       ./Contents/Home/lib/libsaproc.dylib
       ./Contents/Home/lib/libsplashscreen.dylib
--- a/make/Main.gmk	Thu Feb 11 16:05:16 2016 -0800
+++ b/make/Main.gmk	Fri Feb 12 11:07:35 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -431,7 +431,7 @@
 
   # The annotation processing for jdk.vm.ci needs java.base classes from the
   # current JDK.
-  jdk.vm.ci-gensrc-hotspot: java.base-java 
+  jdk.vm.ci-gensrc-hotspot: java.base-java
 
   # Explicitly add dependencies for special targets
   java.base-java: unpack-sec
--- a/make/StripBinaries.gmk	Thu Feb 11 16:05:16 2016 -0800
+++ b/make/StripBinaries.gmk	Fri Feb 12 11:07:35 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -57,8 +57,12 @@
 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))
+    $(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))
 
--- a/make/common/NativeCompilation.gmk	Thu Feb 11 16:05:16 2016 -0800
+++ b/make/common/NativeCompilation.gmk	Fri Feb 12 11:07:35 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -187,25 +187,30 @@
   # param 6 = the c++ flags to the compiler
   # param 7 = the c++ compiler
   # param 8 = the flags to the assembler
+  # param 9 = set to disable THIS_FILE
+
+  ifeq ($9, )
+    $1_$2_THIS_FILE = -DTHIS_FILE='"$$(<F)"'
+  endif
 
   ifneq (,$$(filter %.c,$2))
     # Compile as a C file
-    $1_$2_FLAGS=$(CFLAGS_CCACHE) $4 $$($1_$(notdir $2)_CFLAGS) -DTHIS_FILE='"$$(<F)"' -c
+    $1_$2_FLAGS=$(CFLAGS_CCACHE) $4 $$($1_$(notdir $2)_CFLAGS) $$($1_$2_THIS_FILE) -c
     $1_$2_COMP=$5
     $1_$2_DEP_FLAG:=$(C_FLAG_DEPS)
   else ifneq (,$$(filter %.m,$2))
     # Compile as an Objective-C file
-    $1_$2_FLAGS=-x objective-c $(CFLAGS_CCACHE) $4 $$($1_$(notdir $2)_CFLAGS) -DTHIS_FILE='"$$(<F)"' -c
+    $1_$2_FLAGS=-x objective-c $(CFLAGS_CCACHE) $4 $$($1_$(notdir $2)_CFLAGS) $$($1_$2_THIS_FILE) -c
     $1_$2_COMP=$5
     $1_$2_DEP_FLAG:=$(C_FLAG_DEPS)
   else ifneq (,$$(filter %.s %.S,$2))
     # Compile as assembler file
-    $1_$2_FLAGS=$8 -DTHIS_FILE='"$$(<F)"'
+    $1_$2_FLAGS=$8
     $1_$2_COMP=$(AS)
     $1_$2_DEP_FLAG:=
   else ifneq (,$$(filter %.cpp,$2)$$(filter %.cc,$2)$$(filter %.mm,$2))
     # Compile as a C++ or Objective-C++ file
-    $1_$2_FLAGS=$(CFLAGS_CCACHE) $6 $$($1_$(notdir $2)_CXXFLAGS) -DTHIS_FILE='"$$(<F)"' -c
+    $1_$2_FLAGS=$(CFLAGS_CCACHE) $6 $$($1_$(notdir $2)_CXXFLAGS) $$($1_$2_THIS_FILE) -c
     $1_$2_COMP=$7
     $1_$2_DEP_FLAG:=$(CXX_FLAG_DEPS)
   else
@@ -304,8 +309,11 @@
 #   EXTRA_OBJECT_FILES List of extra object files to include when linking
 #   VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
 #   RC_FLAGS flags for RC.
+#   EMBED_MANIFEST if true, embed manifest on Windows.
 #   MAPFILE mapfile
 #   REORDER reorder file
+#   USE_MAPFILE_FOR_SYMBOLS if true and this is a STATIC_BUILD, just copy the
+#       mapfile for the output symbols file
 #   CC the compiler to use, default is $(CC)
 #   LD the linker to use, default is $(LD)
 #   OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST
@@ -643,8 +651,9 @@
 
       $$($1_RES): $$($1_VERSIONINFO_RESOURCE) $$($1_RES_VARDEPS_FILE)
 		$$(call LogInfo, Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$(notdir $$($1_TARGET))))
-		$$($1_RC) $$($1_RC_FLAGS) $$($1_SYSROOT_CFLAGS) $(CC_OUT_OPTION)$$@ \
-		    $$($1_VERSIONINFO_RESOURCE)
+		$$(call ExecuteWithLog, $$@, \
+		    $$($1_RC) $$($1_RC_FLAGS) $$($1_SYSROOT_CFLAGS) $(CC_OUT_OPTION)$$@ \
+		    $$($1_VERSIONINFO_RESOURCE))
                 # Windows RC compiler does not support -showIncludes, so we mis-use CL for this.
 		$$($1_CC) $$($1_RC_FLAGS) $$($1_SYSROOT_CFLAGS) -showIncludes -nologo -TC \
 		    $(CC_OUT_OPTION)$$($1_RES_DEP).obj $$($1_VERSIONINFO_RESOURCE) > $$($1_RES_DEP).raw 2>&1 || true ; \
@@ -654,12 +663,11 @@
     endif
   endif
 
-  # mapfile doesnt seem to be implemented on macosx (yet??)
-  ifneq ($(OPENJDK_TARGET_OS),macosx)
+  ifneq ($(DISABLE_MAPFILES),true)
+    $1_REAL_MAPFILE := $$($1_MAPFILE)
     ifneq ($(OPENJDK_TARGET_OS),windows)
-      $1_REAL_MAPFILE:=$$($1_MAPFILE)
       ifneq (,$$($1_REORDER))
-        $1_REAL_MAPFILE:=$$($1_OBJECT_DIR)/mapfile
+        $1_REAL_MAPFILE := $$($1_OBJECT_DIR)/mapfile
 
         $$($1_REAL_MAPFILE) : $$($1_MAPFILE) $$($1_REORDER)
 		$$(MKDIR) -p $$(@D)
@@ -689,7 +697,8 @@
           # The dependency on TARGET is needed on windows for debuginfo files
           # to be rebuilt properly.
           $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/% $$($1_TARGET)
-		$(CP) $$< $$@
+                # Use cp -r since on macosx, the dSYM is a directory
+		$(CP) -r $$< $$@
         endif
 
         # Generate debuginfo files.
@@ -815,13 +824,23 @@
         $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
 
     # Generating a static library, ie object file archive.
-    $$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE)
+    ifeq ($(STATIC_BUILD), true)
+      ifeq ($$($1_USE_MAPFILE_FOR_SYMBOLS), true)
+        STATIC_MAPFILE_DEP := $$($1_MAPFILE)
+      endif
+    endif
+
+    $$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE) $$(STATIC_MAPFILE_DEP)
 	$$(call LogInfo, Archiving $$($1_STATIC_LIBRARY))
 	$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \
 	    $$($1_AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_ALL_OBJS) \
 	        $$($1_RES))
         ifeq ($(STATIC_BUILD), true)
-	  $(GetSymbols)
+          ifeq ($$($1_USE_MAPFILE_FOR_SYMBOLS), true)
+	    $(CP) $$($1_MAPFILE) $$(@D)/$$(basename $$(@F)).symbols
+          else
+	    $(GetSymbols)
+          endif
         endif
   endif
 
@@ -836,6 +855,12 @@
     $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
         $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
 
+    ifeq ($(OPENJDK_TARGET_OS), windows)
+      ifeq ($$($1_EMBED_MANIFEST), true)
+        $1_EXTRA_LDFLAGS += -manifest:embed
+      endif
+    endif
+
     $$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \
         $$($1_VARDEPS_FILE)
 		$$(call LogInfo, Linking executable $$($1_BASENAME))