summaryrefslogtreecommitdiff
path: root/lang/openjdk8/patches
diff options
context:
space:
mode:
authorfhajny <fhajny>2015-07-03 20:40:59 +0000
committerfhajny <fhajny>2015-07-03 20:40:59 +0000
commitfa7d29723932807cfe125152bb343ee86a1bef1d (patch)
tree72f551af8234afb2bc26de703240933b59f4a317 /lang/openjdk8/patches
parent53c7846c9d2fec056fee3a7bcd1ff4ec85b7c55e (diff)
downloadpkgsrc-fa7d29723932807cfe125152bb343ee86a1bef1d.tar.gz
Add support for building with GCC on SunOS, largely based on openjdk7
patches by jesse et al. Fixes build on SunOS.
Diffstat (limited to 'lang/openjdk8/patches')
-rw-r--r--lang/openjdk8/patches/patch-common_autoconf_generated-configure.sh83
-rw-r--r--lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_adlc.make18
-rw-r--r--lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_build__vm__def.sh14
-rw-r--r--lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_debug.make19
-rw-r--r--lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_dtrace.make56
-rw-r--r--lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_fastdebug.make19
-rw-r--r--lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_gcc.make136
-rw-r--r--lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_jsig.make33
-rw-r--r--lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_mapfile-vers-COMPILER1.gcc53
-rw-r--r--lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_mapfile-vers-COMPILER2.gcc56
-rw-r--r--lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_mapfile-vers-TIERED.gcc55
-rw-r--r--lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_optimized.make19
-rw-r--r--lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_product.make25
-rw-r--r--lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_saproc.make23
-rw-r--r--lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_vm.make41
-rw-r--r--lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_atomic__solaris__x86.inline.hpp92
-rw-r--r--lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_orderAccess__solaris__x86.inline.hpp18
-rw-r--r--lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_os__solaris__x86.cpp63
-rw-r--r--lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_prefetch__solaris__x86.inline.hpp35
-rw-r--r--lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_threadLS__solaris__x86.hpp18
-rw-r--r--lang/openjdk8/patches/patch-hotspot_src_os_bsd_vm_osThread__bsd.cpp13
-rw-r--r--lang/openjdk8/patches/patch-hotspot_src_os_posix_vm_os__posix.cpp14
-rw-r--r--lang/openjdk8/patches/patch-hotspot_src_os_solaris_dtrace_jhelper.d81
-rw-r--r--lang/openjdk8/patches/patch-hotspot_src_os_solaris_vm_decoder__solaris.cpp18
-rw-r--r--lang/openjdk8/patches/patch-hotspot_src_os_solaris_vm_os__solaris.cpp137
-rw-r--r--lang/openjdk8/patches/patch-hotspot_src_os_solaris_vm_perfMemory__solaris.cpp24
-rw-r--r--lang/openjdk8/patches/patch-hotspot_src_share_vm_utilities_globalDefinitions__gcc.hpp13
-rw-r--r--lang/openjdk8/patches/patch-hotspot_src_share_vm_utilities_hashtable.cpp15
-rw-r--r--lang/openjdk8/patches/patch-jdk_make_CompileDemos.gmk49
-rw-r--r--lang/openjdk8/patches/patch-jdk_make_CompileLaunchers.gmk16
-rw-r--r--lang/openjdk8/patches/patch-jdk_make_Images.gmk22
-rw-r--r--lang/openjdk8/patches/patch-jdk_make_lib_Awt2dLibraries.gmk14
-rw-r--r--lang/openjdk8/patches/patch-jdk_make_lib_NioLibraries.gmk25
-rw-r--r--lang/openjdk8/patches/patch-jdk_make_lib_SoundLibraries.gmk13
-rw-r--r--lang/openjdk8/patches/patch-jdk_src_share_native_sun_security_ec_impl_ecc__impl.h33
-rw-r--r--lang/openjdk8/patches/patch-jdk_src_solaris_bin_ergo__i586.c50
36 files changed, 1390 insertions, 23 deletions
diff --git a/lang/openjdk8/patches/patch-common_autoconf_generated-configure.sh b/lang/openjdk8/patches/patch-common_autoconf_generated-configure.sh
index 6587bd18fda..a17946ba6b2 100644
--- a/lang/openjdk8/patches/patch-common_autoconf_generated-configure.sh
+++ b/lang/openjdk8/patches/patch-common_autoconf_generated-configure.sh
@@ -1,4 +1,8 @@
-$NetBSD: patch-common_autoconf_generated-configure.sh,v 1.5 2015/06/27 22:37:42 joerg Exp $
+$NetBSD: patch-common_autoconf_generated-configure.sh,v 1.6 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support on SunOS.
+Fix max heap.
+Avoid requiring ALSA.
--- common/autoconf/generated-configure.sh.orig 2015-06-10 10:29:06.000000000 +0000
+++ common/autoconf/generated-configure.sh
@@ -42,7 +46,7 @@ $NetBSD: patch-common_autoconf_generated-configure.sh,v 1.5 2015/06/27 22:37:42
# This is not a symbolic link! We are done!
break
fi
-@@ -16217,16 +16217,15 @@ $as_echo_n "checking flags for boot jdk
+@@ -16217,16 +16217,15 @@ $as_echo_n "checking flags for boot jdk
# Maximum amount of heap memory.
# Maximum stack size.
if test "x$BUILD_NUM_BITS" = x32; then
@@ -60,6 +64,15 @@ $NetBSD: patch-common_autoconf_generated-configure.sh,v 1.5 2015/06/27 22:37:42
$ECHO "Check if jvm arg is ok: -Xmx$JVM_MAX_HEAP" >&5
$ECHO "Command: $JAVA -Xmx$JVM_MAX_HEAP -version" >&5
+@@ -19320,7 +19319,7 @@ $as_echo "$as_me: Downloading build depe
+ elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then
+ COMPILER_CHECK_LIST="cl"
+ elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
+- COMPILER_CHECK_LIST="cc gcc"
++ COMPILER_CHECK_LIST="gcc cc"
+ elif test "x$OPENJDK_TARGET_OS" = "xaix"; then
+ # Do not probe for cc on AIX.
+ COMPILER_CHECK_LIST="xlc_r"
@@ -19774,7 +19773,7 @@ $as_echo_n "checking resolved symbolic l
# Resolve file symlinks
while test $COUNTER -lt 20; do
@@ -78,6 +91,15 @@ $NetBSD: patch-common_autoconf_generated-configure.sh,v 1.5 2015/06/27 22:37:42
# This is not a symbolic link! We are done!
break
fi
+@@ -20240,7 +20239,7 @@ $as_echo "no, keeping CC" >&6; }
+ COMPILER=$CC
+ COMPILER_NAME=$COMPILER_NAME
+
+- if test "x$OPENJDK_TARGET_OS" = xsolaris; then
++ if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$GCC" = xno; then
+ # Make sure we use the Sun Studio compiler and not gcc on Solaris, which won't work
+ COMPILER_VERSION_TEST=`$COMPILER -V 2>&1 | $HEAD -n 1`
+ $ECHO $COMPILER_VERSION_TEST | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null
@@ -21375,7 +21374,7 @@ $as_echo_n "checking resolved symbolic l
# Resolve file symlinks
while test $COUNTER -lt 20; do
@@ -96,7 +118,45 @@ $NetBSD: patch-common_autoconf_generated-configure.sh,v 1.5 2015/06/27 22:37:42
# This is not a symbolic link! We are done!
break
fi
-@@ -29862,7 +29861,7 @@ fi
+@@ -21841,7 +21840,7 @@ $as_echo "no, keeping CXX" >&6; }
+ COMPILER=$CXX
+ COMPILER_NAME=$COMPILER_NAME
+
+- if test "x$OPENJDK_TARGET_OS" = xsolaris; then
++ if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$GCC" = xno; then
+ # Make sure we use the Sun Studio compiler and not gcc on Solaris, which won't work
+ COMPILER_VERSION_TEST=`$COMPILER -V 2>&1 | $HEAD -n 1`
+ $ECHO $COMPILER_VERSION_TEST | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null
+@@ -29520,6 +29519,14 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
+ if test "x$OPENJDK_TARGET_OS" = xbsd || test "x$OPENJDK_TARGET_OS" = xmacosx; then
+ SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
+ fi
++ if test "x$OPENJDK_TARGET_OS" = xsolaris; then
++ SET_SHARED_LIBRARY_NAME=''
++ SET_SHARED_LIBRARY_MAPFILE=''
++ SET_SHARED_LIBRARY_ORIGIN='-R\$$$$ORIGIN$1'
++ SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
++ CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
++ CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
++ fi
+ else
+ if test "x$OPENJDK_TARGET_OS" = xsolaris; then
+ # If it is not gcc, then assume it is the Oracle Solaris Studio Compiler
+@@ -29661,6 +29668,13 @@ rm -f core conftest.err conftest.$ac_obj
+ C_O_FLAG_NORM="-Os"
+ C_O_FLAG_NONE=""
+ ;;
++ solaris )
++ # libverify currently crashes in 32-bit builds with
++ # alignment faults, temporary workaround with -O2
++ C_O_FLAG_HI="-O2"
++ C_O_FLAG_NORM="-O2"
++ C_O_FLAG_NONE="-O0"
++ ;;
+ *)
+ C_O_FLAG_HI="-O3"
+ C_O_FLAG_NORM="-O2"
+@@ -29862,7 +29875,7 @@ fi
#
case $COMPILER_NAME in
gcc )
@@ -105,7 +165,7 @@ $NetBSD: patch-common_autoconf_generated-configure.sh,v 1.5 2015/06/27 22:37:42
-pipe \
-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
case $OPENJDK_TARGET_CPU_ARCH in
-@@ -30475,7 +30474,8 @@ $as_echo "alsa pulse x11" >&6; }
+@@ -30475,7 +30488,8 @@ $as_echo "alsa pulse x11" >&6; }
if test "x$OPENJDK_TARGET_OS" = xbsd; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what is not needed on BSD?" >&5
$as_echo_n "checking what is not needed on BSD?... " >&6; }
@@ -115,7 +175,7 @@ $NetBSD: patch-common_autoconf_generated-configure.sh,v 1.5 2015/06/27 22:37:42
ALSA_NOT_NEEDED=yes
PULSE_NOT_NEEDED=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: alsa pulse" >&5
-@@ -31701,7 +31701,11 @@ $as_echo "$as_me: WARNING: freetype not
+@@ -31701,7 +31715,11 @@ $as_echo "$as_me: WARNING: freetype not
# Allow --with-freetype-lib and --with-freetype-include to override
if test "x$with_freetype_include" != x; then
@@ -128,7 +188,7 @@ $NetBSD: patch-common_autoconf_generated-configure.sh,v 1.5 2015/06/27 22:37:42
fi
if test "x$with_freetype_lib" != x; then
POTENTIAL_FREETYPE_LIB_PATH="$with_freetype_lib"
-@@ -34519,7 +34523,7 @@ $as_echo "$as_me: The path of FREETYPE_I
+@@ -34519,7 +34537,7 @@ $as_echo "$as_me: The path of FREETYPE_I
FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
fi
@@ -137,7 +197,7 @@ $NetBSD: patch-common_autoconf_generated-configure.sh,v 1.5 2015/06/27 22:37:42
FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH/freetype2 -I$FREETYPE_INCLUDE_PATH"
else
FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH"
-@@ -34652,7 +34656,7 @@ $as_echo "$as_me: The path of FREETYPE_L
+@@ -34652,7 +34670,7 @@ $as_echo "$as_me: The path of FREETYPE_L
if test "x$OPENJDK_TARGET_OS" = xwindows; then
FREETYPE_LIBS="$FREETYPE_LIB_PATH/freetype.lib"
else
@@ -146,3 +206,12 @@ $NetBSD: patch-common_autoconf_generated-configure.sh,v 1.5 2015/06/27 22:37:42
fi
fi
+@@ -35923,7 +35941,7 @@ fi
+ fi
+
+ # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so)
+- if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$LIBCXX" = x; then
++ if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$LIBCXX" = x && test "x$GCC" = "xno"; then
+ LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
+ fi
+
diff --git a/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_adlc.make b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_adlc.make
new file mode 100644
index 00000000000..9b7cbabdef3
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_adlc.make
@@ -0,0 +1,18 @@
+$NetBSD: patch-hotspot_make_solaris_makefiles_adlc.make,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/make/solaris/makefiles/adlc.make.orig 2013-02-19 23:21:59.000000000 +0000
++++ hotspot/make/solaris/makefiles/adlc.make
+@@ -75,9 +75,11 @@ endif
+
+ # CFLAGS_WARN holds compiler options to suppress/enable warnings.
+ # Compiler warnings are treated as errors
++ifeq ("${Platform_compiler}", "sparcWorks")
+ ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
+ CFLAGS_WARN = +w -errwarn
+ endif
++endif
+ CFLAGS += $(CFLAGS_WARN)
+
+ ifeq ("${Platform_compiler}", "sparcWorks")
diff --git a/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_build__vm__def.sh b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_build__vm__def.sh
new file mode 100644
index 00000000000..1efcdd62b3c
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_build__vm__def.sh
@@ -0,0 +1,14 @@
+$NetBSD: patch-hotspot_make_solaris_makefiles_build__vm__def.sh,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+Fix path to nm.
+
+--- hotspot/make/solaris/makefiles/build_vm_def.sh.orig 2013-02-19 23:21:59.000000000 +0000
++++ hotspot/make/solaris/makefiles/build_vm_def.sh
+@@ -1,6 +1,6 @@
+ #!/bin/sh
+
+-/usr/ccs/bin/nm -p $* \
++/usr/bin/nm -p $* \
+ | awk '{
+ if ($2 == "U") next
+ if ($3 ~ /^__1c.*__vtbl_$/ || $3 ~ /^gHotSpotVM/) print "\t" $3 ";"
diff --git a/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_debug.make b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_debug.make
new file mode 100644
index 00000000000..97a6ecfa485
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_debug.make
@@ -0,0 +1,19 @@
+$NetBSD: patch-hotspot_make_solaris_makefiles_debug.make,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/make/solaris/makefiles/debug.make.orig 2015-02-02 15:32:37.000000000 +0000
++++ hotspot/make/solaris/makefiles/debug.make
+@@ -49,7 +49,11 @@ MAPFILE = $(GAMMADIR)/make/solaris/makef
+
+ # This mapfile is only needed when compiling with dtrace support,
+ # and mustn't be otherwise.
+-MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE)
++ifdef USE_GCC
++ MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE).gcc
++else
++ MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE)
++endif # USE_GCC
+
+ VERSION = debug
+ SYSDEFS += -DASSERT
diff --git a/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_dtrace.make b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_dtrace.make
new file mode 100644
index 00000000000..0e1fe2eb9d6
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_dtrace.make
@@ -0,0 +1,56 @@
+$NetBSD: patch-hotspot_make_solaris_makefiles_dtrace.make,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+Enable DTrace support with GCC.
+
+--- hotspot/make/solaris/makefiles/dtrace.make.orig 2015-06-10 10:31:44.000000000 +0000
++++ hotspot/make/solaris/makefiles/dtrace.make
+@@ -29,13 +29,6 @@
+
+ ifneq ("${TYPE}", "CORE")
+
+-ifdef USE_GCC
+-
+-dtraceCheck:
+- $(QUIETLY) echo "**NOTICE** Dtrace support disabled for gcc builds"
+-
+-else
+-
+ JVM_DB = libjvm_db
+ LIBJVM_DB = libjvm_db.so
+
+@@ -56,14 +49,23 @@ DTRACE_SRCDIR = $(GAMMADIR)/src/os/$(Pla
+ DTRACE = dtrace
+ DTRACE.o = $(DTRACE).o
+
+-# to remove '-g' option which causes link problems
+-# also '-z nodefs' is used as workaround
+-GENOFFS_CFLAGS = $(shell echo $(CFLAGS) | sed -e 's/ -g / /g' -e 's/ -g0 / /g';)
++ifdef USE_GCC
++ # solaris linker does not like gcc and -fvisibility=hidden without mapfiles
++ GENOFFS_CFLAGS = $(shell echo $(CFLAGS) | sed -e 's/ -g / /g' -e 's/ -g0 / /g' -e 's/ -fvisibility=hidden / /g';)
++else
++ # to remove '-g' option which causes link problems
++ # also '-z nodefs' is used as workaround
++ GENOFFS_CFLAGS = $(shell echo $(CFLAGS) | sed -e 's/ -g / /g' -e 's/ -g0 / /g';)
++endif
+
+ ifdef LP64
+ DTRACE_OPTS = -64 -D_LP64
+ endif
+
++ifdef USE_GCC
++ DTRACE_OPTS = -D_GNU_SOURCE
++endif # USE_GCC
++
+ # making libjvm_db
+
+ # Use mapfile with libjvm_db.so
+@@ -352,8 +354,6 @@ dtraceCheck:
+
+ endif # ifneq ("${dtraceFound}", "")
+
+-endif # ifdef USE_GCC
+-
+ else # CORE build
+
+ dtraceCheck:
diff --git a/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_fastdebug.make b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_fastdebug.make
new file mode 100644
index 00000000000..b5f7fd9ed47
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_fastdebug.make
@@ -0,0 +1,19 @@
+$NetBSD: patch-hotspot_make_solaris_makefiles_fastdebug.make,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/make/solaris/makefiles/fastdebug.make.orig 2015-02-02 15:32:37.000000000 +0000
++++ hotspot/make/solaris/makefiles/fastdebug.make
+@@ -120,7 +120,11 @@ MAPFILE = $(GAMMADIR)/make/solaris/makef
+
+ # This mapfile is only needed when compiling with dtrace support,
+ # and mustn't be otherwise.
+-MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE)
++ifdef USE_GCC
++ MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE).gcc
++else
++ MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE)
++endif # USE_GCC
+
+ VERSION = optimized
+ SYSDEFS += -DASSERT -DCHECK_UNHANDLED_OOPS
diff --git a/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_gcc.make b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_gcc.make
new file mode 100644
index 00000000000..3ab5e8e4627
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_gcc.make
@@ -0,0 +1,136 @@
+$NetBSD: patch-hotspot_make_solaris_makefiles_gcc.make,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/make/solaris/makefiles/gcc.make.orig 2015-02-02 15:32:37.000000000 +0000
++++ hotspot/make/solaris/makefiles/gcc.make
+@@ -70,11 +70,23 @@ VM_PICFLAG/LIBJVM = $(PICFLAG)
+ VM_PICFLAG/AOUT =
+ VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
+
++ifeq ($(JVM_VARIANT_ZERO), true)
++ CFLAGS += $(LIBFFI_CFLAGS)
++endif
++ifeq ($(JVM_VARIANT_ZEROSHARK), true)
++ CFLAGS += $(LIBFFI_CFLAGS)
++ CFLAGS += $(LLVM_CFLAGS)
++endif
+ CFLAGS += $(VM_PICFLAG)
+ CFLAGS += -fno-rtti
+ CFLAGS += -fno-exceptions
+ CFLAGS += -D_REENTRANT
+ CFLAGS += -fcheck-new
++# version 4 and above support fvisibility=hidden (matches jni_x86.h file)
++# except 4.1.2 gives pointless warnings that can't be disabled (afaik)
++ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
++ CFLAGS += -fvisibility=hidden
++endif
+
+ ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
+
+@@ -86,7 +98,8 @@ ARCHFLAG/amd64 = -m64 -march=k8
+
+ # Optional sub-directory in /usr/lib where BUILDARCH libraries are kept.
+ ISA_DIR=$(ISA_DIR/$(BUILDARCH))
+-ISA_DIR/amd64=/amd64
++ISA_DIR/amd64=
++NOMULTIARCHISA_DIR/amd64=/amd64
+ ISA_DIR/i486=
+ ISA_DIR/sparcv9=/64
+
+@@ -94,7 +107,6 @@
+ CFLAGS += $(ARCHFLAG)
+ AOUT_FLAGS += $(ARCHFLAG)
+ LFLAGS += $(ARCHFLAG)
+-ASFLAGS += $(ARCHFLAG)
+
+ ifeq ($(BUILDARCH), amd64)
+ ASFLAGS += -march=k8 -march=amd64
+@@ -107,6 +119,11 @@ ifdef CC_INTERP
+ CFLAGS += -DCC_INTERP
+ endif
+
++# Build for embedded targets
++ifdef JAVASE_EMBEDDED
++ CFLAGS += -DJAVASE_EMBEDDED
++endif
++
+ # Keep temporary files (.ii, .s)
+ ifdef NEED_ASM
+ CFLAGS += -save-temps
+@@ -117,9 +134,18 @@ endif
+
+ # Compiler warnings are treated as errors
+ WARNINGS_ARE_ERRORS = -Werror
+-# Enable these warnings. See 'info gcc' about details on these options
+-WARNING_FLAGS = -Wpointer-arith -Wconversion -Wsign-compare -Wundef
+-CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS)
++
++# Except for a few acceptable ones
++# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
++# conversions which might affect the values. To avoid that, we need to turn
++# it off explicitly.
++ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
++ ACCEPTABLE_WARNINGS = -Wpointer-arith -Wsign-compare
++else
++ ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare -Wundef
++endif
++
++CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
+ # Special cases
+ CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
+
+@@ -177,7 +203,7 @@ MAPFLAG = -Xlinker -M -Xlinker FILENAME
+ endif
+
+ # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
+-SONAMEFLAG = -Xlinker -soname=SONAME
++SONAMEFLAG = -Wl,-soname=SONAME
+
+ # Build shared library
+ SHARED_FLAG = -shared
+@@ -185,15 +211,32 @@ SHARED_FLAG = -shared
+ #------------------------------------------------------------------------
+ # Debug flags
+
+-# Use the stabs format for debugging information (this is the default
+-# on gcc-2.91). It's good enough, has all the information about line
+-# numbers and local variables, and libjvm.so is only about 16M.
+-# Change this back to "-g" if you want the most expressive format.
+-# (warning: that could easily inflate libjvm.so to 150M!)
+-# Note: The Itanium gcc compiler crashes when using -gstabs.
+-DEBUG_CFLAGS/ia64 = -g
+-DEBUG_CFLAGS/amd64 = -g
+-DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
+-ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
+-DEBUG_CFLAGS += -gstabs
+-endif
++# DEBUG_BINARIES uses full -g debug information for all configs
++ifeq ($(DEBUG_BINARIES), true)
++ CFLAGS += -g
++else
++# Use the stabs format for debugging information (this is the default
++# on gcc-2.91). It's good enough, has all the information about line
++# numbers and local variables, and libjvm_g.so is only about 16M.
++# Change this back to "-g" if you want the most expressive format.
++# (warning: that could easily inflate libjvm_g.so to 150M!)
++# Note: The Itanium gcc compiler crashes when using -gstabs.
++DEBUG_CFLAGS/ia64 = -g
++DEBUG_CFLAGS/amd64 = -g
++DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
++ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
++DEBUG_CFLAGS += -gstabs
++endif
++endif
++
++# If we are building HEADLESS, pass on to VM
++# so it can set the java.awt.headless property
++ifdef HEADLESS
++ CFLAGS += -DHEADLESS
++endif
++
++# We are building Embedded for a small device
++# favor code space over speed
++ifdef MINIMIZE_RAM_USAGE
++ CFLAGS += -DMINIMIZE_RAM_USAGE
++endif
diff --git a/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_jsig.make b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_jsig.make
new file mode 100644
index 00000000000..ba35aea8e81
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_jsig.make
@@ -0,0 +1,33 @@
+$NetBSD: patch-hotspot_make_solaris_makefiles_jsig.make,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/make/solaris/makefiles/jsig.make.orig 2015-06-10 10:31:44.000000000 +0000
++++ hotspot/make/solaris/makefiles/jsig.make
+@@ -42,15 +42,25 @@ LIBJSIG_MAPFILE = $(MAKEFILES_DIR)/mapfi
+ LFLAGS_JSIG += $(MAPFLAG:FILENAME=$(LIBJSIG_MAPFILE))
+
+ ifdef USE_GCC
+-LFLAGS_JSIG += -D_REENTRANT
++LFLAGS_JSIG += -D_GNU_SOURCE -D_REENTRANT
+ else
+ LFLAGS_JSIG += -mt -xnolib
+ endif
+
++# DEBUG_BINARIES overrides everything, use full -g debug information
++ifeq ($(DEBUG_BINARIES), true)
++JSIG_DEBUG_CFLAGS = -g
++endif
++
+ $(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
+ @echo Making signal interposition lib...
++ifdef USE_GCC
++ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
++ $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $(JSIGSRCDIR)/jsig.c -ldl
++else
+ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
+ $(LFLAGS_JSIG) -o $@ $(JSIGSRCDIR)/jsig.c -ldl
++endif
+ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO)
+ $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
diff --git a/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_mapfile-vers-COMPILER1.gcc b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_mapfile-vers-COMPILER1.gcc
new file mode 100644
index 00000000000..c3edd864295
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_mapfile-vers-COMPILER1.gcc
@@ -0,0 +1,53 @@
+$NetBSD: patch-hotspot_make_solaris_makefiles_mapfile-vers-COMPILER1.gcc,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/make/solaris/makefiles/mapfile-vers-COMPILER1.gcc.orig 2013-03-10 22:22:12.895432470 +0000
++++ hotspot/make/solaris/makefiles/mapfile-vers-COMPILER1.gcc
+@@ -0,0 +1,46 @@
++#
++
++#
++# Copyright (c) 2003, 2008, 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.
++#
++# 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.
++#
++#
++
++# Define public interface.
++
++SUNWprivate_1.1 {
++ global:
++ # Dtrace support
++ _Z7madvisePcmi;
++ _Z7memcntlPcmiS_ii;
++ _ZN8Universe15_methodKlassObjE;
++ _ZN9CodeCache5_heapE;
++ _ZN8Universe14_collectedHeapE;
++ _ZTV6Method;
++ _ZTV7nmethod;
++ _ZTV8CodeBlob;
++ _ZTV10BufferBlob;
++ _ZTV11RuntimeStub;
++ _ZTV13SafepointBlob;
++ _ZTV18DeoptimizationBlob;
++
++ __JvmOffsets;
++};
diff --git a/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_mapfile-vers-COMPILER2.gcc b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_mapfile-vers-COMPILER2.gcc
new file mode 100644
index 00000000000..5a0d506a807
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_mapfile-vers-COMPILER2.gcc
@@ -0,0 +1,56 @@
+$NetBSD: patch-hotspot_make_solaris_makefiles_mapfile-vers-COMPILER2.gcc,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/make/solaris/makefiles/mapfile-vers-COMPILER2.gcc.orig 2015-07-01 10:10:20.072415621 +0000
++++ hotspot/make/solaris/makefiles/mapfile-vers-COMPILER2.gcc
+@@ -0,0 +1,49 @@
++#
++
++#
++# Copyright (c) 2003, 2008, 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.
++#
++# 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.
++#
++#
++
++# Define public interface.
++
++SUNWprivate_1.1 {
++ global:
++ # Dtrace support
++ _Z7madvisePcmi;
++ _Z7memcntlPcmiS_ii;
++ _ZN8Universe15_methodKlassObjE;
++ _ZN9CodeCache5_heapE;
++ _ZN8Universe14_collectedHeapE;
++ _ZTV6Method;
++ _ZTV7nmethod;
++ _ZTV8CodeBlob;
++ _ZTV10BufferBlob;
++ _ZTV11RuntimeStub;
++ _ZTV13SafepointBlob;
++ _ZTV18DeoptimizationBlob;
++
++ _ZTV13ExceptionBlob;
++ _ZTV16UncommonTrapBlob;
++
++ __JvmOffsets;
++};
diff --git a/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_mapfile-vers-TIERED.gcc b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_mapfile-vers-TIERED.gcc
new file mode 100644
index 00000000000..893dc2cdb93
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_mapfile-vers-TIERED.gcc
@@ -0,0 +1,55 @@
+$NetBSD: patch-hotspot_make_solaris_makefiles_mapfile-vers-TIERED.gcc,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/make/solaris/makefiles/mapfile-vers-TIERED.gcc.orig 2015-07-01 10:10:20.142891086 +0000
++++ hotspot/make/solaris/makefiles/mapfile-vers-TIERED.gcc
+@@ -0,0 +1,48 @@
++#
++
++#
++# Copyright (c) 2006, 2008, 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.
++#
++# 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.
++#
++#
++
++# Define public interface.
++
++SUNWprivate_1.1 {
++ global:
++ # Dtrace support
++ _Z7madvisePcmi;
++ _Z7memcntlPcmiS_ii;
++ _ZN8Universe15_methodKlassObjE;
++ _ZN9CodeCache5_heapE;
++ _ZN8Universe14_collectedHeapE;
++ _ZTV6Method;
++ _ZTV7nmethod;
++ _ZTV8CodeBlob;
++ _ZTV10BufferBlob;
++ _ZTV11RuntimeStub;
++ _ZTV13SafepointBlob;
++ _ZTV18DeoptimizationBlob;
++ _ZTV13ExceptionBlob;
++ _ZTV16UncommonTrapBlob;
++
++ __JvmOffsets;
++};
diff --git a/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_optimized.make b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_optimized.make
new file mode 100644
index 00000000000..9adf0c04d24
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_optimized.make
@@ -0,0 +1,19 @@
+$NetBSD: patch-hotspot_make_solaris_makefiles_optimized.make,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/make/solaris/makefiles/optimized.make.orig 2013-02-19 23:21:59.000000000 +0000
++++ hotspot/make/solaris/makefiles/optimized.make
+@@ -57,7 +57,11 @@ MAPFILE = $(GAMMADIR)/make/solaris/makef
+
+ # This mapfile is only needed when compiling with dtrace support,
+ # and mustn't be otherwise.
+-MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE)
++ifdef USE_GCC
++ MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE).gcc
++else
++ MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE)
++endif # USE_GCC
+
+ # Set the environment variable HOTSPARC_GENERIC to "true"
+ # to inhibit the effect of the previous line on CFLAGS.
diff --git a/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_product.make b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_product.make
new file mode 100644
index 00000000000..9b34dd47d6d
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_product.make
@@ -0,0 +1,25 @@
+$NetBSD: patch-hotspot_make_solaris_makefiles_product.make,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/make/solaris/makefiles/product.make.orig 2015-02-02 15:32:37.000000000 +0000
++++ hotspot/make/solaris/makefiles/product.make
+@@ -67,10 +67,16 @@ CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAG
+ # Linker mapfiles
+ MAPFILE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers
+
+-ifndef USE_GCC
+ # This mapfile is only needed when compiling with dtrace support,
+ # and mustn't be otherwise.
+-MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE)
++ifdef USE_GCC
++ MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE).gcc
++else
++ MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE)
++endif # USE_GCC
++
++# reorder is not used with gcc
++ifndef USE_GCC
+
+ endif
+
diff --git a/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_saproc.make b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_saproc.make
new file mode 100644
index 00000000000..9f27d52767f
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_saproc.make
@@ -0,0 +1,23 @@
+$NetBSD: patch-hotspot_make_solaris_makefiles_saproc.make,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+Only use libdemangle for Sun Studio builds.
+
+--- hotspot/make/solaris/makefiles/saproc.make.orig 2015-02-02 15:32:37.000000000 +0000
++++ hotspot/make/solaris/makefiles/saproc.make
+@@ -60,6 +60,7 @@ ifdef USE_GCC
+ SA_LFLAGS += -D_REENTRANT
+ else
+ SA_LFLAGS += -mt -xnolib -norunpath
++LIBDEMANGLE = -ldemangle
+ endif
+
+ # The libproc Pstack_iter() interface changed in Nevada-B159.
+@@ -107,7 +108,7 @@ $(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX
+ $(SADISOBJ) \
+ $(SA_LFLAGS) \
+ -o $@ \
+- -ldl -ldemangle -lthread -lc
++ -ldl ${LIBDEMANGLE} -lthread -lc
+
+ $(SADISOBJ): $(SADISSRCFILES)
+ $(QUIETLY) $(CC) \
diff --git a/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_vm.make b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_vm.make
new file mode 100644
index 00000000000..d9e6e518f5a
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_make_solaris_makefiles_vm.make
@@ -0,0 +1,41 @@
+$NetBSD: patch-hotspot_make_solaris_makefiles_vm.make,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/make/solaris/makefiles/vm.make.orig 2015-02-02 15:32:37.000000000 +0000
++++ hotspot/make/solaris/makefiles/vm.make
+@@ -59,7 +59,11 @@ INCLUDES += $(Src_Dirs_I:%=-I%)
+ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ # always build with debug info when we can create .debuginfo files
+ # and disable 'lazy debug info' so the .so has everything.
+- SYMFLAG = -g -xs
++ ifdef USE_GCC
++ SYMFLAG = -g
++ else
++ SYMFLAG = -g -xs
++ endif
+ else
+ ifeq (${VERSION}, debug)
+ SYMFLAG = -g
+@@ -271,16 +275,19 @@ ifeq ($(LINK_INTO),AOUT)
+ LIBS_VM = $(LIBS)
+ else
+ LIBJVM.o = $(JVM_OBJ_FILES)
+- LIBJVM_MAPFILE$(LDNOMAP) = mapfile_extended
+- LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE))
+ LFLAGS_VM += $(SONAMEFLAG:SONAME=$(LIBJVM))
+ ifndef USE_GCC
+ LIBS_VM = $(LIBS)
++ LIBJVM_MAPFILE$(LDNOMAP) = mapfile_extended
++ LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE))
+ else
+ # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to
+ # get around library dependency and compatibility issues. Must use gcc not
+ # g++ to link.
+ LFLAGS_VM += $(STATIC_LIBGCC)
++ ifeq ($(BUILDARCH),i486)
++ LFLAGS_VM += -mimpure-text
++ endif
+ LIBS_VM += $(STATIC_STDCXX) $(LIBS)
+ endif
+ endif
diff --git a/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_atomic__solaris__x86.inline.hpp b/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_atomic__solaris__x86.inline.hpp
new file mode 100644
index 00000000000..acece86d787
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_atomic__solaris__x86.inline.hpp
@@ -0,0 +1,92 @@
+$NetBSD: patch-hotspot_src_os__cpu_solaris__x86_vm_atomic__solaris__x86.inline.hpp,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp.orig 2013-02-19 23:21:59.000000000 +0000
++++ hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp
+@@ -59,6 +59,8 @@ inline void Atomic::dec_ptr(volatile voi
+ // facilitate this, os::is_MP() is passed as an additional argument. 64-bit
+ // processors are assumed to be multi-threaded and/or multi-core, so the extra
+ // argument is unnecessary.
++// This needs cleaning up - gcc always requires is_mp due to laziness of porter.
++#ifndef _GNU_SOURCE
+ #ifndef _LP64
+ #define IS_MP_DECL() , int is_mp
+ #define IS_MP_ARG() , (int) os::is_MP()
+@@ -66,6 +68,11 @@ inline void Atomic::dec_ptr(volatile voi
+ #define IS_MP_DECL()
+ #define IS_MP_ARG()
+ #endif // _LP64
++#else
++#define IS_MP_DECL() , int is_mp
++#define IS_MP_ARG() , (int) os::is_MP()
++#endif // _GNU_SOURCE
++
+
+ extern "C" {
+ jint _Atomic_add(jint add_value, volatile jint* dest IS_MP_DECL());
+@@ -96,15 +103,27 @@ inline jlong Atomic::cmpxchg (jlon
+ #ifdef AMD64
+ inline void Atomic::store (jlong store_value, jlong* dest) { *dest = store_value; }
+ inline void Atomic::store (jlong store_value, volatile jlong* dest) { *dest = store_value; }
++#ifndef _GNU_SOURCE
+ extern "C" jlong _Atomic_add_long(jlong add_value, volatile jlong* dest);
++#else
++extern "C" jlong _Atomic_add_long(jlong add_value, volatile jlong* dest IS_MP_DECL());
++#endif // _GNU_SOURCE
+ extern "C" jlong _Atomic_xchg_long(jlong exchange_value, volatile jlong* dest);
+
+ inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
++#ifndef _GNU_SOURCE
+ return (intptr_t)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest);
++#else
++ return (intptr_t)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest IS_MP_ARG());
++#endif // _GNU_SOURCE
+ }
+
+ inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest) {
++#ifndef _GNU_SOURCE
+ return (void*)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest);
++#else
++ return (void*)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest IS_MP_ARG());
++#endif // _GNU_SOURCE
+ }
+
+ inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+@@ -116,11 +135,19 @@ inline void* Atomic::xchg_ptr(void*
+ }
+
+ inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
++#ifndef _GNU_SOURCE
+ return (intptr_t)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
++#else
++ return (intptr_t)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value IS_MP_ARG());
++#endif // _GNU_SOURCE
+ }
+
+ inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
++#ifndef _GNU_SOURCE
+ return (void*)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
++#else
++ return (void*)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value IS_MP_ARG());
++#endif // _GNU_SOURCE
+ }
+
+ inline jlong Atomic::load(volatile jlong* src) { return *src; }
+@@ -257,6 +284,16 @@ extern "C" {
+ #endif // if 0
+ #endif // AMD64
+ }
++
++ inline void _Atomic_move_long(volatile jlong* src, volatile jlong* dst) {
++ __asm__ volatile (
++ "fildll (%0)" "\n\t"
++ "fistpll (%1)"
++ :
++ :"r" (src), "r" (dst)
++ :"memory");
++ }
++
+ }
+ #undef LOCK_IF_MP
+
diff --git a/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_orderAccess__solaris__x86.inline.hpp b/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_orderAccess__solaris__x86.inline.hpp
new file mode 100644
index 00000000000..3717a33feda
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_orderAccess__solaris__x86.inline.hpp
@@ -0,0 +1,18 @@
+$NetBSD: patch-hotspot_src_os__cpu_solaris__x86_vm_orderAccess__solaris__x86.inline.hpp,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp.orig 2013-02-19 23:21:59.000000000 +0000
++++ hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp
+@@ -71,7 +71,11 @@ extern "C" {
+ }
+ inline void _OrderAccess_fence() {
+ // Always use locked addl since mfence is sometimes expensive
++#ifdef AMD64
++ __asm__ volatile ("lock; addl $0,0(%%rsp)" : : : "cc", "memory");
++#else
+ __asm__ volatile ("lock; addl $0,0(%%esp)" : : : "cc", "memory");
++#endif // AMD64
+ }
+
+ }
diff --git a/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_os__solaris__x86.cpp b/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_os__solaris__x86.cpp
new file mode 100644
index 00000000000..aebaaf766ee
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_os__solaris__x86.cpp
@@ -0,0 +1,63 @@
+$NetBSD: patch-hotspot_src_os__cpu_solaris__x86_vm_os__solaris__x86.cpp,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp.orig 2015-06-10 10:31:53.000000000 +0000
++++ hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp
+@@ -234,13 +234,43 @@ frame os::get_sender_for_C_frame(frame*
+ return frame(fr->sender_sp(), fr->link(), fr->sender_pc());
+ }
+
++#ifdef AMD64
++#define SPELL_REG_SP "rsp"
++#else
++#define SPELL_REG_SP "esp"
++#endif
++
++#ifdef SPARC_WORKS
+ extern "C" intptr_t *_get_current_sp(); // in .il file
++#else
++#ifdef _GNU_SOURCE
++extern "C" intptr_t *_get_current_sp() {
++ register intptr_t *rsp __asm__ (SPELL_REG_SP);
++ return rsp;
++}
++#endif // _GNU_SOURCE
++#endif // SPARC_WORKS
+
+ address os::current_stack_pointer() {
+ return (address)_get_current_sp();
+ }
+
++#ifdef AMD64
++#define SPELL_REG_FP "rbp"
++#else
++#define SPELL_REG_FP "ebp"
++#endif
++
++#ifdef SPARC_WORKS
+ extern "C" intptr_t *_get_current_fp(); // in .il file
++#else
++#ifdef _GNU_SOURCE
++extern "C" intptr_t *_get_current_fp() {
++ register intptr_t **rbp __asm__ (SPELL_REG_FP);
++ return (intptr_t*) *rbp; // we want what it points to.
++}
++#endif // _GNU_SOURCE
++#endif // SPARC_WORKS
+
+ frame os::current_frame() {
+ intptr_t* fp = _get_current_fp(); // it's inlined so want current fp
+@@ -930,7 +960,12 @@ add_func_t* os::atomic_add_func
+ extern "C" void _solaris_raw_setup_fpu(address ptr);
+ void os::setup_fpu() {
+ address fpu_cntrl = StubRoutines::addr_fpu_cntrl_wrd_std();
++#ifndef _GNU_SOURCE
+ _solaris_raw_setup_fpu(fpu_cntrl);
++#else
++ // same as hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp : os::setup_fpu()
++ __asm__ volatile("fldcw (%0)"::"r"(fpu_cntrl):"memory");
++#endif
+ }
+ #endif // AMD64
+
diff --git a/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_prefetch__solaris__x86.inline.hpp b/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_prefetch__solaris__x86.inline.hpp
new file mode 100644
index 00000000000..1b7ec050c45
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_prefetch__solaris__x86.inline.hpp
@@ -0,0 +1,35 @@
+$NetBSD: patch-hotspot_src_os__cpu_solaris__x86_vm_prefetch__solaris__x86.inline.hpp,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/src/os_cpu/solaris_x86/vm/prefetch_solaris_x86.inline.hpp.orig 2013-02-19 23:21:59.000000000 +0000
++++ hotspot/src/os_cpu/solaris_x86/vm/prefetch_solaris_x86.inline.hpp
+@@ -34,14 +34,28 @@ extern "C" {
+
+ inline void Prefetch::read (void *loc, intx interval) {
+ #ifdef AMD64
++#ifdef SPARC_WORKS
+ _Prefetch_read(loc, interval);
++#else
++#ifdef _GNU_SOURCE
++ __asm__ ("prefetcht0 (%0,%1,1)" : : "r" (loc), "r" (interval));
++#endif // _GNU_SOURCE
++#endif // SPARC_WORKS
+ #endif // AMD64
+ }
+
+ // Use of this method should be gated by VM_Version::has_prefetchw.
+ inline void Prefetch::write(void *loc, intx interval) {
+ #ifdef AMD64
++#ifdef SPARC_WORKS
+ _Prefetch_write(loc, interval);
++#else
++#ifdef _GNU_SOURCE
++ // Do not use the 3dnow prefetchw instruction. It isn't supported on em64t.
++ // __asm__ ("prefetchw (%0,%1,1)" : : "r" (loc), "r" (interval));
++ __asm__ ("prefetcht0 (%0,%1,1)" : : "r" (loc), "r" (interval));
++#endif // _GNU_SOURCE
++#endif // SPARC_WORKS
+ #endif // AMD64
+ }
+
diff --git a/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_threadLS__solaris__x86.hpp b/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_threadLS__solaris__x86.hpp
new file mode 100644
index 00000000000..b8679a6e609
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_src_os__cpu_solaris__x86_vm_threadLS__solaris__x86.hpp
@@ -0,0 +1,18 @@
+$NetBSD: patch-hotspot_src_os__cpu_solaris__x86_vm_threadLS__solaris__x86.hpp,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/src/os_cpu/solaris_x86/vm/threadLS_solaris_x86.hpp.orig 2013-02-19 23:21:59.000000000 +0000
++++ hotspot/src/os_cpu/solaris_x86/vm/threadLS_solaris_x86.hpp
+@@ -65,7 +65,10 @@ public:
+ __asm__ __volatile__ ("movq %%fs:0, %0" : "=r"(rv));
+ return rv;
+ #else
+- return gs_thread();
++ uintptr_t rv;
++ __asm__ __volatile__ ("movl %%gs:0, %0" : "=r"(rv));
++ return rv;
++// return gs_thread();
+ #endif // AMD64
+ #else //_GNU_SOURCE
+ return _raw_thread_id();
diff --git a/lang/openjdk8/patches/patch-hotspot_src_os_bsd_vm_osThread__bsd.cpp b/lang/openjdk8/patches/patch-hotspot_src_os_bsd_vm_osThread__bsd.cpp
new file mode 100644
index 00000000000..7cdf1d9b9ac
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_src_os_bsd_vm_osThread__bsd.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-hotspot_src_os_bsd_vm_osThread__bsd.cpp,v 1.3 2015/07/03 20:40:59 fhajny Exp $
+
+--- hotspot/src/os/bsd/vm/osThread_bsd.cpp.orig 2015-06-10 10:31:51.000000000 +0000
++++ hotspot/src/os/bsd/vm/osThread_bsd.cpp
+@@ -30,7 +30,7 @@
+
+ void OSThread::pd_initialize() {
+ assert(this != NULL, "check");
+-#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
++#if defined(_ALLBSD_SOURCE)
+ _thread_id = 0;
+ #else
+ _thread_id = NULL;
diff --git a/lang/openjdk8/patches/patch-hotspot_src_os_posix_vm_os__posix.cpp b/lang/openjdk8/patches/patch-hotspot_src_os_posix_vm_os__posix.cpp
index 2d2f4ffd86f..67cd330a40a 100644
--- a/lang/openjdk8/patches/patch-hotspot_src_os_posix_vm_os__posix.cpp
+++ b/lang/openjdk8/patches/patch-hotspot_src_os_posix_vm_os__posix.cpp
@@ -1,10 +1,10 @@
-$NetBSD: patch-hotspot_src_os_posix_vm_os__posix.cpp,v 1.2 2015/06/10 11:38:51 tnn Exp $
+$NetBSD: patch-hotspot_src_os_posix_vm_os__posix.cpp,v 1.3 2015/07/03 20:40:59 fhajny Exp $
rlim_t fixes.
---- hotspot/src/os/posix/vm/os_posix.cpp.orig 2015-06-09 13:49:55.000000000 +0000
+--- hotspot/src/os/posix/vm/os_posix.cpp.orig 2015-06-10 10:31:52.000000000 +0000
+++ hotspot/src/os/posix/vm/os_posix.cpp
-@@ -180,12 +180,12 @@ void os::Posix::print_rlimit_info(output
+@@ -180,25 +180,25 @@ void os::Posix::print_rlimit_info(output
st->print(" STACK ");
getrlimit(RLIMIT_STACK, &rlim);
@@ -19,7 +19,13 @@ rlim_t fixes.
else st->print("%uk", rlim.rlim_cur >> 10);
// Isn't there on solaris
-@@ -198,7 +198,7 @@ void os::Posix::print_rlimit_info(output
+ #if !defined(TARGET_OS_FAMILY_solaris) && !defined(TARGET_OS_FAMILY_aix)
+ st->print(", NPROC ");
+ getrlimit(RLIMIT_NPROC, &rlim);
+- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
++ if (rlim.rlim_cur == (rlim_t)RLIM_INFINITY) st->print("infinity");
+ else st->print("%d", rlim.rlim_cur);
+ #endif
st->print(", NOFILE ");
getrlimit(RLIMIT_NOFILE, &rlim);
diff --git a/lang/openjdk8/patches/patch-hotspot_src_os_solaris_dtrace_jhelper.d b/lang/openjdk8/patches/patch-hotspot_src_os_solaris_dtrace_jhelper.d
new file mode 100644
index 00000000000..dde73fb92e3
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_src_os_solaris_dtrace_jhelper.d
@@ -0,0 +1,81 @@
+$NetBSD: patch-hotspot_src_os_solaris_dtrace_jhelper.d,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- hotspot/src/os/solaris/dtrace/jhelper.d.orig 2015-06-10 10:31:52.000000000 +0000
++++ hotspot/src/os/solaris/dtrace/jhelper.d
+@@ -43,12 +43,33 @@
+
+ extern pointer __JvmOffsets;
+
+-extern pointer __1cJCodeCacheF_heap_;
+-extern pointer __1cIUniverseO_collectedHeap_;
+-
+-extern pointer __1cHnmethodG__vtbl_;
+-extern pointer __1cGMethodG__vtbl_;
+-extern pointer __1cKBufferBlobG__vtbl_;
++/* name mangling depends on the compiler used */
++#ifndef _GNU_SOURCE
++#define SYMBOL_JCODECACHE_HEAP __1cJCodeCacheF_heap_
++#define SYMBOL_UNIVERSE_METHODKLASSOBJ __1cIUniverseP_methodKlassObj_
++#define SYMBOL_UNIVERSE_COLLECTEDHEAP __1cIUniverseO_collectedHeap_
++#define SYMBOL_UNIVERSE_NARROW_OOP __1cIUniverseL_narrow_oop_
++#define SYMBOL_NMETHOD_VTBL __1cHnmethodG__vtbl_
++#define SYMBOL_METHOD_VTBL __1cGMethodG__vtbl_
++#define SYMBOL_BUFFERBLOB_VTBL __1cKBufferBlobG__vtbl_
++#else
++#define SYMBOL_JCODECACHE_HEAP _ZN9CodeCache5_heapE
++#define SYMBOL_UNIVERSE_METHODKLASSOBJ _ZN8Universe15_methodKlassObjE
++#define SYMBOL_UNIVERSE_COLLECTEDHEAP _ZN8Universe14_collectedHeapE
++#define SYMBOL_UNIVERSE_NARROW_OOP _ZN8Universe11_narrow_oopE
++#define SYMBOL_NMETHOD_VTBL _ZTV7nmethod
++#define SYMBOL_METHOD_VTBL _ZTV6Method
++#define SYMBOL_BUFFERBLOB_VTBL _ZTV10BufferBlob
++#endif /* ! _GNU_SOURCE */
++
++extern pointer SYMBOL_JCODECACHE_HEAP;
++extern pointer SYMBOL_UNIVERSE_METHODKLASSOBJ;
++extern pointer SYMBOL_UNIVERSE_COLLECTEDHEAP;
++extern pointer SYMBOL_UNIVERSE_NARROW_OOP;
++
++extern pointer SYMBOL_NMETHOD_VTBL;
++extern pointer SYMBOL_METHOD_VTBL;
++extern pointer SYMBOL_BUFFERBLOB_VTBL;
+
+ #define copyin_ptr(ADDR) *(pointer*) copyin((pointer) (ADDR), sizeof(pointer))
+ #define copyin_uchar(ADDR) *(uchar_t*) copyin((pointer) (ADDR), sizeof(uchar_t))
+@@ -152,7 +173,7 @@ dtrace:helper:ustack:
+ #error "Don't know architecture"
+ #endif
+
+- this->CodeCache_heap_address = copyin_ptr(&``__1cJCodeCacheF_heap_);
++ this->CodeCache_heap_address = copyin_ptr(&``SYMBOL_JCODECACHE_HEAP);
+
+ this->CodeCache_low = copyin_ptr(this->CodeCache_heap_address +
+ OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
+@@ -169,12 +190,12 @@ dtrace:helper:ustack:
+ this->CodeHeap_log2_segment_size = copyin_uint32(
+ this->CodeCache_heap_address + OFFSET_CodeHeap_log2_segment_size);
+
+- this->Method_vtbl = (pointer) &``__1cGMethodG__vtbl_;
++ this->Method_vtbl = (pointer) &``SYMBOL_METHOD_VTBL;
+
+ /*
+ * Get Java heap bounds
+ */
+- this->Universe_collectedHeap = copyin_ptr(&``__1cIUniverseO_collectedHeap_);
++ this->Universe_collectedHeap = copyin_ptr(&``SYMBOL_UNIVERSE_COLLECTEDHEAP);
+ this->heap_start = copyin_ptr(this->Universe_collectedHeap +
+ OFFSET_CollectedHeap_reserved +
+ OFFSET_MemRegion_start);
+@@ -275,8 +296,8 @@ dtrace:helper:ustack:
+ this->start = this->block + SIZE_HeapBlockHeader;
+ this->vtbl = copyin_ptr(this->start);
+
+- this->nmethod_vtbl = (pointer) &``__1cHnmethodG__vtbl_;
+- this->BufferBlob_vtbl = (pointer) &``__1cKBufferBlobG__vtbl_;
++ this->nmethod_vtbl = (pointer) &``SYMBOL_NMETHOD_VTBL;
++ this->BufferBlob_vtbl = (pointer) &``SYMBOL_BUFFERBLOB_VTBL;
+ }
+
+ dtrace:helper:ustack:
diff --git a/lang/openjdk8/patches/patch-hotspot_src_os_solaris_vm_decoder__solaris.cpp b/lang/openjdk8/patches/patch-hotspot_src_os_solaris_vm_decoder__solaris.cpp
new file mode 100644
index 00000000000..c0527213f8d
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_src_os_solaris_vm_decoder__solaris.cpp
@@ -0,0 +1,18 @@
+$NetBSD: patch-hotspot_src_os_solaris_vm_decoder__solaris.cpp,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+Avoid libdemangle with GCC.
+
+--- hotspot/src/os/solaris/vm/decoder_solaris.cpp.orig 2013-02-19 23:21:59.000000000 +0000
++++ hotspot/src/os/solaris/vm/decoder_solaris.cpp
+@@ -27,6 +27,11 @@
+ #include <demangle.h>
+
+ bool ElfDecoder::demangle(const char* symbol, char *buf, int buflen) {
++#ifdef SPARC_WORKS
+ return !cplus_demangle(symbol, buf, (size_t)buflen);
++#else
++ memcpy(buf, symbol, (size_t)buflen);
++ return 0;
++#endif
+ }
+
diff --git a/lang/openjdk8/patches/patch-hotspot_src_os_solaris_vm_os__solaris.cpp b/lang/openjdk8/patches/patch-hotspot_src_os_solaris_vm_os__solaris.cpp
new file mode 100644
index 00000000000..c19a7ec2a86
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_src_os_solaris_vm_os__solaris.cpp
@@ -0,0 +1,137 @@
+$NetBSD: patch-hotspot_src_os_solaris_vm_os__solaris.cpp,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+Misc SunOS casts.
+
+--- hotspot/src/os/solaris/vm/os_solaris.cpp.orig 2015-06-10 10:31:52.000000000 +0000
++++ hotspot/src/os/solaris/vm/os_solaris.cpp
+@@ -113,6 +113,12 @@
+
+ #define MAX_PATH (2 * K)
+
++/* Declare madvise where it is not declared for C++, like Solaris */
++#if defined(__sun) && defined(_XOPEN_SOURCE)
++extern "C" int memcntl(caddr_t, size_t, int, caddr_t, int, int);
++extern "C" int madvise(caddr_t, size_t, int);
++#endif
++
+ // for timer info max values which include all bits
+ #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
+
+@@ -534,7 +540,7 @@ static bool assign_distribution(processo
+ const processorid_t limit_id = max_id + 1;
+ // Make up markers for available processors.
+ bool* available_id = NEW_C_HEAP_ARRAY(bool, limit_id, mtInternal);
+- for (uint c = 0; c < limit_id; c += 1) {
++ for (processorid_t c = 0; c < limit_id; c += 1) {
+ available_id[c] = false;
+ }
+ for (uint a = 0; a < id_length; a += 1) {
+@@ -557,7 +563,7 @@ static bool assign_distribution(processo
+ // ... find the next available processor in the board.
+ for (uint slot = 0; slot < processors_per_board; slot += 1) {
+ uint try_id = board * processors_per_board + slot;
+- if ((try_id < limit_id) && (available_id[try_id] == true)) {
++ if ((try_id < (uint)limit_id) && (available_id[try_id] == true)) {
+ distribution[assigned] = try_id;
+ available_id[try_id] = false;
+ assigned += 1;
+@@ -565,7 +571,7 @@ static bool assign_distribution(processo
+ }
+ }
+ board += 1;
+- if (board * processors_per_board + 0 >= limit_id) {
++ if (board * processors_per_board + 0 >= (uint)limit_id) {
+ board = 0;
+ }
+ }
+@@ -622,7 +628,7 @@ bool os::bind_to_processor(uint processo
+ bool os::getenv(const char* name, char* buffer, int len) {
+ char* val = ::getenv( name );
+ if ( val == NULL
+- || strlen(val) + 1 > len ) {
++ || strlen(val) + 1 > (size_t)len ) {
+ if (len > 0) buffer[0] = 0; // return a null string
+ return false;
+ }
+@@ -801,7 +807,7 @@ void os::init_system_properties_values()
+ } else {
+ int inserted = 0;
+ int i;
+- for (i = 0; i < info->dls_cnt; i++, path++) {
++ for (i = 0; (uint_t)i < info->dls_cnt; i++, path++) {
+ uint_t flags = path->dls_flags & LA_SER_MASK;
+ if (((flags & LA_SER_LIBPATH) == 0) && !inserted) {
+ strcat(library_path, common_path);
+@@ -907,7 +913,8 @@ extern "C" void* java_start(void* thread
+ // in java_to_os_priority. So we save the native priority
+ // in the osThread and recall it here.
+
+- if ( osthr->thread_id() != -1 ) {
++ // thread_id_t ("osThread_solaris.hpp") == thread_t (<thread.h>) == unsigned int
++ if ( osthr->thread_id() != (unsigned int)-1 ) {
+ if ( UseThreadPriorities ) {
+ int prio = osthr->native_priority();
+ if (ThreadPriorityVerbose) {
+@@ -2786,7 +2793,7 @@ void os::numa_make_global(char *addr, si
+ // Get the number of the locality groups.
+ size_t os::numa_get_groups_num() {
+ size_t n = Solaris::lgrp_nlgrps(Solaris::lgrp_cookie());
+- return n != -1 ? n : 1;
++ return n != (size_t) -1 ? n : 1;
+ }
+
+ // Get a list of leaf locality groups. A leaf lgroup is group that
+@@ -2798,7 +2805,7 @@ size_t os::numa_get_leaf_groups(int *ids
+ return 1;
+ }
+ int result_size = 0, top = 1, bottom = 0, cur = 0;
+- for (int k = 0; k < size; k++) {
++ for (size_t k = 0; k < size; k++) {
+ int r = Solaris::lgrp_children(Solaris::lgrp_cookie(), ids[cur],
+ (Solaris::lgrp_id_t*)&ids[top], size - top);
+ if (r == -1) {
+@@ -2918,7 +2925,7 @@ char *os::scan_pages(char *start, char*
+ }
+
+ if ((validity[i] & 2) != 0 && page_expected->lgrp_id > 0) {
+- if (outdata[types * i] != page_expected->lgrp_id) {
++ if (outdata[types * i] != (uint64_t)page_expected->lgrp_id) {
+ break;
+ }
+ }
+@@ -4685,7 +4692,7 @@ const char * signames[] = {
+ const char* os::exception_name(int exception_code, char* buf, size_t size) {
+ if (0 < exception_code && exception_code <= SIGRTMAX) {
+ // signal
+- if (exception_code < sizeof(signames)/sizeof(const char*)) {
++ if ((size_t)exception_code < sizeof(signames)/sizeof(const char*)) {
+ jio_snprintf(buf, size, "%s", signames[exception_code]);
+ } else {
+ jio_snprintf(buf, size, "SIG%d", exception_code);
+@@ -5017,7 +5024,7 @@ void os::init(void) {
+ // If the pagesize of the VM is greater than 8K determine the appropriate
+ // number of initial guard pages. The user can change this with the
+ // command line arguments, if needed.
+- if (vm_page_size() > 8*K) {
++ if ((size_t)vm_page_size() > 8*K) {
+ StackYellowPages = 1;
+ StackRedPages = 1;
+ StackShadowPages = round_to((StackShadowPages*8*K), vm_page_size()) / vm_page_size();
+@@ -5038,7 +5045,7 @@ jint os::init_2(void) {
+
+ // Allocate a single page and mark it as readable for safepoint polling. Also
+ // use this first mmap call to check support for MAP_ALIGN.
+- address polling_page = (address)Solaris::mmap_chunk((char*)page_size,
++ address polling_page = (address)Solaris::mmap_chunk((char*)(uintptr_t)page_size,
+ page_size,
+ MAP_PRIVATE | MAP_ALIGN,
+ PROT_READ);
+@@ -5090,7 +5097,7 @@ jint os::init_2(void) {
+ // stack on a power of 2 boundary. The real fix for this
+ // should be to fix the guard page mechanism.
+
+- if (vm_page_size() > 8*K) {
++ if ((size_t)vm_page_size() > 8*K) {
+ threadStackSizeInBytes = (threadStackSizeInBytes != 0)
+ ? threadStackSizeInBytes +
+ ((StackYellowPages + StackRedPages) * vm_page_size())
diff --git a/lang/openjdk8/patches/patch-hotspot_src_os_solaris_vm_perfMemory__solaris.cpp b/lang/openjdk8/patches/patch-hotspot_src_os_solaris_vm_perfMemory__solaris.cpp
new file mode 100644
index 00000000000..98cb31fa907
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_src_os_solaris_vm_perfMemory__solaris.cpp
@@ -0,0 +1,24 @@
+$NetBSD: patch-hotspot_src_os_solaris_vm_perfMemory__solaris.cpp,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+dirent->dd_fd is legacy, dirent->d_fd is POSIX, dirfd(dirent) is better.
+
+--- hotspot/src/os/solaris/vm/perfMemory_solaris.cpp.orig 2015-06-10 10:31:52.000000000 +0000
++++ hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
+@@ -334,7 +334,7 @@ static DIR *open_directory_secure(const
+ }
+
+ // Check to make sure fd and dirp are referencing the same file system object.
+- if (!is_same_fsobject(fd, dirp->dd_fd)) {
++ if (!is_same_fsobject(fd, dirfd(dirp))) {
+ // The directory is not secure.
+ os::close(fd);
+ os::closedir(dirp);
+@@ -366,7 +366,7 @@ static DIR *open_directory_secure_cwd(co
+ // Directory doesn't exist or is insecure, so there is nothing to cleanup.
+ return dirp;
+ }
+- int fd = dirp->dd_fd;
++ int fd = dirfd(dirp);
+
+ // Open a fd to the cwd and save it off.
+ int result;
diff --git a/lang/openjdk8/patches/patch-hotspot_src_share_vm_utilities_globalDefinitions__gcc.hpp b/lang/openjdk8/patches/patch-hotspot_src_share_vm_utilities_globalDefinitions__gcc.hpp
index 78f956f1296..f4a3c12320e 100644
--- a/lang/openjdk8/patches/patch-hotspot_src_share_vm_utilities_globalDefinitions__gcc.hpp
+++ b/lang/openjdk8/patches/patch-hotspot_src_share_vm_utilities_globalDefinitions__gcc.hpp
@@ -1,7 +1,18 @@
-$NetBSD: patch-hotspot_src_share_vm_utilities_globalDefinitions__gcc.hpp,v 1.2 2015/03/02 03:53:26 tnn Exp $
+$NetBSD: patch-hotspot_src_share_vm_utilities_globalDefinitions__gcc.hpp,v 1.3 2015/07/03 20:40:59 fhajny Exp $
--- hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp.orig 2015-02-02 15:32:37.000000000 +0000
+++ hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
+@@ -31,6 +31,10 @@
+ // globally used constants & types, class (forward)
+ // declarations and a few frequently used utility functions.
+
++#ifdef SOLARIS
++#include <inttypes.h>
++#endif // SOLARIS
++
+ #include <ctype.h>
+ #include <string.h>
+ #include <stdarg.h>
@@ -76,7 +76,7 @@
# include <sys/procfs.h>
# endif
diff --git a/lang/openjdk8/patches/patch-hotspot_src_share_vm_utilities_hashtable.cpp b/lang/openjdk8/patches/patch-hotspot_src_share_vm_utilities_hashtable.cpp
new file mode 100644
index 00000000000..b7a9300cdeb
--- /dev/null
+++ b/lang/openjdk8/patches/patch-hotspot_src_share_vm_utilities_hashtable.cpp
@@ -0,0 +1,15 @@
+$NetBSD: patch-hotspot_src_share_vm_utilities_hashtable.cpp,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+Delete obsolete (and now harmful) SunOS code.
+
+--- hotspot/src/share/vm/utilities/hashtable.cpp.orig 2015-06-10 10:31:47.000000000 +0000
++++ hotspot/src/share/vm/utilities/hashtable.cpp
+@@ -364,7 +364,7 @@ template class RehashableHashtable<oopDe
+ template class Hashtable<Symbol*, mtSymbol>;
+ template class Hashtable<Klass*, mtClass>;
+ template class Hashtable<oop, mtClass>;
+-#if defined(SOLARIS) || defined(CHECK_UNHANDLED_OOPS)
++#if defined(CHECK_UNHANDLED_OOPS)
+ template class Hashtable<oop, mtSymbol>;
+ template class RehashableHashtable<oop, mtSymbol>;
+ #endif // SOLARIS || CHECK_UNHANDLED_OOPS
diff --git a/lang/openjdk8/patches/patch-jdk_make_CompileDemos.gmk b/lang/openjdk8/patches/patch-jdk_make_CompileDemos.gmk
new file mode 100644
index 00000000000..58b42e868f4
--- /dev/null
+++ b/lang/openjdk8/patches/patch-jdk_make_CompileDemos.gmk
@@ -0,0 +1,49 @@
+$NetBSD: patch-jdk_make_CompileDemos.gmk,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+--- jdk/make/CompileDemos.gmk.orig 2015-06-10 10:36:15.000000000 +0000
++++ jdk/make/CompileDemos.gmk
+@@ -56,7 +56,6 @@ define SetupAppletDemo
+ BUILD_DEMOS += $$(BUILD_DEMO_APPLET_$1)
+ endef
+
+-ifneq ($(OPENJDK_TARGET_OS), solaris)
+ $(eval $(call SetupAppletDemo,ArcTest))
+ $(eval $(call SetupAppletDemo,BarChart))
+ $(eval $(call SetupAppletDemo,Blink))
+@@ -77,7 +76,6 @@ ifneq ($(OPENJDK_TARGET_OS), solaris)
+ $(eval $(call SetupAppletDemo,JumpingBox,,closed/))
+ $(eval $(call SetupAppletDemo,TicTacToe,,closed/))
+ endif
+-endif
+
+ ##################################################################################################
+
+@@ -159,11 +157,9 @@ $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_t
+
+ BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services
+
+-ifneq ($(OPENJDK_TARGET_OS), solaris)
+ $(eval $(call SetupDemo,MoleculeViewer,applets,,XYZChemModel,,,example*.html *.java))
+ $(eval $(call SetupDemo,WireFrame,applets,,ThreeD,,,example*.html *.java))
+ $(eval $(call SetupDemo,SwingApplet,jfc,,SwingApplet,,,README* *.html))
+-endif
+ $(eval $(call SetupDemo,FileChooserDemo,jfc,,FileChooserDemo,,,README*))
+ $(eval $(call SetupDemo,Font2DTest,jfc,,Font2DTest,,,*.html *.txt))
+ $(eval $(call SetupDemo,Metalworks,jfc,,Metalworks,,,README*))
+@@ -375,16 +371,9 @@ BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/man
+ ##################################################################################################
+
+ # The netbeans project files are copied into the demo directory.
+-ifeq ($(OPENJDK_TARGET_OS), solaris)
+- BUILD_DEMOS += $(patsubst $(JDK_TOPDIR)/src/share/demo/nbproject/%, \
+- $(JDK_OUTPUTDIR)/demo/nbproject/%, \
+- $(filter-out $(JDK_TOPDIR)/src/share/demo/nbproject/jfc/SwingApplet%, \
+- $(call CacheFind, $(JDK_TOPDIR)/src/share/demo/nbproject)))
+-else
+ BUILD_DEMOS += $(patsubst $(JDK_TOPDIR)/src/share/demo/nbproject/%, \
+ $(JDK_OUTPUTDIR)/demo/nbproject/%, \
+ $(call CacheFind, $(JDK_TOPDIR)/src/share/demo/nbproject))
+-endif
+
+ $(JDK_OUTPUTDIR)/demo/nbproject/%: $(JDK_TOPDIR)/src/share/demo/nbproject/%
+ $(call install-file)
diff --git a/lang/openjdk8/patches/patch-jdk_make_CompileLaunchers.gmk b/lang/openjdk8/patches/patch-jdk_make_CompileLaunchers.gmk
index 35e6c341dec..fd34921d43a 100644
--- a/lang/openjdk8/patches/patch-jdk_make_CompileLaunchers.gmk
+++ b/lang/openjdk8/patches/patch-jdk_make_CompileLaunchers.gmk
@@ -1,11 +1,11 @@
-$NetBSD: patch-jdk_make_CompileLaunchers.gmk,v 1.1 2015/02/12 06:20:00 tnn Exp $
+$NetBSD: patch-jdk_make_CompileLaunchers.gmk,v 1.2 2015/07/03 20:40:59 fhajny Exp $
Change Sun Studio compiler flag to GCC equivalent.
(it is probably safe to remove the flag since we use the Zero port.)
---- jdk/make/CompileLaunchers.gmk.orig 2015-02-02 15:37:11.000000000 +0000
+--- jdk/make/CompileLaunchers.gmk.orig 2015-06-10 10:36:15.000000000 +0000
+++ jdk/make/CompileLaunchers.gmk
-@@ -452,7 +452,7 @@ else
+@@ -458,7 +458,7 @@ else
endif
ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
@@ -14,3 +14,13 @@ Change Sun Studio compiler flag to GCC equivalent.
UNPACKEXE_LDFLAGS_solaris += -xmemalign=4s
endif
+@@ -553,9 +553,7 @@ BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/
+ # jdk/make/java/Makefile
+ #
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+- ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
+ BUILD_JEXEC := 1
+- endif
+ endif
+
+ ifneq ($(findstring $(OPENJDK_TARGET_OS), linux bsd), )
diff --git a/lang/openjdk8/patches/patch-jdk_make_Images.gmk b/lang/openjdk8/patches/patch-jdk_make_Images.gmk
index 0e7fb17c71a..9a03ee18a52 100644
--- a/lang/openjdk8/patches/patch-jdk_make_Images.gmk
+++ b/lang/openjdk8/patches/patch-jdk_make_Images.gmk
@@ -1,9 +1,27 @@
-$NetBSD: patch-jdk_make_Images.gmk,v 1.2 2015/02/21 10:13:50 tnn Exp $
+$NetBSD: patch-jdk_make_Images.gmk,v 1.3 2015/07/03 20:40:59 fhajny Exp $
Building ja_JP.UTF-8 manpages crashes the bootstrap JVM.
---- jdk/make/Images.gmk.orig 2015-02-02 15:37:11.000000000 +0000
+--- jdk/make/Images.gmk.orig 2015-06-10 10:36:15.000000000 +0000
+++ jdk/make/Images.gmk
+@@ -190,7 +190,7 @@ $(foreach f,$(filter $(OVERLAY_FILTER),$
+ $(foreach f,$(filter $(OVERLAY_FILTER),$(JDKJRE_BIN_LIST)), \
+ $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR)/jre,$f,JDKJRE_BIN_TARGETS)))
+
+-ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_BITS),solaris-64)
++ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_BITS),NOMULTIARCHsolaris-64)
+ define AddIsadirLink
+ # Param 1 - src file
+ # Param 2 - variable to add targets to
+@@ -234,7 +234,7 @@ ifeq ($(PROFILE), )
+ endif
+
+ JDK_LIB_FILES := $(NOT_JRE_LIB_FILES)
+-ifneq ($(findstring $(OPENJDK_TARGET_OS), linux bsd),)
++ifneq ($(findstring $(OPENJDK_TARGET_OS), linux bsd solaris),)
+ JDK_LIB_FILES += jexec
+ endif
+
@@ -454,25 +454,15 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
diff --git a/lang/openjdk8/patches/patch-jdk_make_lib_Awt2dLibraries.gmk b/lang/openjdk8/patches/patch-jdk_make_lib_Awt2dLibraries.gmk
new file mode 100644
index 00000000000..a200a3e131d
--- /dev/null
+++ b/lang/openjdk8/patches/patch-jdk_make_lib_Awt2dLibraries.gmk
@@ -0,0 +1,14 @@
+$NetBSD: patch-jdk_make_lib_Awt2dLibraries.gmk,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC support.
+
+--- jdk/make/lib/Awt2dLibraries.gmk.orig 2015-06-10 10:36:24.000000000 +0000
++++ jdk/make/lib/Awt2dLibraries.gmk
+@@ -695,7 +695,6 @@ $(eval $(call SetupNativeCompilation,BUI
+ $(SHARED_LIBRARY_FLAGS) \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug, \
+- CFLAGS_solaris := -xc99=no_lib, \
+ CFLAGS_windows := -DCMS_IS_WINDOWS_, \
+ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
diff --git a/lang/openjdk8/patches/patch-jdk_make_lib_NioLibraries.gmk b/lang/openjdk8/patches/patch-jdk_make_lib_NioLibraries.gmk
new file mode 100644
index 00000000000..6b16fa9f81e
--- /dev/null
+++ b/lang/openjdk8/patches/patch-jdk_make_lib_NioLibraries.gmk
@@ -0,0 +1,25 @@
+$NetBSD: patch-jdk_make_lib_NioLibraries.gmk,v 1.3 2015/07/03 20:40:59 fhajny Exp $
+
+--- jdk/make/lib/NioLibraries.gmk.orig 2015-06-10 10:36:24.000000000 +0000
++++ jdk/make/lib/NioLibraries.gmk
+@@ -185,10 +185,12 @@ $(BUILD_LIBNIO): $(BUILD_LIBNET)
+
+ ##########################################################################################
+
++ifeq (, $(OS_VENDOR))
++OS_VENDOR:= $(shell uname -s)
++endif
+ ifeq ($(OPENJDK_TARGET_OS_API), posix)
+
+- ifeq (, $(filter $(OPENJDK_TARGET_OS), macosx aix))
+- ifeq (, $(filter $(OPENJDK_TARGET_OS_VENDOR), netbsd openbsd))
++ ifeq (, $(filter $(OS_VENDOR), AIX Darwin NetBSD OpenBSD DragonFly))
+
+ # Suppress unused parameters required by exported JNI functions.
+ SCTP_WERROR := -Werror -Wno-error=unused-parameter
+@@ -224,5 +226,4 @@ ifeq ($(OPENJDK_TARGET_OS_API), posix)
+
+ $(BUILD_LIBSCTP): $(BUILD_LIBNIO)
+ endif
+- endif
+ endif
diff --git a/lang/openjdk8/patches/patch-jdk_make_lib_SoundLibraries.gmk b/lang/openjdk8/patches/patch-jdk_make_lib_SoundLibraries.gmk
index 3c4bf88cfc1..ef9a77c7522 100644
--- a/lang/openjdk8/patches/patch-jdk_make_lib_SoundLibraries.gmk
+++ b/lang/openjdk8/patches/patch-jdk_make_lib_SoundLibraries.gmk
@@ -1,13 +1,14 @@
-$NetBSD: patch-jdk_make_lib_SoundLibraries.gmk,v 1.2 2015/06/10 11:38:51 tnn Exp $
+$NetBSD: patch-jdk_make_lib_SoundLibraries.gmk,v 1.3 2015/07/03 20:40:59 fhajny Exp $
---- jdk/make/lib/SoundLibraries.gmk.orig 2015-06-09 13:56:39.000000000 +0000
+--- jdk/make/lib/SoundLibraries.gmk.orig 2015-06-10 10:36:24.000000000 +0000
+++ jdk/make/lib/SoundLibraries.gmk
-@@ -76,7 +76,7 @@ ifeq ($(OPENJDK_TARGET_OS), aix)
+@@ -76,9 +76,6 @@ ifeq ($(OPENJDK_TARGET_OS), aix)
endif # OPENJDK_TARGET_OS aix
ifeq ($(OPENJDK_TARGET_OS), bsd)
- ifneq ($(OPENJDK_TARGET_OS_VENDOR), openbsd)
-+ ifeq (, $(filter $(OPENJDK_TARGET_OS_VENDOR), netbsd openbsd))
- EXTRA_SOUND_JNI_LIBS += jsoundalsa
- endif # OPENJDK_TARGET_OS_VENDOR openbsd
+- EXTRA_SOUND_JNI_LIBS += jsoundalsa
+- endif # OPENJDK_TARGET_OS_VENDOR openbsd
LIBJSOUND_CFLAGS += -DX_PLATFORM=X_BSD
+ endif # OPENJDK_TARGET_OS bsd
+
diff --git a/lang/openjdk8/patches/patch-jdk_src_share_native_sun_security_ec_impl_ecc__impl.h b/lang/openjdk8/patches/patch-jdk_src_share_native_sun_security_ec_impl_ecc__impl.h
new file mode 100644
index 00000000000..cc647a8e858
--- /dev/null
+++ b/lang/openjdk8/patches/patch-jdk_src_share_native_sun_security_ec_impl_ecc__impl.h
@@ -0,0 +1,33 @@
+$NetBSD: patch-jdk_src_share_native_sun_security_ec_impl_ecc__impl.h,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC compatability.
+
+--- jdk/src/share/native/sun/security/ec/impl/ecc_impl.h.orig 2015-06-10 10:36:26.000000000 +0000
++++ jdk/src/share/native/sun/security/ec/impl/ecc_impl.h
+@@ -38,12 +38,13 @@
+
+ #ifndef _ECC_IMPL_H
+ #define _ECC_IMPL_H
++
++#include <sys/types.h>
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+-#include <sys/types.h>
+ #include "ecl-exp.h"
+
+ /*
+@@ -57,6 +58,11 @@ typedef unsigned long ulong_t;
+ typedef enum { B_FALSE, B_TRUE } boolean_t;
+ #endif /* __linux__ */
+
++#if defined(__solaris__) && defined(_GNU_SOURCE) && defined(_XOPEN_SOURCE)
++#define B_FALSE _B_FALSE
++#define B_TRUE _B_TRUE
++#endif /* __solaris__ && _GNU_SOURCE */
++
+ #ifdef _ALLBSD_SOURCE
+ #include <stdint.h>
+ #define B_FALSE FALSE
diff --git a/lang/openjdk8/patches/patch-jdk_src_solaris_bin_ergo__i586.c b/lang/openjdk8/patches/patch-jdk_src_solaris_bin_ergo__i586.c
new file mode 100644
index 00000000000..0afca2cef34
--- /dev/null
+++ b/lang/openjdk8/patches/patch-jdk_src_solaris_bin_ergo__i586.c
@@ -0,0 +1,50 @@
+$NetBSD: patch-jdk_src_solaris_bin_ergo__i586.c,v 1.1 2015/07/03 20:40:59 fhajny Exp $
+
+GCC compatability.
+
+--- jdk/src/solaris/bin/ergo_i586.c.orig 2015-02-02 15:37:12.000000000 +0000
++++ jdk/src/solaris/bin/ergo_i586.c
+@@ -27,7 +27,7 @@
+
+ static unsigned long physical_processors(void);
+
+-#ifdef __solaris__
++#if defined(__solaris__) && !defined(_GNU_SOURCE)
+
+ /*
+ * A utility method for asking the CPU about itself.
+@@ -76,7 +76,9 @@ get_cpuid(uint32_t arg,
+ asm(" popl %ebx");
+ #endif /* LP64 */
+ }
++#endif /* __solaris__ && !_GNU_SOURCE */
+
++#ifdef __solaris__
+ /* The definition of a server-class machine for solaris-i586/amd64 */
+ jboolean
+ ServerClassMachineImpl(void) {
+@@ -106,7 +108,7 @@ ServerClassMachineImpl(void) {
+
+ #endif /* __solaris__ */
+
+-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
++#if (defined(__linux__) || defined(_ALLBSD_SOURCE)) || (defined(__solaris__) && defined(_GNU_SOURCE))
+
+ /*
+ * A utility method for asking the CPU about itself.
+@@ -171,6 +173,7 @@ get_cpuid(uint32_t arg,
+ #endif /* _LP64 */
+ }
+
++#ifndef __solaris__
+ /* The definition of a server-class machine for linux-i586 */
+ jboolean
+ ServerClassMachineImpl(void) {
+@@ -197,6 +200,7 @@ ServerClassMachineImpl(void) {
+ (result == JNI_TRUE ? "true" : "false"));
+ return result;
+ }
++#endif /* !__solaris__ */
+ #endif /* __linux__ || _ALLBSD_SOURCE */
+
+ /*