summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2017-09-28 16:23:40 +0300
committerIgor Pashev <pashev.igor@gmail.com>2017-09-28 16:23:40 +0300
commit50e91a00741b76ba3e513bce779cffefd6419545 (patch)
treeb905729d301b1254ac30d9f6a070da3323760feb /debian
parent66d986b1d82bb2559f94138a2e4742142a8276e3 (diff)
downloadopenjdk-8-50e91a00741b76ba3e513bce779cffefd6419545.tar.gz
Add dyson.patch
Diffstat (limited to 'debian')
-rw-r--r--debian/patches/dyson.patch1770
-rwxr-xr-xdebian/rules4
2 files changed, 1774 insertions, 0 deletions
diff --git a/debian/patches/dyson.patch b/debian/patches/dyson.patch
new file mode 100644
index 0000000..e617c85
--- /dev/null
+++ b/debian/patches/dyson.patch
@@ -0,0 +1,1770 @@
+Index: src/common/autoconf/toolchain.m4
+===================================================================
+--- src.orig/common/autoconf/toolchain.m4
++++ src/common/autoconf/toolchain.m4
+@@ -80,21 +80,7 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_COMPILER_VER
+ COMPILER=[$]$1
+ COMPILER_NAME=$2
+
+- if test "x$OPENJDK_TARGET_OS" = xsolaris; 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
+- if test $? -ne 0; then
+- GCC_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
+-
+- AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required Sun Studio compiler.])
+- AC_MSG_NOTICE([The result from running with -V was: "$COMPILER_VERSION_TEST" and with --version: "$GCC_VERSION_TEST"])
+- AC_MSG_ERROR([Sun Studio compiler is required. Try setting --with-tools-dir.])
+- else
+- COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*@<:@ ,\t@:>@$COMPILER_NAME@<:@ ,\t@:>@\(@<:@1-9@:>@\.@<:@0-9@:>@@<:@0-9@:>@*\).*/\1/p"`
+- COMPILER_VENDOR="Sun Studio"
+- fi
+- elif test "x$OPENJDK_TARGET_OS" = xaix; then
++ if test "x$OPENJDK_TARGET_OS" = xaix; then
+ COMPILER_VERSION_TEST=`$COMPILER -qversion 2>&1 | $TAIL -n 1`
+ $ECHO $COMPILER_VERSION_TEST | $GREP "^Version: " > /dev/null
+ if test $? -ne 0; then
+@@ -697,6 +683,10 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_
+ SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
+ POST_STRIP_CMD="$STRIP -S"
+ fi
++ if test "x$OPENJDK_TARGET_OS" = xsolaris; then
++ 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
+Index: src/hotspot/make/solaris/makefiles/adlc.make
+===================================================================
+--- src.orig/hotspot/make/solaris/makefiles/adlc.make
++++ src/hotspot/make/solaris/makefiles/adlc.make
+@@ -26,6 +26,8 @@
+ # build directories.
+ # It knows how to compile, link, and run the adlc.
+
++USE_GCC := yes
++
+ include $(GAMMADIR)/make/$(Platform_os_family)/makefiles/rules.make
+ include $(GAMMADIR)/make/altsrc.make
+
+Index: src/hotspot/make/solaris/makefiles/buildtree.make
+===================================================================
+--- src.orig/hotspot/make/solaris/makefiles/buildtree.make
++++ src/hotspot/make/solaris/makefiles/buildtree.make
+@@ -54,6 +54,8 @@
+ # The makefiles are split this way so that "make foo" will run faster by not
+ # having to read the dependency files for the vm.
+
++USE_GCC := yes
++
+ -include $(SPEC)
+ include $(GAMMADIR)/make/scm.make
+ include $(GAMMADIR)/make/defs.make
+Index: src/hotspot/make/solaris/makefiles/dtrace.make
+===================================================================
+--- src.orig/hotspot/make/solaris/makefiles/dtrace.make
++++ src/hotspot/make/solaris/makefiles/dtrace.make
+@@ -27,6 +27,8 @@
+ # We build libjvm_dtrace/libjvm_db/dtrace for COMPILER1 and COMPILER2
+ # but not for CORE configuration.
+
++USE_GCC := yes
++
+ ifneq ("${TYPE}", "CORE")
+
+ ifdef USE_GCC
+@@ -126,7 +128,7 @@ $(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JV
+ @echo Making $@
+ $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
+ $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \
+- $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
++ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc
+ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DTRACE_DEBUGINFO)
+ # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not
+@@ -212,7 +214,7 @@ endif
+ $(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
+ @echo Making $@
+ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \
+- $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
++ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc
+ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO)
+ $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
+Index: src/hotspot/make/solaris/makefiles/jsig.make
+===================================================================
+--- src.orig/hotspot/make/solaris/makefiles/jsig.make
++++ src/hotspot/make/solaris/makefiles/jsig.make
+@@ -24,6 +24,8 @@
+
+ # Rules to build signal interposition library, used by vm.make
+
++USE_GCC := yes
++
+ # libjsig.so: signal interposition library
+ JSIG = jsig
+ LIBJSIG = lib$(JSIG).so
+Index: src/hotspot/make/solaris/makefiles/product.make
+===================================================================
+--- src.orig/hotspot/make/solaris/makefiles/product.make
++++ src/hotspot/make/solaris/makefiles/product.make
+@@ -22,6 +22,8 @@
+ #
+ #
+
++USE_GCC := yes
++
+ # Sets make macros for making optimized version of Gamma VM
+ # (This is the "product", not the "release" version.)
+
+Index: src/hotspot/make/solaris/makefiles/saproc.make
+===================================================================
+--- src.orig/hotspot/make/solaris/makefiles/saproc.make
++++ src/hotspot/make/solaris/makefiles/saproc.make
+@@ -24,6 +24,8 @@
+
+ # Rules to build serviceability agent library, used by vm.make
+
++USE_GCC := yes
++
+ # libsaproc.so: serviceability agent
+
+ SAPROC = saproc
+@@ -107,7 +109,7 @@ $(LIBSAPROC): $(SASRCFILES) $(SADISOBJ)
+ $(SADISOBJ) \
+ $(SA_LFLAGS) \
+ -o $@ \
+- -ldl -ldemangle -lthread -lc
++ -lc
+
+ $(SADISOBJ): $(SADISSRCFILES)
+ $(QUIETLY) $(CC) \
+Index: src/hotspot/make/solaris/makefiles/vm.make
+===================================================================
+--- src.orig/hotspot/make/solaris/makefiles/vm.make
++++ src/hotspot/make/solaris/makefiles/vm.make
+@@ -25,6 +25,8 @@
+ # Rules to build JVM and related libraries, included from vm.make in the build
+ # directory.
+
++USE_GCC := yes
++
+ # Common build rules.
+ MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles
+ include $(MAKEFILES_DIR)/rules.make
+@@ -108,39 +110,7 @@ CFLAGS += $(CFLAGS/NOEX)
+
+ # Extra flags from gnumake's invocation or environment
+ CFLAGS += $(EXTRA_CFLAGS)
+-
+-# Math Library (libm.so), do not use -lm.
+-# There might be two versions of libm.so on the build system:
+-# libm.so.1 and libm.so.2, and we want libm.so.1.
+-# Depending on the Solaris release being used to build with,
+-# /usr/lib/libm.so could point at a libm.so.2, so we are
+-# explicit here so that the libjvm.so you have built will work on an
+-# older Solaris release that might not have libm.so.2.
+-# This is a critical factor in allowing builds on Solaris 10 or newer
+-# to run on Solaris 8 or 9.
+-#
+-LIBM=/usr/lib$(ISA_DIR)/libm.so.1
+-
+-ifeq ("${Platform_compiler}", "sparcWorks")
+-# The whole megilla:
+-ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1)
+-# Old Comment: List the libraries in the order the compiler was designed for
+-# Not sure what the 'designed for' comment is referring too above.
+-# The order may not be too significant anymore, but I have placed this
+-# older libm before libCrun, just to make sure it's found and used first.
+-LIBS += -lsocket -lsched -ldl $(LIBM) -lCrun -lthread -ldoor -lc -ldemangle
+-else
+-ifeq ($(COMPILER_REV_NUMERIC), 502)
+-# SC6.1 has it's own libm.so: specifying anything else provokes a name conflict.
+-LIBS += -ldl -lthread -lsocket -lm -lsched -ldoor -ldemangle
+-else
+-LIBS += -ldl -lthread -lsocket $(LIBM) -lsched -ldoor -ldemangle
+-endif # 502
+-endif # 505
+-else
+-LIBS += -lsocket -lsched -ldl $(LIBM) -lthread -lc -ldemangle
+-endif # sparcWorks
+-
++LIBS += -lsocket -lm -lc
+ LIBS += -lkstat
+
+ # By default, link the *.o into the library, not the executable.
+Index: src/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp
+===================================================================
+--- src.orig/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp
++++ src/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp
+@@ -54,29 +54,17 @@ inline void Atomic::dec_ptr(volatile voi
+ // For Sun Studio - implementation is in solaris_x86_[32/64].il.
+ // For gcc - implementation is just below.
+
+-// The lock prefix can be omitted for certain instructions on uniprocessors; to
+-// 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.
+-#ifndef _LP64
+-#define IS_MP_DECL() , int is_mp
+-#define IS_MP_ARG() , (int) os::is_MP()
+-#else
+-#define IS_MP_DECL()
+-#define IS_MP_ARG()
+-#endif // _LP64
+-
+ extern "C" {
+- jint _Atomic_add(jint add_value, volatile jint* dest IS_MP_DECL());
++ jint _Atomic_add(jint add_value, volatile jint* dest, int mp);
+ jint _Atomic_xchg(jint exchange_value, volatile jint* dest);
+ jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest,
+- jint compare_value IS_MP_DECL());
++ jint compare_value, int mp);
+ jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest,
+- jlong compare_value IS_MP_DECL());
++ jlong compare_value, int mp);
+ }
+
+ inline jint Atomic::add (jint add_value, volatile jint* dest) {
+- return _Atomic_add(add_value, dest IS_MP_ARG());
++ return _Atomic_add(add_value, dest, (int) os::is_MP());
+ }
+
+ inline jint Atomic::xchg (jint exchange_value, volatile jint* dest) {
+@@ -84,26 +72,26 @@ inline jint Atomic::xchg (jint
+ }
+
+ inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
+- return _Atomic_cmpxchg(exchange_value, dest, compare_value IS_MP_ARG());
++ return _Atomic_cmpxchg(exchange_value, dest, compare_value, (int) os::is_MP());
+ }
+
+ inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+- return _Atomic_cmpxchg_long(exchange_value, dest, compare_value IS_MP_ARG());
++ return _Atomic_cmpxchg_long(exchange_value, dest, compare_value, (int) os::is_MP());
+ }
+
+
+ #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; }
+-extern "C" jlong _Atomic_add_long(jlong add_value, volatile jlong* dest);
++extern "C" jlong _Atomic_add_long(jlong add_value, volatile jlong* dest, int mp);
+ 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) {
+- return (intptr_t)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest);
++ return (intptr_t)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest, (int) os::is_MP());
+ }
+
+ inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest) {
+- return (void*)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest);
++ return (void*)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest, (int) os::is_MP());
+ }
+
+ inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
+@@ -115,11 +103,11 @@ inline void* Atomic::xchg_ptr(void*
+ }
+
+ inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
+- return (intptr_t)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
++ return (intptr_t)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, (int) os::is_MP());
+ }
+
+ inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
+- return (void*)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
++ return (void*)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, (int) os::is_MP());
+ }
+
+ inline jlong Atomic::load(volatile jlong* src) { return *src; }
+@@ -168,7 +156,6 @@ inline void Atomic::store(jlong store_va
+
+ #endif // AMD64
+
+-#ifdef _GNU_SOURCE
+ // Add a lock prefix to an instruction on an MP machine
+ #define LOCK_IF_MP(mp) "cmp $0, " #mp "; je 1f; lock; 1: "
+
+@@ -230,35 +217,9 @@ extern "C" {
+ return exchange_value;
+ #else
+ return _Atomic_cmpxchg_long_gcc(exchange_value, dest, compare_value, os::is_MP());
+-
+- #if 0
+- // The code below does not work presumably because of the bug in gcc
+- // The error message says:
+- // can't find a register in class BREG while reloading asm
+- // However I want to save this code and later replace _Atomic_cmpxchg_long_gcc
+- // with such inline asm code:
+-
+- volatile jlong_accessor evl, cvl, rv;
+- evl.long_value = exchange_value;
+- cvl.long_value = compare_value;
+- int mp = os::is_MP();
+-
+- __asm__ volatile ("cmp $0, %%esi\n\t"
+- "je 1f \n\t"
+- "lock\n\t"
+- "1: cmpxchg8b (%%edi)\n\t"
+- : "=a"(cvl.words[0]), "=d"(cvl.words[1])
+- : "a"(cvl.words[0]), "d"(cvl.words[1]),
+- "b"(evl.words[0]), "c"(evl.words[1]),
+- "D"(dest), "S"(mp)
+- : "cc", "memory");
+- return cvl.long_value;
+- #endif // if 0
+ #endif // AMD64
+ }
+ }
+ #undef LOCK_IF_MP
+
+-#endif // _GNU_SOURCE
+-
+ #endif // OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_INLINE_HPP
+Index: src/hotspot/src/os/solaris/vm/decoder_solaris.cpp
+===================================================================
+--- src.orig/hotspot/src/os/solaris/vm/decoder_solaris.cpp
++++ src/hotspot/src/os/solaris/vm/decoder_solaris.cpp
+@@ -22,11 +22,31 @@
+ *
+ */
+
++#include "prims/jvm.h"
+ #include "utilities/decoder_elf.hpp"
+
+-#include <demangle.h>
++#include <cxxabi.h>
+
+ bool ElfDecoder::demangle(const char* symbol, char *buf, int buflen) {
+- return !cplus_demangle(symbol, buf, (size_t)buflen);
++ int status;
++ char* result;
++ size_t size = (size_t)buflen;
++
++#ifdef PPC64
++ // On PPC64 ElfDecoder::decode() may return a dot (.) prefixed name
++ // (see elfFuncDescTable.hpp for details)
++ if (symbol && *symbol == '.') symbol += 1;
++#endif
++
++ // Don't pass buf to __cxa_demangle. In case of the 'buf' is too small,
++ // __cxa_demangle will call system "realloc" for additional memory, which
++ // may use different malloc/realloc mechanism that allocates 'buf'.
++ if ((result = abi::__cxa_demangle(symbol, NULL, NULL, &status)) != NULL) {
++ jio_snprintf(buf, buflen, "%s", result);
++ // call c library's free
++ ::free(result);
++ return true;
++ }
++ return false;
+ }
+
+Index: src/hotspot/src/share/vm/utilities/hashtable.cpp
+===================================================================
+--- src.orig/hotspot/src/share/vm/utilities/hashtable.cpp
++++ src/hotspot/src/share/vm/utilities/hashtable.cpp
+@@ -364,10 +364,6 @@ 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)
+-template class Hashtable<oop, mtSymbol>;
+-template class RehashableHashtable<oop, mtSymbol>;
+-#endif // SOLARIS || CHECK_UNHANDLED_OOPS
+ template class Hashtable<oopDesc*, mtSymbol>;
+ template class Hashtable<Symbol*, mtClass>;
+ template class HashtableEntry<Symbol*, mtSymbol>;
+Index: src/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp
+===================================================================
+--- src.orig/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp
++++ src/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp
+@@ -22,6 +22,11 @@
+ *
+ */
+
++// Dyson-specific - for TRAPNO
++# define _I386_REGS
++# include <sys/regset.h>
++
++
+ // no precompiled headers
+ #include "asm/macroAssembler.hpp"
+ #include "classfile/classLoader.hpp"
+@@ -53,6 +58,7 @@
+ #include "utilities/vmError.hpp"
+
+ // put OS-includes here
++
+ # include <sys/types.h>
+ # include <sys/mman.h>
+ # include <pthread.h>
+@@ -234,14 +240,33 @@ 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"
++#define SPELL_REG_FP "rbp"
++#else
++#define SPELL_REG_SP "esp"
++#define SPELL_REG_FP "ebp"
++#endif
++
++#ifdef SPARC_WORKS
+ extern "C" intptr_t *_get_current_sp(); // in .il file
++extern "C" intptr_t *_get_current_fp(); // in .il file
++#else
++extern "C" inline intptr_t *_get_current_sp() {
++ register intptr_t *rsp __asm__ (SPELL_REG_SP);
++ return rsp;
++}
++
++extern "C" inline intptr_t *_get_current_fp() {
++ register intptr_t **rbp __asm__ (SPELL_REG_FP);
++ return (intptr_t*) *rbp; // we want what it points to.
++}
++#endif
+
+ address os::current_stack_pointer() {
+ return (address)_get_current_sp();
+ }
+
+-extern "C" intptr_t *_get_current_fp(); // in .il file
+-
+ frame os::current_frame() {
+ intptr_t* fp = _get_current_fp(); // it's inlined so want current fp
+ frame myframe((intptr_t*)os::current_stack_pointer(),
+@@ -930,7 +955,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();
++#ifdef SPARC_WORKS
+ _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
+
+Index: src/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
+===================================================================
+--- src.orig/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
++++ src/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, dirp->d_fd)) {
+ // 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 = dirp->d_fd;
+
+ // Open a fd to the cwd and save it off.
+ int result;
+Index: src/hotspot/make/solaris/makefiles/gcc.make
+===================================================================
+--- src.orig/hotspot/make/solaris/makefiles/gcc.make
++++ src/hotspot/make/solaris/makefiles/gcc.make
+@@ -25,6 +25,8 @@
+ #------------------------------------------------------------------------
+ # CC, CXX & AS
+
++USE_GNULD = yes
++
+ # If a SPEC is not set already, then use these defaults.
+ ifeq ($(SPEC),)
+ CXX = g++
+@@ -80,13 +82,13 @@ ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
+
+ ARCHFLAG/sparc = -m32 -mcpu=v9
+ ARCHFLAG/sparcv9 = -m64 -mcpu=v9
+-ARCHFLAG/i486 = -m32 -march=i586
+-ARCHFLAG/amd64 = -m64 -march=k8
++ARCHFLAG/i486 = -march=i586
++ARCHFLAG/amd64 = -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=
+ ISA_DIR/i486=
+ ISA_DIR/sparcv9=/64
+
+@@ -96,11 +98,6 @@ AOUT_FLAGS += $(ARCHFLAG)
+ LFLAGS += $(ARCHFLAG)
+ ASFLAGS += $(ARCHFLAG)
+
+-ifeq ($(BUILDARCH), amd64)
+-ASFLAGS += -march=k8 -march=amd64
+-LFLAGS += -march=k8
+-endif
+-
+
+ # Use C++ Interpreter
+ ifdef CC_INTERP
+Index: src/hotspot/agent/src/os/solaris/proc/saproc.cpp
+===================================================================
+--- src.orig/hotspot/agent/src/os/solaris/proc/saproc.cpp
++++ src/hotspot/agent/src/os/solaris/proc/saproc.cpp
+@@ -30,11 +30,24 @@
+ #include <thread_db.h>
+ #include <strings.h>
+ #include <limits.h>
+-#include <demangle.h>
+ #include <stdarg.h>
+ #include <stdlib.h>
+ #include <errno.h>
+
++#include <cxxabi.h>
++
++static bool demangle(const char* symbol, char *buf, size_t buflen) {
++ int status;
++ char* result;
++ if ((result = abi::__cxa_demangle(symbol, NULL, NULL, &status)) != NULL) {
++ snprintf(buf, buflen, "%s", result);
++ ::free(result);
++ return true;
++ }
++ return false;
++}
++
++
+ #define CHECK_EXCEPTION_(value) if(env->ExceptionOccurred()) { return value; }
+ #define CHECK_EXCEPTION if(env->ExceptionOccurred()) { return;}
+ #define THROW_NEW_DEBUGGER_EXCEPTION_(str, value) { throwNewDebuggerException(env, str); return value; }
+@@ -1255,7 +1268,7 @@ JNIEXPORT jstring JNICALL Java_sun_jvm_h
+ const char* ptr = env->GetStringUTFChars(name, &isCopy);
+ char buf[2*SYMBOL_BUF_SIZE + 1];
+ jstring res = 0;
+- if (cplus_demangle((char*) ptr, buf, sizeof(buf)) != DEMANGLE_ESPACE) {
++ if (demangle((char*) ptr, buf, sizeof(buf))) {
+ res = env->NewStringUTF(buf);
+ } else {
+ res = name;
+Index: src/hotspot/make/solaris/makefiles/defs.make
+===================================================================
+--- src.orig/hotspot/make/solaris/makefiles/defs.make
++++ src/hotspot/make/solaris/makefiles/defs.make
+@@ -239,58 +239,22 @@ EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARC
+ ifeq ($(JVM_VARIANT_SERVER),true)
+ EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
+ EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
+- EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.$(LIBRARY_SUFFIX)
+- EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.$(LIBRARY_SUFFIX)
+- ifeq ($(ARCH_DATA_MODEL),32)
+- EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.$(LIBRARY_SUFFIX)
+- EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.$(LIBRARY_SUFFIX)
+- endif
+ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz
+- EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.diz
+- EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.diz
+- ifeq ($(ARCH_DATA_MODEL),32)
+- EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.diz
+- EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.diz
+- endif
+ else
+ EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo
+- EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.debuginfo
+- EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.debuginfo
+- ifeq ($(ARCH_DATA_MODEL),32)
+- EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.debuginfo
+- EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.debuginfo
+- endif
+ endif
+ endif
+ endif
+ ifeq ($(JVM_VARIANT_CLIENT),true)
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX)
+- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.$(LIBRARY_SUFFIX)
+- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.$(LIBRARY_SUFFIX)
+- ifeq ($(ARCH_DATA_MODEL),32)
+- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.$(LIBRARY_SUFFIX)
+- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.$(LIBRARY_SUFFIX)
+- endif
+ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz
+- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.diz
+- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.diz
+- ifeq ($(ARCH_DATA_MODEL),32)
+- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.diz
+- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.diz
+- endif
+ else
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo
+- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.debuginfo
+- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.debuginfo
+- ifeq ($(ARCH_DATA_MODEL),32)
+- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.debuginfo
+- EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.debuginfo
+- endif
+ endif
+ endif
+ endif
+Index: src/jdk/src/solaris/native/common/jdk_util_md.h
+===================================================================
+--- src.orig/jdk/src/solaris/native/common/jdk_util_md.h
++++ src/jdk/src/solaris/native/common/jdk_util_md.h
+@@ -35,7 +35,7 @@
+ #include <math.h>
+ #define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+-#elif defined(__linux__) || defined(_ALLBSD_SOURCE)
++#elif defined(__linux__) || defined(__sun__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+ #define ISNANF(f) isnanf(f)
+ #define ISNAND(d) isnan(d)
+Index: src/jdk/src/solaris/native/java/io/io_util_md.c
+===================================================================
+--- src.orig/jdk/src/solaris/native/java/io/io_util_md.c
++++ src/jdk/src/solaris/native/java/io/io_util_md.c
+@@ -35,7 +35,7 @@
+ #include <sys/filio.h>
+ #endif
+
+-#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX)
++#if defined(__linux__) || defined(__sun__) || defined(_ALLBSD_SOURCE) || defined(_AIX)
+ #include <sys/ioctl.h>
+ #endif
+
+@@ -99,12 +99,11 @@ fileOpen(JNIEnv *env, jobject this, jstr
+ WITH_PLATFORM_STRING(env, path, ps) {
+ FD fd;
+
+-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+ /* Remove trailing slashes, since the kernel won't */
+ char *p = (char *)ps + strlen(ps) - 1;
+ while ((p > ps) && (*p == '/'))
+ *p-- = '\0';
+-#endif
++
+ fd = handleOpen(ps, flags, 0666);
+ if (fd != -1) {
+ SET_FD(this, fd, fid);
+Index: src/common/autoconf/libraries.m4
+===================================================================
+--- src.orig/common/autoconf/libraries.m4
++++ src/common/autoconf/libraries.m4
+@@ -904,7 +904,7 @@ AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIB
+ [with_stdc__lib=default]
+ )
+
+- if test "x$OPENJDK_TARGET_OS" = xlinux; then
++ if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xsolaris; then
+ # Test if -lstdc++ works.
+ AC_MSG_CHECKING([if dynamic link of stdc++ is possible])
+ AC_LANG_PUSH(C++)
+@@ -1015,11 +1015,6 @@ AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIB
+ AC_SUBST(LLVM_LIBS)
+ 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
+- LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
+- fi
+-
+ # TODO better (platform agnostic) test
+ if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$LIBCXX" = x && test "x$GCC" = xyes; then
+ LIBCXX="-lstdc++"
+Index: src/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
+===================================================================
+--- src.orig/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
++++ src/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
+@@ -24,6 +24,7 @@
+ */
+
+ #include <stdio.h>
++#include <string.h>
+ #include <stdlib.h>
+ #include <limits.h>
+ #include <fcntl.h>
+@@ -38,14 +39,6 @@
+ #include <sys/statvfs.h>
+ #include <sys/time.h>
+
+-#ifdef __solaris__
+-#include <strings.h>
+-#endif
+-
+-#if defined(__linux__) || defined(_AIX)
+-#include <string.h>
+-#endif
+-
+ #ifdef _ALLBSD_SOURCE
+ #include <string.h>
+
+@@ -982,11 +975,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_get
+ int res = 0;
+
+ errno = 0;
+- #ifdef __solaris__
+- RESTARTABLE_RETURN_PTR(getpwuid_r((uid_t)uid, &pwent, pwbuf, (size_t)buflen), p);
+- #else
+- RESTARTABLE(getpwuid_r((uid_t)uid, &pwent, pwbuf, (size_t)buflen, &p), res);
+- #endif
++ RESTARTABLE(getpwuid_r((uid_t)uid, &pwent, pwbuf, (size_t)buflen, &p), res);
+
+ if (res != 0 || p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
+ /* not found or error */
+@@ -1031,11 +1020,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_get
+ }
+
+ errno = 0;
+- #ifdef __solaris__
+- RESTARTABLE_RETURN_PTR(getgrgid_r((gid_t)gid, &grent, grbuf, (size_t)buflen), g);
+- #else
+- RESTARTABLE(getgrgid_r((gid_t)gid, &grent, grbuf, (size_t)buflen, &g), res);
+- #endif
++ RESTARTABLE(getgrgid_r((gid_t)gid, &grent, grbuf, (size_t)buflen, &g), res);
+
+ retry = 0;
+ if (res != 0 || g == NULL || g->gr_name == NULL || *(g->gr_name) == '\0') {
+@@ -1086,11 +1071,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_get
+ const char* name = (const char*)jlong_to_ptr(nameAddress);
+
+ errno = 0;
+- #ifdef __solaris__
+- RESTARTABLE_RETURN_PTR(getpwnam_r(name, &pwent, pwbuf, (size_t)buflen), p);
+- #else
+- RESTARTABLE(getpwnam_r(name, &pwent, pwbuf, (size_t)buflen, &p), res);
+- #endif
++ RESTARTABLE(getpwnam_r(name, &pwent, pwbuf, (size_t)buflen, &p), res);
+
+ if (res != 0 || p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
+ /* not found or error */
+@@ -1131,11 +1112,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_get
+ }
+
+ errno = 0;
+- #ifdef __solaris__
+- RESTARTABLE_RETURN_PTR(getgrnam_r(name, &grent, grbuf, (size_t)buflen), g);
+- #else
+- RESTARTABLE(getgrnam_r(name, &grent, grbuf, (size_t)buflen, &g), res);
+- #endif
++ RESTARTABLE(getgrnam_r(name, &grent, grbuf, (size_t)buflen, &g), res);
+
+ retry = 0;
+ if (res != 0 || g == NULL || g->gr_name == NULL || *(g->gr_name) == '\0') {
+Index: src/jdk/src/solaris/native/sun/nio/ch/sctp/Sctp.h
+===================================================================
+--- src.orig/jdk/src/solaris/native/sun/nio/ch/sctp/Sctp.h
++++ src/jdk/src/solaris/native/sun/nio/ch/sctp/Sctp.h
+@@ -28,8 +28,6 @@
+
+ #ifdef __solaris__
+
+-#define _XPG4_2
+-#define __EXTENSIONS__
+ #include <sys/socket.h>
+ #include <netinet/sctp.h>
+ #include "jni.h"
+Index: src/jdk/src/solaris/native/com/sun/security/auth/module/Solaris.c
+===================================================================
+--- src.orig/jdk/src/solaris/native/com/sun/security/auth/module/Solaris.c
++++ src/jdk/src/solaris/native/com/sun/security/auth/module/Solaris.c
+@@ -39,6 +39,7 @@ Java_com_sun_security_auth_module_Solari
+ int i;
+ char pwd_buf[1024];
+ struct passwd pwd;
++ struct passwd *pp;
+ jsize numSuppGroups = getgroups(0, NULL);
+ jfieldID fid;
+ jstring jstr;
+@@ -59,7 +60,7 @@ Java_com_sun_security_auth_module_Solari
+ cls = (*env)->GetObjectClass(env, obj);
+
+ memset(pwd_buf, 0, sizeof(pwd_buf));
+- if (getpwuid_r(getuid(), &pwd, pwd_buf, sizeof(pwd_buf)) != NULL &&
++ if (!getpwuid_r(getuid(), &pwd, pwd_buf, sizeof(pwd_buf), &pp) &&
+ getgroups(numSuppGroups, groups) != -1) {
+
+ /*
+Index: src/jdk/make/lib/NetworkingLibraries.gmk
+===================================================================
+--- src.orig/jdk/make/lib/NetworkingLibraries.gmk
++++ src/jdk/make/lib/NetworkingLibraries.gmk
+@@ -71,7 +71,7 @@ $(eval $(call SetupNativeCompilation,BUI
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_macosx := -ljvm -ljava, \
+- LDFLAGS_SUFFIX_solaris := -ljvm -ljava -lnsl -lsocket $(LIBDL) -lc, \
++ LDFLAGS_SUFFIX_solaris := -ljvm -ljava -lnsl -lsocket -lc, \
+ LDFLAGS_SUFFIX_linux := $(LIBDL) -ljvm -lpthread -ljava, \
+ LDFLAGS_SUFFIX_aix := $(LIBDL) -ljvm -ljava,\
+ LDFLAGS_SUFFIX_windows := ws2_32.lib jvm.lib secur32.lib iphlpapi.lib \
+Index: src/jdk/make/lib/NioLibraries.gmk
+===================================================================
+--- src.orig/jdk/make/lib/NioLibraries.gmk
++++ src/jdk/make/lib/NioLibraries.gmk
+@@ -144,7 +144,7 @@ $(eval $(call SetupNativeCompilation,BUI
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_linux := -ljava -lnet -lpthread $(LIBDL), \
+ LDFLAGS_SUFFIX_aix := -ljava -lnet $(LIBDL),\
+- LDFLAGS_SUFFIX_solaris := -ljvm -lsocket -lposix4 $(LIBDL) \
++ LDFLAGS_SUFFIX_solaris := -ljvm -lsocket \
+ -lsendfile -ljava -lnet -lc, \
+ LDFLAGS_SUFFIX_windows := jvm.lib ws2_32.lib $(WIN_JAVA_LIB) \
+ $(JDK_OUTPUTDIR)/objs/libnet/net.lib \
+Index: src/jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c
+===================================================================
+--- src.orig/jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c
++++ src/jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c
+@@ -30,12 +30,9 @@
+
+ #ifdef __solaris__
+ #include <sys/systeminfo.h>
+-#include <strings.h>
+ #endif
+
+-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <string.h>
+-#endif
+
+ #include "jni.h"
+
+Index: src/jdk/src/solaris/native/sun/management/OperatingSystemImpl.c
+===================================================================
+--- src.orig/jdk/src/solaris/native/sun/management/OperatingSystemImpl.c
++++ src/jdk/src/solaris/native/sun/management/OperatingSystemImpl.c
+@@ -75,17 +75,12 @@ static jlong page_size = 0;
+ #endif /* _ALLBSD_SOURCE */
+
+ static struct dirent* read_dir(DIR* dirp, struct dirent* entry) {
+-#ifdef __solaris__
+- struct dirent* dbuf = readdir(dirp);
+- return dbuf;
+-#else /* __linux__ || _ALLBSD_SOURCE */
+ struct dirent* p;
+ if (readdir_r(dirp, entry, &p) == 0) {
+ return p;
+ } else {
+ return NULL;
+ }
+-#endif
+ }
+
+ // true = get available swap in bytes
+Index: src/jdk/make/lib/Awt2dLibraries.gmk
+===================================================================
+--- src.orig/jdk/make/lib/Awt2dLibraries.gmk
++++ src/jdk/make/lib/Awt2dLibraries.gmk
+@@ -477,9 +477,8 @@ $(eval $(call SetupNativeCompilation,BUI
+ ASFLAGS := $(LIBAWT_ASFLAGS), \
+ MAPFILE := $(LIBAWT_MAPFILE), \
+ LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \
+- LDFLAGS_solaris := -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR), \
+ LDFLAGS_SUFFIX_linux := -ljvm $(LIBM) $(LIBDL) -ljava, \
+- LDFLAGS_SUFFIX_solaris := -ljvm $(LIBM) $(LIBDL) -ljava -lc, \
++ LDFLAGS_SUFFIX_solaris := -ljvm -lm -ljava -lc, \
+ LDFLAGS_SUFFIX_aix :=-ljvm $(LIBM) $(LIBDL) -ljava -lm,\
+ LDFLAGS_SUFFIX_macosx := -lmlib_image -ljvm $(LIBM) \
+ -framework Cocoa \
+@@ -639,11 +638,7 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),
+ $(X_LIBS) $(LIBAWT_XAWT_LDFLAGS), \
+ LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN) \
+ $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+- LDFLAGS_solaris := -L$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+- -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) \
+- -R$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+- -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) \
+- -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \
++ LDFLAGS_solaris := \
+ $(call SET_SHARED_LIBRARY_ORIGIN) \
+ $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+ LDFLAGS_SUFFIX := $(LIBAWT_XAWT_LDFLAGS_SUFFIX), \
+@@ -678,12 +673,11 @@ $(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) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+- LDFLAGS_solaris := /usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2, \
++ LDFLAGS_solaris := -lm, \
+ LDFLAGS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
+ LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc, \
+ LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm, \
+@@ -855,14 +849,12 @@ ifeq ($(BUILD_HEADLESS), true)
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+- LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..) \
+- -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+- -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR), \
++ LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+ LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN)., \
+ REORDER := $(LIBAWT_HEADLESS_REORDER), \
+ LDFLAGS_SUFFIX_linux := -ljvm -lawt -lm $(LIBDL) -ljava, \
+ LDFLAGS_SUFFIX_aix := -ljvm -lawt -ljava,\
+- LDFLAGS_SUFFIX_solaris := $(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc, \
++ LDFLAGS_SUFFIX_solaris := -ljvm -lawt -lm -ljava $(LIBCXX) -lc, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_headless, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+Index: src/jdk/make/CompileLaunchers.gmk
+===================================================================
+--- src.orig/jdk/make/CompileLaunchers.gmk
++++ src/jdk/make/CompileLaunchers.gmk
+@@ -120,7 +120,6 @@ define SetupLauncher
+ # TODO: maybe it's better to move this if-statement out of this function
+ ifeq ($1, java)
+ $1_OPTIMIZATION_ARG := HIGH
+- $1_LDFLAGS_solaris := -R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR)
+ else
+ $1_OPTIMIZATION_ARG := LOW
+ endif
+@@ -141,9 +140,15 @@ define SetupLauncher
+ endif
+ else
+ ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)), )
+- $1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)
+- else
+- $1_MAPFILE :=
++ ifeq ($(OPENJDK_TARGET_OS), solaris)
++ # On Dyson (gcc + gnu ld) mapfile hides the _end symbol which is used by malloc().
++ # We disable mapfile.
++ # With GCC we need -rdynamic to export "main" - used by dlsym() to get executable name.
++ # (see below, coudn't add a comment there)
++ $1_MAPFILE :=
++ else
++ $1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)
++ endif
+ endif
+ endif
+
+@@ -164,14 +169,14 @@ define SetupLauncher
+ -DPROGNAME='"$1"' $(DPACKAGEPATH) \
+ $2, \
+ CFLAGS_linux := -fPIC, \
+- CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \
++ CFLAGS_solaris := -fPIC -DHAVE_GETHRTIME, \
+ LDFLAGS := $(LDFLAGS_JDKEXE) \
+ $(ORIGIN_ARG) \
+ $$($1_LDFLAGS), \
+ LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_NAME,$1), \
+ LDFLAGS_linux := -lpthread \
+ $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \
+- LDFLAGS_solaris := $$($1_LDFLAGS_solaris) \
++ LDFLAGS_solaris := -rdynamic $$($1_LDFLAGS_solaris) \
+ $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \
+ MAPFILE := $$($1_MAPFILE), \
+ LDFLAGS_SUFFIX := $(LDFLAGS_JDKEXE_SUFFIX) $$($1_LDFLAGS_SUFFIX), \
+@@ -179,7 +184,7 @@ define SetupLauncher
+ LDFLAGS_SUFFIX_windows := $$($1_WINDOWS_JLI_LIB) \
+ $(JDK_OUTPUTDIR)/objs/libjava/java.lib advapi32.lib $5, \
+ LDFLAGS_SUFFIX_linux := -L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli $(LIBDL) -lc, \
+- LDFLAGS_SUFFIX_solaris := -L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli -lthread $(LIBDL) -lc, \
++ LDFLAGS_SUFFIX_solaris := -L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli -lc, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/$1_objs$(OUTPUT_SUBDIR), \
+ OUTPUT_DIR := $$($1_OUTPUT_DIR_ARG)$(OUTPUT_SUBDIR), \
+ PROGRAM := $1, \
+@@ -475,7 +480,7 @@ $(eval $(call SetupNativeCompilation,BUI
+ -DFULL, \
+ CFLAGS_release := -DPRODUCT, \
+ CFLAGS_linux := -fPIC, \
+- CFLAGS_solaris := -KPIC, \
++ CFLAGS_solaris := -fPIC, \
+ CFLAGS_macosx := -fPIC, \
+ MAPFILE := $(UNPACK_MAPFILE),\
+ LDFLAGS := $(UNPACKEXE_ZIPOBJS), \
+@@ -533,9 +538,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
++ BUILD_JEXEC := 1
+ endif
+
+ ifeq ($(OPENJDK_TARGET_OS), linux)
+@@ -558,6 +561,9 @@ ifeq ($(BUILD_JEXEC), 1)
+ BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib
+ BUILD_JEXEC_INC += -I$(JDK_TOPDIR)/src/share/bin
+ endif
++ ifeq ($(OPENJDK_TARGET_OS), solaris)
++ BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib
++ endif
+ endif
+
+ #
+@@ -573,7 +579,7 @@ ifneq ($(BUILD_JEXEC_SRC), )
+ CFLAGS := $(CFLAGS_JDKEXE) \
+ $(BUILD_JEXEC_INC), \
+ CFLAGS_linux := -fPIC, \
+- CFLAGS_solaris := -KPIC, \
++ CFLAGS_solaris := -fPIC, \
+ LDFLAGS := $(LDFLAGS_JDKEXE) \
+ $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/jexec_obj, \
+Index: src/jdk/make/lib/ServiceabilityLibraries.gmk
+===================================================================
+--- src.orig/jdk/make/lib/ServiceabilityLibraries.gmk
++++ src/jdk/make/lib/ServiceabilityLibraries.gmk
+@@ -63,7 +63,6 @@ $(eval $(call SetupNativeCompilation,BUI
+ -D "JDK_FTYPE=0x2L", \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+- LDFLAGS_solaris := -ldoor, \
+ LDFLAGS_windows := /ORDER:@$(JDK_TOPDIR)/make/mapfiles/libattach/reorder-windows-$(OPENJDK_TARGET_CPU), \
+ LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
+ LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB) advapi32.lib psapi.lib, \
+Index: src/hotspot/make/solaris/platform_amd64.gcc
+===================================================================
+--- src.orig/hotspot/make/solaris/platform_amd64.gcc
++++ src/hotspot/make/solaris/platform_amd64.gcc
+@@ -12,4 +12,4 @@ lib_arch = amd64
+
+ compiler = gcc
+
+-sysdefs = -DSOLARIS -D_GNU_SOURCE -DAMD64
++sysdefs = -DSOLARIS -D__solaris__ -D_GNU_SOURCE -DAMD64
+Index: src/hotspot/src/os_cpu/solaris_x86/vm/prefetch_solaris_x86.inline.hpp
+===================================================================
+--- src.orig/hotspot/src/os_cpu/solaris_x86/vm/prefetch_solaris_x86.inline.hpp
++++ src/hotspot/src/os_cpu/solaris_x86/vm/prefetch_solaris_x86.inline.hpp
+@@ -27,21 +27,16 @@
+
+ #include "runtime/prefetch.hpp"
+
+-extern "C" {
+- void _Prefetch_read (void *loc, intx interval);
+- void _Prefetch_write(void *loc, intx interval);
+-}
+-
+ inline void Prefetch::read (void *loc, intx interval) {
+ #ifdef AMD64
+- _Prefetch_read(loc, interval);
++ __asm__ ("prefetcht0 (%0,%1,1)" : : "r" (loc), "r" (interval));
+ #endif // AMD64
+ }
+
+ // Use of this method should be gated by VM_Version::has_prefetchw.
+ inline void Prefetch::write(void *loc, intx interval) {
+ #ifdef AMD64
+- _Prefetch_write(loc, interval);
++ __asm__ ("prefetcht0 (%0,%1,1)" : : "r" (loc), "r" (interval));
+ #endif // AMD64
+ }
+
+Index: src/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp
+===================================================================
+--- src.orig/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp
++++ src/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp
+@@ -71,8 +71,11 @@ extern "C" {
+ #endif // AMD64
+ }
+ 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
+ }
+
+ }
+Index: src/jdk/src/solaris/native/java/util/TimeZone_md.c
+===================================================================
+--- src.orig/jdk/src/solaris/native/java/util/TimeZone_md.c
++++ src/jdk/src/solaris/native/java/util/TimeZone_md.c
+@@ -35,9 +35,6 @@
+ #include <string.h>
+ #include <dirent.h>
+ #include <unistd.h>
+-#if defined(__solaris__)
+-#include <libscf.h>
+-#endif
+
+ #include "jvm.h"
+ #include "TimeZone_md.h"
+@@ -49,27 +46,9 @@
+ #define readdir64_r readdir_r
+ #endif
+
+-#if !defined(__solaris__) || defined(__sparcv9) || defined(amd64)
+-#define fileopen fopen
+-#define filegets fgets
+-#define fileclose fclose
+-#endif
+-
+-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+ static const char *ETC_TIMEZONE_FILE = "/etc/timezone";
+ static const char *ZONEINFO_DIR = "/usr/share/zoneinfo";
+ static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime";
+-#else
+-static const char *SYS_INIT_FILE = "/etc/default/init";
+-static const char *ZONEINFO_DIR = "/usr/share/lib/zoneinfo";
+-static const char *DEFAULT_ZONEINFO_FILE = "/usr/share/lib/zoneinfo/localtime";
+-#endif /* defined(__linux__) || defined(_ALLBSD_SOURCE) */
+-
+-#if defined(_AIX)
+-static const char *ETC_ENVIRONMENT_FILE = "/etc/environment";
+-#endif
+-
+-#if defined(__linux__) || defined(MACOSX) || defined(__solaris__)
+
+ /*
+ * Returns a pointer to the zone ID portion of the given zoneinfo file
+@@ -146,13 +125,6 @@ findZoneinfoFile(char *buf, size_t size,
+ */
+ if ((strcmp(dp->d_name, "ROC") == 0)
+ || (strcmp(dp->d_name, "posixrules") == 0)
+-#if defined(__solaris__)
+- /*
+- * Skip the "src" and "tab" directories on Solaris.
+- */
+- || (strcmp(dp->d_name, "src") == 0)
+- || (strcmp(dp->d_name, "tab") == 0)
+-#endif
+ || (strcmp(dp->d_name, "localtime") == 0)) {
+ continue;
+ }
+@@ -215,8 +187,6 @@ findZoneinfoFile(char *buf, size_t size,
+ return tz;
+ }
+
+-#if defined(__linux__) || defined(MACOSX)
+-
+ /*
+ * Performs Linux specific mapping and returns a zone ID
+ * if found. Otherwise, NULL is returned.
+@@ -231,7 +201,6 @@ getPlatformTimeZoneID()
+ char *buf;
+ size_t size;
+
+-#if defined(__linux__)
+ /*
+ * Try reading the /etc/timezone file for Debian distros. There's
+ * no spec of the file format available. This parsing assumes that
+@@ -255,7 +224,6 @@ getPlatformTimeZoneID()
+ return tz;
+ }
+ }
+-#endif /* defined(__linux__) */
+
+ /*
+ * Next, try /etc/localtime to find the zone ID.
+@@ -320,430 +288,6 @@ getPlatformTimeZoneID()
+ return tz;
+ }
+
+-#elif defined(__solaris__)
+-
+-#if !defined(__sparcv9) && !defined(amd64)
+-
+-/*
+- * Those file* functions mimic the UNIX stream io functions. This is
+- * because of the limitation of the number of open files on Solaris
+- * (32-bit mode only) due to the System V ABI.
+- */
+-
+-#define BUFFER_SIZE 4096
+-
+-static struct iobuffer {
+- int magic; /* -1 to distinguish from the real FILE */
+- int fd; /* file descriptor */
+- char *buffer; /* pointer to buffer */
+- char *ptr; /* current read pointer */
+- char *endptr; /* end pointer */
+-};
+-
+-static int
+-fileclose(FILE *stream)
+-{
+- struct iobuffer *iop = (struct iobuffer *) stream;
+-
+- if (iop->magic != -1) {
+- return fclose(stream);
+- }
+-
+- if (iop == NULL) {
+- return 0;
+- }
+- close(iop->fd);
+- free((void *)iop->buffer);
+- free((void *)iop);
+- return 0;
+-}
+-
+-static FILE *
+-fileopen(const char *fname, const char *fmode)
+-{
+- FILE *fp;
+- int fd;
+- struct iobuffer *iop;
+-
+- if ((fp = fopen(fname, fmode)) != NULL) {
+- return fp;
+- }
+-
+- /*
+- * It assumes read open.
+- */
+- if ((fd = open(fname, O_RDONLY)) == -1) {
+- return NULL;
+- }
+-
+- /*
+- * Allocate struct iobuffer and its buffer
+- */
+- iop = malloc(sizeof(struct iobuffer));
+- if (iop == NULL) {
+- (void) close(fd);
+- errno = ENOMEM;
+- return NULL;
+- }
+- iop->magic = -1;
+- iop->fd = fd;
+- iop->buffer = malloc(BUFFER_SIZE);
+- if (iop->buffer == NULL) {
+- (void) close(fd);
+- free((void *) iop);
+- errno = ENOMEM;
+- return NULL;
+- }
+- iop->ptr = iop->buffer;
+- iop->endptr = iop->buffer;
+- return (FILE *)iop;
+-}
+-
+-/*
+- * This implementation assumes that n is large enough and the line
+- * separator is '\n'.
+- */
+-static char *
+-filegets(char *s, int n, FILE *stream)
+-{
+- struct iobuffer *iop = (struct iobuffer *) stream;
+- char *p;
+-
+- if (iop->magic != -1) {
+- return fgets(s, n, stream);
+- }
+-
+- p = s;
+- for (;;) {
+- char c;
+-
+- if (iop->ptr == iop->endptr) {
+- ssize_t len;
+-
+- if ((len = read(iop->fd, (void *)iop->buffer, BUFFER_SIZE)) == -1) {
+- return NULL;
+- }
+- if (len == 0) {
+- *p = 0;
+- if (s == p) {
+- return NULL;
+- }
+- return s;
+- }
+- iop->ptr = iop->buffer;
+- iop->endptr = iop->buffer + len;
+- }
+- c = *iop->ptr++;
+- *p++ = c;
+- if ((p - s) == (n - 1)) {
+- *p = 0;
+- return s;
+- }
+- if (c == '\n') {
+- *p = 0;
+- return s;
+- }
+- }
+- /*NOTREACHED*/
+-}
+-#endif /* !defined(__sparcv9) && !defined(amd64) */
+-
+-/*
+- * Performs Solaris dependent mapping. Returns a zone ID if
+- * found. Otherwise, NULL is returned. Solaris libc looks up
+- * "/etc/default/init" to get the default TZ value if TZ is not defined
+- * as an environment variable.
+- */
+-static char *
+-getPlatformTimeZoneID()
+-{
+- char *tz = NULL;
+- FILE *fp;
+-
+- /*
+- * Try the TZ entry in /etc/default/init.
+- */
+- if ((fp = fileopen(SYS_INIT_FILE, "r")) != NULL) {
+- char line[256];
+- char quote = '\0';
+-
+- while (filegets(line, sizeof(line), fp) != NULL) {
+- char *p = line;
+- char *s;
+- char c;
+-
+- /* quick check for comment lines */
+- if (*p == '#') {
+- continue;
+- }
+- if (strncmp(p, "TZ=", 3) == 0) {
+- p += 3;
+- SKIP_SPACE(p);
+- c = *p;
+- if (c == '"' || c == '\'') {
+- quote = c;
+- p++;
+- }
+-
+- /*
+- * PSARC/2001/383: quoted string support
+- */
+- for (s = p; (c = *s) != '\0' && c != '\n'; s++) {
+- /* No '\\' is supported here. */
+- if (c == quote) {
+- quote = '\0';
+- break;
+- }
+- if (c == ' ' && quote == '\0') {
+- break;
+- }
+- }
+- if (quote != '\0') {
+- jio_fprintf(stderr, "ZoneInfo: unterminated time zone name in /etc/TIMEZONE\n");
+- }
+- *s = '\0';
+- tz = strdup(p);
+- break;
+- }
+- }
+- (void) fileclose(fp);
+- }
+- return tz;
+-}
+-
+-#define TIMEZONE_FMRI "svc:/system/timezone:default"
+-#define TIMEZONE_PG "timezone"
+-#define LOCALTIME_PROP "localtime"
+-
+-static void
+-cleanupScf(scf_handle_t *h,
+- scf_snapshot_t *snap,
+- scf_instance_t *inst,
+- scf_propertygroup_t *pg,
+- scf_property_t *prop,
+- scf_value_t *val,
+- char *buf) {
+- if (buf != NULL) {
+- free(buf);
+- }
+- if (snap != NULL) {
+- scf_snapshot_destroy(snap);
+- }
+- if (val != NULL) {
+- scf_value_destroy(val);
+- }
+- if (prop != NULL) {
+- scf_property_destroy(prop);
+- }
+- if (pg != NULL) {
+- scf_pg_destroy(pg);
+- }
+- if (inst != NULL) {
+- scf_instance_destroy(inst);
+- }
+- if (h != NULL) {
+- scf_handle_destroy(h);
+- }
+-}
+-
+-/*
+- * Returns a zone ID of Solaris when the TZ value is "localtime".
+- * First, it tries scf. If scf fails, it looks for the same file as
+- * /usr/share/lib/zoneinfo/localtime under /usr/share/lib/zoneinfo/.
+- */
+-static char *
+-getSolarisDefaultZoneID() {
+- char *tz = NULL;
+- struct stat statbuf;
+- size_t size;
+- char *buf;
+- int fd;
+- /* scf specific variables */
+- scf_handle_t *h = NULL;
+- scf_snapshot_t *snap = NULL;
+- scf_instance_t *inst = NULL;
+- scf_propertygroup_t *pg = NULL;
+- scf_property_t *prop = NULL;
+- scf_value_t *val = NULL;
+-
+- if ((h = scf_handle_create(SCF_VERSION)) != NULL
+- && scf_handle_bind(h) == 0
+- && (inst = scf_instance_create(h)) != NULL
+- && (snap = scf_snapshot_create(h)) != NULL
+- && (pg = scf_pg_create(h)) != NULL
+- && (prop = scf_property_create(h)) != NULL
+- && (val = scf_value_create(h)) != NULL
+- && scf_handle_decode_fmri(h, TIMEZONE_FMRI, NULL, NULL, inst,
+- NULL, NULL, SCF_DECODE_FMRI_REQUIRE_INSTANCE) == 0
+- && scf_instance_get_snapshot(inst, "running", snap) == 0
+- && scf_instance_get_pg_composed(inst, snap, TIMEZONE_PG, pg) == 0
+- && scf_pg_get_property(pg, LOCALTIME_PROP, prop) == 0
+- && scf_property_get_value(prop, val) == 0) {
+- ssize_t len;
+-
+- /* Gets the length of the zone ID string */
+- len = scf_value_get_astring(val, NULL, 0);
+- if (len != -1) {
+- tz = malloc(++len); /* +1 for a null byte */
+- if (tz != NULL && scf_value_get_astring(val, tz, len) != -1) {
+- cleanupScf(h, snap, inst, pg, prop, val, NULL);
+- return tz;
+- }
+- }
+- }
+- cleanupScf(h, snap, inst, pg, prop, val, tz);
+-
+- if (stat(DEFAULT_ZONEINFO_FILE, &statbuf) == -1) {
+- return NULL;
+- }
+- size = (size_t) statbuf.st_size;
+- buf = malloc(size);
+- if (buf == NULL) {
+- return NULL;
+- }
+- if ((fd = open(DEFAULT_ZONEINFO_FILE, O_RDONLY)) == -1) {
+- free((void *) buf);
+- return NULL;
+- }
+-
+- if (read(fd, buf, size) != (ssize_t) size) {
+- (void) close(fd);
+- free((void *) buf);
+- return NULL;
+- }
+- (void) close(fd);
+- tz = findZoneinfoFile(buf, size, ZONEINFO_DIR);
+- free((void *) buf);
+- return tz;
+-}
+-
+-#endif /* defined(__solaris__) */
+-
+-#elif defined(_AIX)
+-
+-static char *
+-getPlatformTimeZoneID()
+-{
+- FILE *fp;
+- char *tz = NULL;
+- char *tz_key = "TZ=";
+- char line[256];
+- size_t tz_key_len = strlen(tz_key);
+-
+- if ((fp = fopen(ETC_ENVIRONMENT_FILE, "r")) != NULL) {
+- while (fgets(line, sizeof(line), fp) != NULL) {
+- char *p = strchr(line, '\n');
+- if (p != NULL) {
+- *p = '\0';
+- }
+- if (0 == strncmp(line, tz_key, tz_key_len)) {
+- tz = strdup(line + tz_key_len);
+- break;
+- }
+- }
+- (void) fclose(fp);
+- }
+-
+- return tz;
+-}
+-
+-static char *
+-mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz) {
+- FILE *tzmapf;
+- char mapfilename[PATH_MAX + 1];
+- char line[256];
+- int linecount = 0;
+- char *tz_buf = NULL;
+- char *temp_tz = NULL;
+- char *javatz = NULL;
+- size_t tz_len = 0;
+-
+- /* On AIX, the TZ environment variable may end with a comma
+- * followed by modifier fields. These are ignored here. */
+- temp_tz = strchr(tz, ',');
+- tz_len = (temp_tz == NULL) ? strlen(tz) : temp_tz - tz;
+- tz_buf = (char *)malloc(tz_len + 1);
+- memcpy(tz_buf, tz, tz_len);
+- tz_buf[tz_len] = 0;
+-
+- /* Open tzmappings file, with buffer overrun check */
+- if ((strlen(java_home_dir) + 15) > PATH_MAX) {
+- jio_fprintf(stderr, "Path %s/lib/tzmappings exceeds maximum path length\n", java_home_dir);
+- goto tzerr;
+- }
+- strcpy(mapfilename, java_home_dir);
+- strcat(mapfilename, "/lib/tzmappings");
+- if ((tzmapf = fopen(mapfilename, "r")) == NULL) {
+- jio_fprintf(stderr, "can't open %s\n", mapfilename);
+- goto tzerr;
+- }
+-
+- while (fgets(line, sizeof(line), tzmapf) != NULL) {
+- char *p = line;
+- char *sol = line;
+- char *java;
+- int result;
+-
+- linecount++;
+- /*
+- * Skip comments and blank lines
+- */
+- if (*p == '#' || *p == '\n') {
+- continue;
+- }
+-
+- /*
+- * Get the first field, platform zone ID
+- */
+- while (*p != '\0' && *p != '\t') {
+- p++;
+- }
+- if (*p == '\0') {
+- /* mapping table is broken! */
+- jio_fprintf(stderr, "tzmappings: Illegal format at near line %d.\n", linecount);
+- break;
+- }
+-
+- *p++ = '\0';
+- if ((result = strncmp(tz_buf, sol, tz_len)) == 0) {
+- /*
+- * If this is the current platform zone ID,
+- * take the Java time zone ID (2nd field).
+- */
+- java = p;
+- while (*p != '\0' && *p != '\n') {
+- p++;
+- }
+-
+- if (*p == '\0') {
+- /* mapping table is broken! */
+- jio_fprintf(stderr, "tzmappings: Illegal format at line %d.\n", linecount);
+- break;
+- }
+-
+- *p = '\0';
+- javatz = strdup(java);
+- break;
+- } else if (result < 0) {
+- break;
+- }
+- }
+- (void) fclose(tzmapf);
+-
+-tzerr:
+- if (tz_buf != NULL ) {
+- free((void *) tz_buf);
+- }
+-
+- if (javatz == NULL) {
+- return getGMTOffsetID();
+- }
+-
+- return javatz;
+-}
+-
+-#endif /* defined(_AIX) */
+-
+ /*
+ * findJavaTZ_md() maps platform time zone ID to Java time zone ID
+ * using <java_home>/lib/tzmappings. If the TZ value is not found, it
+@@ -771,41 +315,11 @@ findJavaTZ_md(const char *java_home_dir)
+ if (*tz == ':') {
+ tz++;
+ }
+-#if defined(__linux__)
+- /* Ignore "posix/" prefix on Linux. */
++ /* Ignore "posix/" prefix. */
+ if (strncmp(tz, "posix/", 6) == 0) {
+ tz += 6;
+ }
+-#endif
+
+-#if defined(_AIX)
+- /* On AIX do the platform to Java mapping. */
+- javatz = mapPlatformToJavaTimezone(java_home_dir, tz);
+- if (freetz != NULL) {
+- free((void *) freetz);
+- }
+-#else
+-#if defined(__solaris__)
+- /* Solaris might use localtime, so handle it here. */
+- if (strcmp(tz, "localtime") == 0) {
+- javatz = getSolarisDefaultZoneID();
+- if (freetz != NULL) {
+- free((void *) freetz);
+- }
+- } else
+-#endif
+- if (freetz == NULL) {
+- /* strdup if we are still working on getenv result. */
+- javatz = strdup(tz);
+- } else if (freetz != tz) {
+- /* strdup and free the old buffer, if we moved the pointer. */
+- javatz = strdup(tz);
+- free((void *) freetz);
+- } else {
+- /* we are good if we already work on a freshly allocated buffer. */
+- javatz = tz;
+- }
+-#endif
+ }
+
+ return javatz;
+@@ -848,19 +362,7 @@ getGMTOffsetID()
+ {
+ time_t offset;
+ char sign, buf[32];
+-#if defined(__solaris__)
+- struct tm localtm;
+- time_t currenttime;
+-
+- currenttime = time(NULL);
+- if (localtime_r(&currenttime, &localtm) == NULL) {
+- return NULL;
+- }
+-
+- offset = localtm.tm_isdst ? altzone : timezone;
+-#else
+ offset = timezone;
+-#endif
+
+ if (offset == 0) {
+ return strdup("GMT");
+Index: src/jdk/make/Images.gmk
+===================================================================
+--- src.orig/jdk/make/Images.gmk
++++ src/jdk/make/Images.gmk
+@@ -192,25 +192,6 @@ $(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)
+- define AddIsadirLink
+- # Param 1 - src file
+- # Param 2 - variable to add targets to
+-
+- $1_LINK := $$(dir $1)$(OPENJDK_TARGET_CPU_ISADIR)/$$(notdir $1)
+-
+- $$($1_LINK):
+- $(ECHO) $(LOG_INFO) Creating link $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
+- $(MKDIR) -p $$(@D)
+- $(LN) -s ../$$(@F) $$@
+-
+- $2 += $$($1_LINK)
+- endef
+-
+- $(foreach f,$(JRE_BIN_TARGETS),$(eval $(call AddIsadirLink,$f,JRE_BIN_ISADIR_LINK_TARGETS)))
+- $(foreach f,$(JDK_BIN_TARGETS),$(eval $(call AddIsadirLink,$f,JDK_BIN_ISADIR_LINK_TARGETS)))
+- $(foreach f,$(JDKJRE_BIN_TARGETS),$(eval $(call AddIsadirLink,$f,JDKJRE_BIN_ISADIR_LINK_TARGETS)))
+-endif
+
+ ################################################################################
+ # /lib dir
+@@ -236,7 +217,7 @@ ifeq ($(PROFILE), )
+ endif
+
+ JDK_LIB_FILES := $(NOT_JRE_LIB_FILES)
+-ifeq ($(OPENJDK_TARGET_OS), linux)
++ifneq (, $(filter $(OPENJDK_TARGET_OS), linux solaris))
+ JDK_LIB_FILES += jexec
+ endif
+
+@@ -437,17 +418,17 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
+ $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call install-ja-manpage, PCK)
+
+- ifeq ($(OPENJDK_TARGET_OS), solaris)
+- $(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+- $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+- $(install-file)
++ ifeq ($(OPENJDK_TARGET_OS), linux)
++ $(JRE_IMAGE_DIR)/man/ja:
++ $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
++ $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
+
+- $(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+- $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+- $(install-file)
++ $(JDK_IMAGE_DIR)/man/ja:
++ $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
++ $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
+ endif
+
+- ifeq ($(OPENJDK_TARGET_OS), linux)
++ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ $(JRE_IMAGE_DIR)/man/ja:
+ $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
+@@ -479,14 +460,12 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
+
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
+- $(addprefix $(JRE_IMAGE_DIR)/man/ja/man1/, $(JRE_MAN_PAGES)) \
+ $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
+- $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JRE_MAN_PAGES))
++ $(JRE_IMAGE_DIR)/man/ja
+
+ JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
+- $(addprefix $(JDK_IMAGE_DIR)/man/ja/man1/, $(JDK_MAN_PAGES)) \
+ $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
+- $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JDK_MAN_PAGES))
++ $(JDK_IMAGE_DIR)/man/ja
+ endif
+
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+Index: src/common/autoconf/hotspot-spec.gmk.in
+===================================================================
+--- src.orig/common/autoconf/hotspot-spec.gmk.in
++++ src/common/autoconf/hotspot-spec.gmk.in
+@@ -64,8 +64,6 @@ PLATFORM=$(OPENJDK_TARGET_OS)
+ ARCH_DATA_MODEL=$(OPENJDK_TARGET_CPU_BITS)
+
+ ALT_BOOTDIR=$(BOOT_JDK)
+-# Can be /sparcv9 or /amd64 on Solaris
+-ISA_DIR=$(OPENJDK_TARGET_CPU_ISADIR)
+ # Yet another name for arch used for an extra subdir below the jvm lib.
+ # Uses i386 and amd64, instead of x86 and x86_64.
+ LIBARCH=$(OPENJDK_TARGET_CPU_LEGACY_LIB)
+Index: src/common/autoconf/platform.m4
+===================================================================
+--- src.orig/common/autoconf/platform.m4
++++ src/common/autoconf/platform.m4
+@@ -370,13 +370,6 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
+ # /amd64 or /sparcv9. This string is appended to some library paths, like this:
+ # /usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libexample.so
+ OPENJDK_TARGET_CPU_ISADIR=""
+- if test "x$OPENJDK_TARGET_OS" = xsolaris; then
+- if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
+- OPENJDK_TARGET_CPU_ISADIR="/amd64"
+- elif test "x$OPENJDK_TARGET_CPU" = xsparcv9; then
+- OPENJDK_TARGET_CPU_ISADIR="/sparcv9"
+- fi
+- fi
+ AC_SUBST(OPENJDK_TARGET_CPU_ISADIR)
+
+ # Setup OPENJDK_TARGET_CPU_OSARCH, which is used to set the os.arch Java system property
diff --git a/debian/rules b/debian/rules
index 6c2302b..e8dccff 100755
--- a/debian/rules
+++ b/debian/rules
@@ -457,6 +457,10 @@ ifneq (,$(filter $(DEB_HOST_ARCH), kfreebsd-amd64 kfreebsd-i386))
kfreebsd-support-hotspot.diff
endif
+ifneq (,$(filter $(DEB_HOST_ARCH), illumos-amd64))
+ COMMON_PATCHES += dyson.patch
+endif
+
DEFAULT_PATCHES = \
$(COMMON_PATCHES) \
hotspot-libpath-$(hotspot_version).diff