From 6783ab9f4728678d03c88502877c3260b3afaf15 Mon Sep 17 00:00:00 2001 From: q66 Date: Wed, 30 Jan 2019 01:23:44 +0100 Subject: [PATCH] openjdk: update to 8u232b09, rename to openjdk8, native bootstrap This updates OpenJDK 8 to a newer version and brings a bunch of changes. Newly, it is bootstrapped with openjdk7-bootstrap, so it does not need to download binaries. It can also cross-compile and is patched for musl and other platforms. We're newly using the aarch64 port repo in order to get aarch64 JIT. For non-aarch64 platforms, the codebase is the same. The symlink for /usr/lib/jvm/openjdk is also now gone and we're using a unified java-VERSION-VENDOR naming. Also general template cleanup. [ci skip] --- common/shlibs | 12 +- etc/defaults.virtual | 4 +- srcpkgs/openjdk | 1 + srcpkgs/openjdk-doc | 2 +- srcpkgs/openjdk-jre | 2 +- srcpkgs/openjdk-src | 2 +- srcpkgs/openjdk/files/002_gcc.make-4.9.patch | 12 - srcpkgs/openjdk/files/mkcacerts | 214 -------- srcpkgs/openjdk/template | 230 --------- srcpkgs/openjdk8-doc | 1 + srcpkgs/openjdk8-jre | 1 + srcpkgs/openjdk8-src | 1 + srcpkgs/openjdk8/files/musl_001_hotspot.patch | 135 +++++ .../openjdk8/files/musl_002_hotspot_ppc.patch | 22 + .../files/musl_003_hotspot-noagent.patch | 79 +++ .../files/musl_004_fix_libjvm_load.patch | 14 + srcpkgs/openjdk8/files/musl_005_jdk.patch | 105 ++++ .../files/musl_006_jdk_includes.patch | 154 ++++++ srcpkgs/openjdk8/patches/001_8041658.patch | 22 + .../openjdk8/patches/002_8043780-pr3368.patch | 113 +++++ .../openjdk8/patches/003_8078504-pr3094.patch | 28 ++ .../openjdk8/patches/004_8087218-pr2740.patch | 23 + ...005_8158260-pr2991-rh1341258-aarch64.patch | 34 ++ .../005_8158260-pr2991-rh1341258.patch | 462 ++++++++++++++++++ .../openjdk8/patches/006_8197981-pr3548.patch | 32 ++ .../openjdk8/patches/007_8207057-pr3613.patch | 19 + srcpkgs/openjdk8/patches/008_no_devirt.patch | 20 + .../009_override-redirect-metacity.patch | 11 + srcpkgs/openjdk8/patches/010_pr1869.patch | 33 ++ srcpkgs/openjdk8/patches/011_pr3607.patch | 52 ++ srcpkgs/openjdk8/patches/012_pr3728.patch | 62 +++ srcpkgs/openjdk8/patches/013_werror.patch | 51 ++ .../openjdk8/patches/100_jdk-execinfo.patch | 20 + .../patches/101_jdk-fix-ipv6-init.patch | 42 ++ .../patches/102_jdk-getmntent-buffer.patch | 88 ++++ .../patches/103_hotspot-mask-shift.patch} | 4 +- .../patches/999-native-no-sysroot.patch | 28 ++ srcpkgs/openjdk8/template | 308 ++++++++++++ srcpkgs/{openjdk => openjdk8}/update | 0 39 files changed, 1974 insertions(+), 469 deletions(-) create mode 120000 srcpkgs/openjdk delete mode 100644 srcpkgs/openjdk/files/002_gcc.make-4.9.patch delete mode 100644 srcpkgs/openjdk/files/mkcacerts delete mode 100644 srcpkgs/openjdk/template create mode 120000 srcpkgs/openjdk8-doc create mode 120000 srcpkgs/openjdk8-jre create mode 120000 srcpkgs/openjdk8-src create mode 100644 srcpkgs/openjdk8/files/musl_001_hotspot.patch create mode 100644 srcpkgs/openjdk8/files/musl_002_hotspot_ppc.patch create mode 100644 srcpkgs/openjdk8/files/musl_003_hotspot-noagent.patch create mode 100644 srcpkgs/openjdk8/files/musl_004_fix_libjvm_load.patch create mode 100644 srcpkgs/openjdk8/files/musl_005_jdk.patch create mode 100644 srcpkgs/openjdk8/files/musl_006_jdk_includes.patch create mode 100644 srcpkgs/openjdk8/patches/001_8041658.patch create mode 100644 srcpkgs/openjdk8/patches/002_8043780-pr3368.patch create mode 100644 srcpkgs/openjdk8/patches/003_8078504-pr3094.patch create mode 100644 srcpkgs/openjdk8/patches/004_8087218-pr2740.patch create mode 100644 srcpkgs/openjdk8/patches/005_8158260-pr2991-rh1341258-aarch64.patch create mode 100644 srcpkgs/openjdk8/patches/005_8158260-pr2991-rh1341258.patch create mode 100644 srcpkgs/openjdk8/patches/006_8197981-pr3548.patch create mode 100644 srcpkgs/openjdk8/patches/007_8207057-pr3613.patch create mode 100644 srcpkgs/openjdk8/patches/008_no_devirt.patch create mode 100644 srcpkgs/openjdk8/patches/009_override-redirect-metacity.patch create mode 100644 srcpkgs/openjdk8/patches/010_pr1869.patch create mode 100644 srcpkgs/openjdk8/patches/011_pr3607.patch create mode 100644 srcpkgs/openjdk8/patches/012_pr3728.patch create mode 100644 srcpkgs/openjdk8/patches/013_werror.patch create mode 100644 srcpkgs/openjdk8/patches/100_jdk-execinfo.patch create mode 100644 srcpkgs/openjdk8/patches/101_jdk-fix-ipv6-init.patch create mode 100644 srcpkgs/openjdk8/patches/102_jdk-getmntent-buffer.patch rename srcpkgs/{openjdk/files/003_fix-mask_shift.patch => openjdk8/patches/103_hotspot-mask-shift.patch} (74%) create mode 100644 srcpkgs/openjdk8/patches/999-native-no-sysroot.patch create mode 100644 srcpkgs/openjdk8/template rename srcpkgs/{openjdk => openjdk8}/update (100%) diff --git a/common/shlibs b/common/shlibs index f6a212fc00..e53a363941 100644 --- a/common/shlibs +++ b/common/shlibs @@ -1778,12 +1778,12 @@ libslab.so.0 libmate-control-center-1.8.2_1 liblz4.so.1 liblz4-1.8.2_1 libatrilview.so.3 libatril-1.8.0_1 libatrildocument.so.3 libatril-1.8.0_1 -libjawt.so openjdk-jre-8u20_2 -libawt.so openjdk-jre-8u20_1 -libawt_xawt.so openjdk-jre-8u20_1 -libjava.so openjdk-jre-8u20_1 -libjli.so openjdk-jre-8u20_1 -libjvm.so openjdk-jre-8u20_1 +libjawt.so openjdk8-jre-8u20_2 +libawt.so openjdk8-jre-8u20_1 +libawt_xawt.so openjdk8-jre-8u20_1 +libjava.so openjdk8-jre-8u20_1 +libjli.so openjdk8-jre-8u20_1 +libjvm.so openjdk8-jre-8u20_1 libjawt.so openjdk11-11.0.5+10_1 libawt.so openjdk11-11.0.5+10_1 libawt_xawt.so openjdk11-11.0.5+10_1 diff --git a/etc/defaults.virtual b/etc/defaults.virtual index e9fe378f6a..c2b4fdfab5 100644 --- a/etc/defaults.virtual +++ b/etc/defaults.virtual @@ -21,8 +21,8 @@ awk gawk emacs emacs -java-environment openjdk -java-runtime openjdk-jre +java-environment openjdk8 +java-runtime openjdk8-jre libudev eudev-libudev nodejs-runtime nodejs ntp-daemon chrony diff --git a/srcpkgs/openjdk b/srcpkgs/openjdk new file mode 120000 index 0000000000..aa84827234 --- /dev/null +++ b/srcpkgs/openjdk @@ -0,0 +1 @@ +openjdk8 \ No newline at end of file diff --git a/srcpkgs/openjdk-doc b/srcpkgs/openjdk-doc index 9437a0d174..aa84827234 120000 --- a/srcpkgs/openjdk-doc +++ b/srcpkgs/openjdk-doc @@ -1 +1 @@ -openjdk \ No newline at end of file +openjdk8 \ No newline at end of file diff --git a/srcpkgs/openjdk-jre b/srcpkgs/openjdk-jre index 9437a0d174..aa84827234 120000 --- a/srcpkgs/openjdk-jre +++ b/srcpkgs/openjdk-jre @@ -1 +1 @@ -openjdk \ No newline at end of file +openjdk8 \ No newline at end of file diff --git a/srcpkgs/openjdk-src b/srcpkgs/openjdk-src index 9437a0d174..aa84827234 120000 --- a/srcpkgs/openjdk-src +++ b/srcpkgs/openjdk-src @@ -1 +1 @@ -openjdk \ No newline at end of file +openjdk8 \ No newline at end of file diff --git a/srcpkgs/openjdk/files/002_gcc.make-4.9.patch b/srcpkgs/openjdk/files/002_gcc.make-4.9.patch deleted file mode 100644 index 13715a5d67..0000000000 --- a/srcpkgs/openjdk/files/002_gcc.make-4.9.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- old/make/linux/makefiles/gcc.make 2014-04-23 22:07:59.838205838 +0100 -+++ new/make/linux/makefiles/gcc.make 2014-04-23 22:07:59.754204533 +0100 -@@ -266,6 +266,9 @@ - ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1) - OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT) - endif -+ ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 9), 1) -+ OPT_CFLAGS/macroAssembler_x86.o += -fno-devirtualize -+ endif - endif - - # Flags for generating make dependency flags. diff --git a/srcpkgs/openjdk/files/mkcacerts b/srcpkgs/openjdk/files/mkcacerts deleted file mode 100644 index 2db5a77bb0..0000000000 --- a/srcpkgs/openjdk/files/mkcacerts +++ /dev/null @@ -1,214 +0,0 @@ -#!/bin/sh -# Script provided by http://www.linuxfromscratch.org/blfs/view/svn/general/openjdk.html#ojdk-certs -# EB 20141217: removed bashisms -# Simple script to extract x509 certificates and create a JRE cacerts file. - -get_args() - { - if test -z "${1}" ; then - showhelp - exit 1 - fi - - while test -n "${1}" ; do - case "${1}" in - -f | --cafile) - check_arg $1 $2 - CAFILE="${2}" - shift 2 - ;; - -d | --cadir) - check_arg $1 $2 - CADIR="${2}" - shift 2 - ;; - -o | --outfile) - check_arg $1 $2 - OUTFILE="${2}" - shift 2 - ;; - -k | --keytool) - check_arg $1 $2 - KEYTOOL="${2}" - shift 2 - ;; - -s | --openssl) - check_arg $1 $2 - OPENSSL="${2}" - shift 2 - ;; - -h | --help) - showhelp - exit 0 - ;; - *) - showhelp - exit 1 - ;; - esac - done - } - -check_arg() - { - echo "${2}" | grep -v "^-" > /dev/null - if [ -z "$?" -o ! -n "$2" ]; then - echo "Error: $1 requires a valid argument." - exit 1 - fi - } - -# The date binary is not reliable on 32bit systems for dates after 2038 -mydate() - { - local y=$( echo $1 | cut -d" " -f4 ) - local M=$( echo $1 | cut -d" " -f1 ) - local d=$( echo $1 | cut -d" " -f2 ) - local m - - if [ ${d} -lt 10 ]; then d="0${d}"; fi - - case $M in - Jan) m="01";; - Feb) m="02";; - Mar) m="03";; - Apr) m="04";; - May) m="05";; - Jun) m="06";; - Jul) m="07";; - Aug) m="08";; - Sep) m="09";; - Oct) m="10";; - Nov) m="11";; - Dec) m="12";; - esac - - certdate="${y}${m}${d}" - } - -showhelp() - { - echo "`basename ${0}` creates a valid cacerts file for use with IcedTea." - echo "" - echo " -f --cafile The path to a file containing PEM" - echo " formated CA certificates. May not be" - echo " used with -d/--cadir." - echo "" - echo " -d --cadir The path to a directory of PEM formatted" - echo " CA certificates. May not be used with" - echo " -f/--cafile." - echo "" - echo " -o --outfile The path to the output file." - echo "" - echo " -k --keytool The path to the java keytool utility." - echo "" - echo " -s --openssl The path to the openssl utility." - echo "" - echo " -h --help Show this help message and exit." - echo "" - echo "" - } - -# Initialize empty variables so that the shell does not pollute the script -CAFILE="" -CADIR="" -OUTFILE="" -OPENSSL="" -KEYTOOL="" -certdate="" -date="" -today=$( date +%Y%m%d ) - -# Process command line arguments -get_args ${@} - -# Handle common errors -if test "${CAFILE}x" = "x" -a "${CADIR}x" = "x" ; then - echo "ERROR! You must provide an x509 certificate store!" - echo "\'$(basename ${0}) --help\' for more info." - echo "" - exit 1 -fi - -if test "${CAFILE}x" != "x" -a "${CADIR}x" != "x" ; then - echo "ERROR! You cannot provide two x509 certificate stores!" - echo "\'$(basename ${0}) --help\' for more info." - echo "" - exit 1 -fi - -if test "${KEYTOOL}x" = "x" ; then - echo "ERROR! You must provide a valid keytool program!" - echo "\'$(basename ${0}) --help\' for more info." - echo "" - exit 1 -fi - -if test "${OPENSSL}x" = "x" ; then - echo "ERROR! You must provide a valid path to openssl!" - echo "\'$(basename ${0}) --help\' for more info." - echo "" - exit 1 -fi - -if test "${OUTFILE}x" = "x" ; then - echo "ERROR! You must provide a valid output file!" - echo "\'$(basename ${0}) --help\' for more info." - echo "" - exit 1 -fi - -# Get on with the work - -# If using a CAFILE, split it into individual files in a temp directory -if test "${CAFILE}x" != "x" ; then - TEMPDIR=`mktemp -d` - CADIR="${TEMPDIR}" - - # Get a list of staring lines for each cert - CERTLIST=`grep -n "^-----BEGIN" "${CAFILE}" | cut -d ":" -f 1` - - # Get a list of ending lines for each cert - ENDCERTLIST=`grep -n "^-----END" "${CAFILE}" | cut -d ":" -f 1` - - # Start a loop - for certbegin in ${CERTLIST} ; do - for certend in ${ENDCERTLIST} ; do - if test "${certend}" -gt "${certbegin}"; then - break - fi - done - sed -n "${certbegin},${certend}p" "${CAFILE}" > "${CADIR}/${certbegin}.pem" - keyhash=`${OPENSSL} x509 -noout -in "${CADIR}/${certbegin}.pem" -hash` - echo "Generated PEM file with hash: ${keyhash}." - done -fi - -# Write the output file -for cert in `find "${CADIR}" -type f -name "*.pem" -o -name "*.crt"` -do - - # Make sure the certificate date is valid... - date=$( ${OPENSSL} x509 -enddate -in "${cert}" -noout | sed 's/^notAfter=//' ) - mydate "${date}" - if test "${certdate}" -lt "${today}" ; then - echo "${cert} expired on ${certdate}! Skipping..." - unset date certdate - continue - fi - unset date certdate - ls "${cert}" - tempfile=`mktemp` - sed -n "/^-----BEGIN/,/^-----END/p" "${cert}" > "${tempfile}" - echo yes | env LC_ALL=C "${KEYTOOL}" -import \ - -alias `basename "${cert}"` \ - -keystore "${OUTFILE}" \ - -storepass 'changeit' \ - -file "${tempfile}" - rm "${tempfile}" -done - -if test "${TEMPDIR}x" != "x" ; then - rm -rf "${TEMPDIR}" -fi -exit 0 diff --git a/srcpkgs/openjdk/template b/srcpkgs/openjdk/template deleted file mode 100644 index 060558fed7..0000000000 --- a/srcpkgs/openjdk/template +++ /dev/null @@ -1,230 +0,0 @@ -# Template file for 'openjdk' -# TODO: better places for bin and man? -# TODO: make -headless versions -# TODO: config files? -# TODO: find giflib patch for --with-giflib=system - -_java_ver=8 -_jdk_update=202 -_jdk_build=00 -_main_ver=${_java_ver}u${_jdk_update} -_openjdk_version="openjdk-1.8.0_${_jdk_update}" - -pkgname=openjdk -version="${_java_ver}u${_jdk_update}b${_jdk_build}" -revision=1 -_repo_ver="jdk${version/b/-b}" -nocross=yes -wrksrc="jdk8u-jdk8u${_jdk_update}-b${_jdk_build}/" -build_style=gnu-configure -configure_args=" - --prefix=${XBPS_DESTDIR}/${pkgname}-${version}/usr/lib - --with-update-version=${_jdk_update} - --with-build-number=b${_jdk_build} - --with-milestone=fcs - --enable-unlimited-crypto - --with-zlib=system - $(vopt_if oracle_bootstrap --with-boot-jdk=/usr/lib/jvm/oracle-jdk \ - --with-boot-jdk=/usr/lib/jvm/openjdk)" -make_build_args="DEBUG_BINARIES=true docs all" -hostmakedepends="pkg-config cpio unzip zip ca-certificates libressl" -case "$XBPS_MACHINE" in - arm*) hostmakedepends+=" $(vopt_if oracle_bootstrap oracle-jdk-arm openjdk)";; - *) hostmakedepends+=" $(vopt_if oracle_bootstrap oracle-jdk openjdk)";; -esac -makedepends="libXrender-devel libXtst-devel libXt-devel - libjpeg-turbo-devel cups-devel freetype-devel alsa-lib-devel" -case "$XBPS_TARGET_MACHINE" in - arm*) - makedepends+=" libffi-devel" - configure_args+=" --with-jvm-variants=zero" -esac -depends="openjdk-jre-${version}_${revision}" -provides="java-environment-${version}_1" -short_desc="OpenJDK Java Development Kit" -maintainer="Toyam Cox " -license="GPL-3" -homepage="http://openjdk.java.net/" -distfiles=" - http://hg.openjdk.java.net/jdk8u/jdk8u/archive/${_repo_ver}.tar.gz>jdk8u-${_repo_ver}.tar.gz - http://hg.openjdk.java.net/jdk8u/jdk8u/corba/archive/${_repo_ver}.tar.gz>corba-${_repo_ver}.tar.gz - http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/archive/${_repo_ver}.tar.gz>hotspot-${_repo_ver}.tar.gz - http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/archive/${_repo_ver}.tar.gz>jdk-${_repo_ver}.tar.gz - http://hg.openjdk.java.net/jdk8u/jdk8u/jaxws/archive/${_repo_ver}.tar.gz>jaxws-${_repo_ver}.tar.gz - http://hg.openjdk.java.net/jdk8u/jdk8u/jaxp/archive/${_repo_ver}.tar.gz>jaxp-${_repo_ver}.tar.gz - http://hg.openjdk.java.net/jdk8u/jdk8u/langtools/archive/${_repo_ver}.tar.gz>langtools-${_repo_ver}.tar.gz - http://hg.openjdk.java.net/jdk8u/jdk8u/nashorn/archive/${_repo_ver}.tar.gz>nashorn-${_repo_ver}.tar.gz" - -checksum="ddc0b51b9887066e9a3e574cd22c715a4cd32c4ef919f1df73854102380496ee - a5058d0d43c3b5353fbc107f145edd6fb2051da6b6354f0f0383ade51d53e89a - e1b8304ba959b790b8b403b7b7dc483307ab1f6eb9a0aea6bf6e57e31417202d - 65a51abb20297ae857ab2ce6f8482446c91102f7958da71e6af2ad9c0a9c02d9 - 117a4fa223cc89957429ace91c90ca1fdb8188cc9266c108a05f438d80032d85 - 779bc970168f5e9f73d5f7b4515ec01573043bbc358eb1002415657b7df716dc - 400c923a881ad44d25b2005911ed76177af9585f2507038bece0836561e08659 - ff106807a5eccf16ee22d7d729354d309b0819f09c066222776ec34a04dd8dd9" - -# Build is still parallel, but don't use -jN. -disable_parallel_build=yes - -build_options="oracle_bootstrap" -build_options_default="oracle_bootstrap" -desc_option_oracle_bootstrap="Bootstrap using Oracle JDK" - -alternatives=" - java:/usr/bin/java:/usr/lib/jvm/openjdk/bin/java - java:/usr/bin/jjs:/usr/lib/jvm/openjdk/bin/jjs - java:/usr/bin/keytool:/usr/lib/jvm/openjdk/bin/keytool - java:/usr/bin/mkcacerts:/usr/lib/jvm/openjdk/bin/mkcacerts - java:/usr/bin/orbd:/usr/lib/jvm/openjdk/bin/orbd - java:/usr/bin/pack200:/usr/lib/jvm/openjdk/bin/pack200 - java:/usr/bin/policytool:/usr/lib/jvm/openjdk/bin/policytool - java:/usr/bin/rmid:/usr/lib/jvm/openjdk/bin/rmid - java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk/bin/rmiregistry - java:/usr/bin/servertool:/usr/lib/jvm/openjdk/bin/servertool - java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk/bin/tnameserv - java:/usr/bin/unpack200:/usr/lib/jvm/openjdk/bin/unpack200 - - jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk/bin/appletviewer - jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk/bin/extcheck - jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk/bin/idlj - jdk:/usr/bin/jar:/usr/lib/jvm/openjdk/bin/jar - jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk/bin/jarsigner - jdk:/usr/bin/java:/usr/lib/jvm/openjdk/bin/java - jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk/bin/java-rmi.cgi - jdk:/usr/bin/javac:/usr/lib/jvm/openjdk/bin/javac - jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk/bin/javadoc - jdk:/usr/bin/javah:/usr/lib/jvm/openjdk/bin/javah - jdk:/usr/bin/javap:/usr/lib/jvm/openjdk/bin/javap - jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk/bin/jcmd - jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk/bin/jconsole - jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk/bin/jdb - jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk/bin/jdeps - jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk/bin/jhat - jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk/bin/jinfo - jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk/bin/jjs - jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk/bin/jmap - jdk:/usr/bin/jps:/usr/lib/jvm/openjdk/bin/jps - jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk/bin/jrunscript - jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk/bin/jsadebugd - jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk/bin/jstack - jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk/bin/jstat - jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk/bin/jstatd - jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk/bin/keytool - jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk/bin/native2ascii - jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk/bin/orbd - jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk/bin/pack200 - jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk/bin/policytool - jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk/bin/rmic - jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk/bin/rmid - jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk/bin/rmiregistry - jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk/bin/schemagen - jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk/bin/serialver - jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk/bin/servertool - jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk/bin/tnameserv - jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk/bin/unpack200 - jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk/bin/wsgen - jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk/bin/wsimport - jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk/bin/xjc -" - -CFLAGS="-Wno-error=deprecated-declarations" - -# Append CFLAGS to set work around code which gcc6 would -# otherwise regard as out-of-specification and allow it -# to produce a working program. -CFLAGS+=" -Wno-error -std=c++98 -fno-delete-null-pointer-checks -fno-lifetime-dse" - -CFLAGS+=" -Wno-deprecated-declarations -Wno-stringop-overflow -Wno-return-type" - -post_extract() { - cd ${XBPS_BUILDDIR}/jdk-${_repo_ver} - # gcc6 complains about the signed shift left - vsed -i src/share/native/com/sun/java/util/jar/pack/constants.h \ - -e's;(-1)<<13;~0u<<13;g' - # wrong "return false;" instead of "return null;" - vsed -i src/share/native/com/sun/java/util/jar/pack/jni.cpp \ - -e"295s;false;null;" - cd ${wrksrc} - chmod +x configure - for subrepo in corba hotspot jdk jaxws jaxp langtools nashorn; do - ln -s ../${subrepo}-${_repo_ver} ${subrepo} - done - cd hotspot - # https://bugs.openjdk.java.net/browse/JDK-8041658 - patch -p1 < ${FILESDIR}/002_gcc.make-4.9.patch - # patch supported os versions to include 4 and 4.1 - vsed -i ${wrksrc}/hotspot/make/linux/Makefile \ - -e "/SUPPORTED_OS_VERSION =/s;\(.*\);\1 4% 4.1% 5%;" -} - -do_build() { - # -D_FORTIFY_SOURCE=2 doesn't work with CXX_O_FLAG_NONE="-O0" - CFLAGS=${CFLAGS/-D_FORTIFY_SOURCE=2/} - CXXFLAGS=${CXXFLAGS/-D_FORTIFY_SOURCE=2/} - make ${makejobs} ${make_build_args} -} - -post_install() { - rm -rf ${DESTDIR}/usr/lib/bin - vinstall ${FILESDIR}/mkcacerts 755 usr/lib/jvm/$_openjdk_version/jre/bin - vmkdir usr/lib/jvm/$_openjdk_version/jre/lib/security - sh ${FILESDIR}/mkcacerts \ - -d "/usr/share/ca-certificates/" \ - -s "/usr/bin/openssl" \ - -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/jre/bin/keytool" \ - -o "${DESTDIR}/usr/lib/jvm/$_openjdk_version/jre/lib/security/cacerts" - vlicense ASSEMBLY_EXCEPTION - vlicense LICENSE - vlicense THIRD_PARTY_README -} - -openjdk-jre_package() { - shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so" - short_desc="OpenJDK Java Runtime Environment" - provides="java-runtime-${version}_1" - alternatives=" - java:/usr/bin/java:/usr/lib/jvm/openjdk/jre/bin/java - java:/usr/bin/jjs:/usr/lib/jvm/openjdk/jre/bin/jjs - java:/usr/bin/keytool:/usr/lib/jvm/openjdk/jre/bin/keytool - java:/usr/bin/mkcacerts:/usr/lib/jvm/openjdk/jre/bin/mkcacerts - java:/usr/bin/orbd:/usr/lib/jvm/openjdk/jre/bin/orbd - java:/usr/bin/pack200:/usr/lib/jvm/openjdk/jre/bin/pack200 - java:/usr/bin/policytool:/usr/lib/jvm/openjdk/jre/bin/policytool - java:/usr/bin/rmid:/usr/lib/jvm/openjdk/jre/bin/rmid - java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk/jre/bin/rmiregistry - java:/usr/bin/servertool:/usr/lib/jvm/openjdk/jre/bin/servertool - java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk/jre/bin/tnameserv - java:/usr/bin/unpack200:/usr/lib/jvm/openjdk/jre/bin/unpack200 - " - pkg_install() { - vmove "usr/lib/jvm/$_openjdk_version/jre" - ln -s $_openjdk_version ${PKGDESTDIR}/usr/lib/jvm/openjdk - vmkdir etc/profile.d - cat >>${PKGDESTDIR}/etc/profile.d/10_openjdk.sh < + # include + # include +-# include + # include + # include + # include +@@ -530,6 +529,13 @@ void os::Linux::hotspot_sigmask(Thread* thread) { + // detecting pthread library + + void os::Linux::libpthread_init() { ++#if 1 ++ // Hard code Alpine Linux supported musl compatible settings ++ os::Linux::set_glibc_version("glibc 2.9"); ++ os::Linux::set_libpthread_version("NPTL"); ++ os::Linux::set_is_NPTL(); ++ os::Linux::set_is_floating_stack(); ++#else + // Save glibc and pthread version strings. Note that _CS_GNU_LIBC_VERSION + // and _CS_GNU_LIBPTHREAD_VERSION are supported in glibc >= 2.3.2. Use a + // generic name for earlier versions. +@@ -588,6 +594,7 @@ void os::Linux::libpthread_init() { + if (os::Linux::is_NPTL() || os::Linux::supports_variable_stack_size()) { + os::Linux::set_is_floating_stack(); + } ++#endif + } + + ///////////////////////////////////////////////////////////////////////////// +@@ -2834,6 +2841,11 @@ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { } + extern "C" JNIEXPORT void numa_error(char *where) { } + extern "C" JNIEXPORT int fork1() { return fork(); } + ++static void *dlvsym(void *handle, const char *name, const char *ver) ++{ ++ return dlsym(handle, name); ++} ++ + // Handle request to load libnuma symbol version 1.1 (API v1). If it fails + // load symbol from base version instead. + void* os::Linux::libnuma_dlsym(void* handle, const char *name) { +diff --git openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp +index 10d56d8..b9b2b77 100644 +--- openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp ++++ openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp +@@ -33,7 +33,7 @@ + + #include + #include +-#include ++#include + #include + + inline void* os::thread_local_storage_at(int index) { +diff --git openjdk/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp openjdk/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp +index d2c10e0..20f657f 100644 +--- openjdk/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp ++++ openjdk/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp +@@ -75,7 +75,7 @@ + # include + # include + # include +-# include ++# include /* provides __u64 */ + + #ifdef BUILTIN_SIM + #define REG_SP REG_RSP +diff --git openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +index 38388cb..2505ba8 100644 +--- openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp ++++ openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +@@ -72,7 +72,6 @@ + # include + # include + # include +-# include + + #ifdef AMD64 + #define REG_SP REG_RSP +@@ -544,6 +543,9 @@ JVM_handle_linux_signal(int sig, + return true; // Mute compiler + } + ++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw)) ++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw)) ++ + void os::Linux::init_thread_fpu_state(void) { + #ifndef AMD64 + // set fpu to 53 bit precision +diff --git openjdk/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp openjdk/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp +index f3f2f26..6b50cfa 100644 +--- openjdk/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp ++++ openjdk/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp +@@ -32,7 +32,9 @@ + // map stack pointer to thread pointer - see notes in threadLS_linux_x86.cpp + #define SP_BITLENGTH 32 + #define PAGE_SHIFT 12 ++ #ifndef PAGE_SIZE + #define PAGE_SIZE (1UL << PAGE_SHIFT) ++ #endif + static Thread* _sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)]; + + public: +diff --git openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp +index efa0b4e..6df2302 100644 +--- openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp ++++ openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp +@@ -235,7 +235,7 @@ inline int g_isnan(double f) { return isnand(f); } + #elif defined(__APPLE__) + inline int g_isnan(double f) { return isnan(f); } + #elif defined(LINUX) || defined(_ALLBSD_SOURCE) +-inline int g_isnan(float f) { return isnanf(f); } ++inline int g_isnan(float f) { return isnan(f); } + inline int g_isnan(double f) { return isnan(f); } + #else + #error "missing platform-specific definition here" diff --git a/srcpkgs/openjdk8/files/musl_002_hotspot_ppc.patch b/srcpkgs/openjdk8/files/musl_002_hotspot_ppc.patch new file mode 100644 index 0000000000..d9a10ab694 --- /dev/null +++ b/srcpkgs/openjdk8/files/musl_002_hotspot_ppc.patch @@ -0,0 +1,22 @@ +--- openjdk.orig/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp ++++ openjdk/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp +@@ -80,7 +80,7 @@ + # include + # include + # include +- ++# include + + address os::current_stack_pointer() { + intptr_t* csp; +--- openjdk.orig/hotspot.orig/src/cpu/ppc/vm/macroAssembler_ppc.cpp ++++ openjdk/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp +@@ -46,6 +46,8 @@ + #include "gc_implementation/g1/heapRegion.hpp" + #endif + ++#include ++ + #ifdef PRODUCT + #define BLOCK_COMMENT(str) // nothing + #else diff --git a/srcpkgs/openjdk8/files/musl_003_hotspot-noagent.patch b/srcpkgs/openjdk8/files/musl_003_hotspot-noagent.patch new file mode 100644 index 0000000000..25bdb1c5a5 --- /dev/null +++ b/srcpkgs/openjdk8/files/musl_003_hotspot-noagent.patch @@ -0,0 +1,79 @@ +--- openjdk.orig/common/autoconf/configure ++++ openjdk/common/autoconf/configure +@@ -103,7 +103,7 @@ + } + + # Check for local changes +-check_hg_updates ++run_autogen_or_fail + + if test -e $conf_custom_script_dir/generated-configure.sh; then + # Test if open configure is newer than custom configure, if so, custom needs to +--- openjdk.orig/common/autoconf/jdk-options.m4 ++++ openjdk/common/autoconf/jdk-options.m4 +@@ -159,7 +159,7 @@ + AC_SUBST(JVM_VARIANT_ZEROSHARK) + AC_SUBST(JVM_VARIANT_CORE) + +- INCLUDE_SA=true ++ AC_CHECK_HEADER(thread_db.h,INCLUDE_SA=true,INCLUDE_SA=false) + if test "x$JVM_VARIANT_ZERO" = xtrue ; then + INCLUDE_SA=false + fi +--- openjdk.orig/hotspot/make/linux/makefiles/defs.make ++++ openjdk/hotspot/make/linux/makefiles/defs.make +@@ -305,6 +305,9 @@ + + # Serviceability Binaries + # No SA Support for PPC, IA64, ARM or zero ++# or if thread_db.h missing (musl) ++ ++ifneq ($(wildcard /usr/include/thread_db.h),) + ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ + $(EXPORT_LIB_DIR)/sa-jdi.jar + ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ +@@ -322,6 +322,11 @@ + endif + endif + endif ++else ++ADD_SA_BINARIES/x86 = ++ADD_SA_BINARIES/sparc = ++ADD_SA_BINARIES/aarch64 = ++endif + ADD_SA_BINARIES/ppc = + ADD_SA_BINARIES/ia64 = + ADD_SA_BINARIES/arm = +--- openjdk.orig/hotspot/make/linux/makefiles/sa.make ++++ openjdk/hotspot/make/linux/makefiles/sa.make +@@ -59,9 +59,11 @@ + + # if $(AGENT_DIR) does not exist, we don't build SA + # also, we don't build SA on Itanium or zero. ++# check for thread_db.h too (musl does not have it). + + all: +- if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \ ++ if [ -d $(AGENT_DIR) -a -f /usr/include/thread_db.h \ ++ -a "$(SRCARCH)" != "ia64" \ + -a "$(SRCARCH)" != "zero" ] ; then \ + $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \ + fi +--- openjdk.orig/hotspot/make/linux/makefiles/saproc.make ++++ openjdk/hotspot/make/linux/makefiles/saproc.make +@@ -61,12 +61,15 @@ + + # if $(AGENT_DIR) does not exist, we don't build SA + # also, we don't build SA on Itanium or zero. ++# check for thread_db.h too (musl does not have it). + ++ifneq ($(wildcard /usr/include/thread_db.h),) + ifneq ($(wildcard $(AGENT_DIR)),) + ifneq ($(filter-out ia64 zero,$(SRCARCH)),) + BUILDLIBSAPROC = $(LIBSAPROC) + endif + endif ++endif + + ifneq ($(ALT_SASRCDIR),) + ALT_SAINCDIR=-I$(ALT_SASRCDIR) -DALT_SASRCDIR diff --git a/srcpkgs/openjdk8/files/musl_004_fix_libjvm_load.patch b/srcpkgs/openjdk8/files/musl_004_fix_libjvm_load.patch new file mode 100644 index 0000000000..d0a090ea57 --- /dev/null +++ b/srcpkgs/openjdk8/files/musl_004_fix_libjvm_load.patch @@ -0,0 +1,14 @@ +musl needs LD_LIBRARY_PATH set because when .so is opened with dlopen(/abs/path) +it does not qualify for providing symbols for NEEDED dependency. + +--- openjdk.orig/jdk/src/solaris/bin/java_md_solinux.c ++++ openjdk/jdk/src/solaris/bin/java_md_solinux.c +@@ -291,6 +291,8 @@ + char *dmllp = NULL; + char *p; /* a utility pointer */ + ++ return JNI_TRUE; ++ + #ifdef AIX + /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */ + return JNI_TRUE; diff --git a/srcpkgs/openjdk8/files/musl_005_jdk.patch b/srcpkgs/openjdk8/files/musl_005_jdk.patch new file mode 100644 index 0000000000..97946ba424 --- /dev/null +++ b/srcpkgs/openjdk8/files/musl_005_jdk.patch @@ -0,0 +1,105 @@ +diff -ru openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp +--- openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp 2017-01-25 04:22:03.000000000 +0000 ++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp 2017-02-06 11:23:47.041165210 +0000 +@@ -46,6 +46,8 @@ + + #include "zip.h" + ++#define uchar unsigned char ++ + #ifdef NO_ZLIB + + inline bool jar::deflate_bytes(bytes& head, bytes& tail) { +diff -ru openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h +--- openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h 2017-01-25 04:22:03.000000000 +0000 ++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h 2017-02-06 11:23:47.047832009 +0000 +@@ -23,9 +23,7 @@ + * questions. + */ + +-#define ushort unsigned short +-#define uint unsigned int +-#define uchar unsigned char ++#include + + struct unpacker; + +diff -ru openjdk.orig/jdk/src/share/native/sun/awt/medialib/mlib_types.h openjdk/jdk/src/share/native/sun/awt/medialib/mlib_types.h +--- openjdk.orig/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2017-01-25 04:22:03.000000000 +0000 ++++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2017-02-06 11:23:47.047832009 +0000 +@@ -27,6 +27,7 @@ + #ifndef MLIB_TYPES_H + #define MLIB_TYPES_H + ++#include /* for NULL */ + #include + #if defined(_MSC_VER) + #include /* for FLT_MAX and DBL_MAX */ +diff -ru openjdk.orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c +--- openjdk.orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2017-01-25 04:22:03.000000000 +0000 ++++ openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2017-02-06 11:23:47.047832009 +0000 +@@ -47,7 +47,7 @@ + + #include "java_net_Inet4AddressImpl.h" + +-#if defined(__GLIBC__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104)) ++#if defined(__linux__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104)) + #define HAS_GLIBC_GETHOSTBY_R 1 + #endif + +diff -ru openjdk.orig/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c +--- openjdk.orig/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c 2017-01-25 04:22:03.000000000 +0000 ++++ openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c 2017-02-06 11:23:47.047832009 +0000 +@@ -41,7 +41,6 @@ + #endif + #ifdef __linux__ + #include +-#include + #include + #include + +diff -ru openjdk.orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c +--- openjdk.orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2017-01-25 04:22:03.000000000 +0000 ++++ openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2017-02-06 11:23:47.047832009 +0000 +@@ -43,7 +43,6 @@ + #endif + #ifdef __linux__ + #include +-#include + #endif + + #include "jvm.h" +diff -ru openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c openjdk/jdk/src/solaris/native/java/net/linux_close.c +--- openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c 2017-01-25 04:22:03.000000000 +0000 ++++ openjdk/jdk/src/solaris/native/java/net/linux_close.c 2017-02-06 11:23:47.047832009 +0000 +@@ -56,7 +56,7 @@ + /* + * Signal to unblock thread + */ +-static int sigWakeup = (__SIGRTMAX - 2); ++static int sigWakeup; + + /* + * The fd table and the number of file descriptors +@@ -95,6 +95,9 @@ + /* + * Setup the signal handler + */ ++#ifndef __AIX ++ sigWakeup = SIGRTMAX - 2; ++#endif + sa.sa_handler = sig_wakeup; + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); +diff -ru openjdk.orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c +--- openjdk.orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c 2017-01-25 04:22:03.000000000 +0000 ++++ openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c 2017-02-06 11:23:47.051165409 +0000 +@@ -36,7 +36,7 @@ + #include + #include + /* Also defined in net/linux_close.c */ +- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2) ++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2) + #elif __solaris__ + #include + #include diff --git a/srcpkgs/openjdk8/files/musl_006_jdk_includes.patch b/srcpkgs/openjdk8/files/musl_006_jdk_includes.patch new file mode 100644 index 0000000000..6443a1973d --- /dev/null +++ b/srcpkgs/openjdk8/files/musl_006_jdk_includes.patch @@ -0,0 +1,154 @@ +--- openjdk.orig/jdk/src/aix/native/java/net/aix_close.c ++++ openjdk/jdk/src/aix/native/java/net/aix_close.c +@@ -62,7 +62,7 @@ + #include + #include + +-#include ++#include + + /* + * Stack allocated by thread when doing blocking operation +--- openjdk.orig/jdk/src/aix/native/sun/nio/ch/AixNativeThread.c ++++ openjdk/jdk/src/aix/native/sun/nio/ch/AixNativeThread.c +@@ -32,7 +32,7 @@ + #include "sun_nio_ch_NativeThread.h" + + #include +-#include ++#include + + /* Also defined in src/aix/native/java/net/aix_close.c */ + #define INTERRUPT_SIGNAL (SIGRTMAX - 1) +--- openjdk.orig/jdk/src/aix/native/sun/nio/ch/AixPollPort.c ++++ openjdk/jdk/src/aix/native/sun/nio/ch/AixPollPort.c +@@ -34,7 +34,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +--- openjdk.orig/jdk/src/macosx/javavm/export/jvm_md.h ++++ openjdk/jdk/src/macosx/javavm/export/jvm_md.h +@@ -60,7 +60,7 @@ + #include + #include + #include +-#include ++#include + + /* O Flags */ + +--- openjdk.orig/jdk/src/solaris/javavm/export/jvm_md.h ++++ openjdk/jdk/src/solaris/javavm/export/jvm_md.h +@@ -65,7 +65,7 @@ + #include + #include + #include +-#include ++#include + + /* O Flags */ + +--- openjdk.orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c ++++ openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c +@@ -28,7 +28,7 @@ + #include + #include + #if defined(__linux__) && !defined(USE_SELECT) +-#include ++#include + #endif + #include /* Defines TCP_NODELAY, needed for 2.6 */ + #include +--- openjdk.orig/jdk/src/solaris/native/java/net/bsd_close.c ++++ openjdk/jdk/src/solaris/native/java/net/bsd_close.c +@@ -36,7 +36,7 @@ + #include + #include + #include +-#include ++#include + + /* + * Stack allocated by thread when doing blocking operation +--- openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c ++++ openjdk/jdk/src/solaris/native/java/net/linux_close.c +@@ -34,7 +34,7 @@ + #include + #include + #include +-#include ++#include + + /* + * Stack allocated by thread when doing blocking operation +--- openjdk.orig/jdk/src/solaris/native/java/net/net_util_md.h ++++ openjdk/jdk/src/solaris/native/java/net/net_util_md.h +@@ -33,7 +33,7 @@ + #include + + #ifndef USE_SELECT +-#include ++#include + #endif + + int NET_Timeout(int s, long timeout); +--- openjdk.orig/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c ++++ openjdk/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c +@@ -28,7 +28,7 @@ + #include "jvm.h" + #include "jlong.h" + #include "sun_nio_ch_DevPollArrayWrapper.h" +-#include ++#include + #include + #include + +--- openjdk.orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c ++++ openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c +@@ -34,7 +34,7 @@ + + #ifdef __linux__ + #include +- #include ++ #include + /* Also defined in net/linux_close.c */ + #define INTERRUPT_SIGNAL (SIGRTMAX - 2) + #elif __solaris__ +--- openjdk.orig/jdk/src/solaris/native/sun/nio/ch/Net.c ++++ openjdk/jdk/src/solaris/native/sun/nio/ch/Net.c +@@ -23,7 +23,7 @@ + * questions. + */ + +-#include ++#include + #include + #include + #include +--- openjdk.orig/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c ++++ openjdk/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c +@@ -32,7 +32,7 @@ + #include + #include + #include +-#include ++#include + #include + + #include "sun_nio_fs_LinuxWatchService.h" +--- openjdk.orig/jdk/src/solaris/transport/socket/socket_md.c ++++ openjdk/jdk/src/solaris/transport/socket/socket_md.c +@@ -37,7 +37,7 @@ + #include + #else + #include +-#include ++#include + #endif + + #include "socket_md.h" diff --git a/srcpkgs/openjdk8/patches/001_8041658.patch b/srcpkgs/openjdk8/patches/001_8041658.patch new file mode 100644 index 0000000000..6798936cb0 --- /dev/null +++ b/srcpkgs/openjdk8/patches/001_8041658.patch @@ -0,0 +1,22 @@ +# HG changeset patch +# User andrew +# Date 1398287189 -3600 +# Wed Apr 23 22:06:29 2014 +0100 +# Node ID 6cb711fa264d25f3592471a81a5b865c505a9fd7 +# Parent a8b6c290873cc30d96137bd29724638600317f92 +8041658: Use of -fdevirtualize on macroAssembler_x86.o (via -O2) with gcc 4.9.0 creates broken VM +Summary: -fno-devirtualize should be passed when compiling this file. + +diff -Nru openjdk.orig/hotspot/make/linux/makefiles/gcc.make openjdk/hotspot/make/linux/makefiles/gcc.make +--- openjdk.orig/hotspot/make/linux/makefiles/gcc.make 2017-04-20 14:31:49.000000000 +0100 ++++ openjdk/hotspot/make/linux/makefiles/gcc.make 2017-05-10 14:52:39.297377302 +0100 +@@ -259,6 +259,9 @@ + ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1) + OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT) + endif ++ ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 9), 1) ++ OPT_CFLAGS/macroAssembler_x86.o += -fno-devirtualize ++ endif + endif + + # Need extra inlining to collapse all the templated closures into the hot loop diff --git a/srcpkgs/openjdk8/patches/002_8043780-pr3368.patch b/srcpkgs/openjdk8/patches/002_8043780-pr3368.patch new file mode 100644 index 0000000000..133bbe5a77 --- /dev/null +++ b/srcpkgs/openjdk8/patches/002_8043780-pr3368.patch @@ -0,0 +1,113 @@ +# HG changeset patch +# User martin +# Date 1494116427 -3600 +# Sun May 07 01:20:27 2017 +0100 +# Node ID 0bd3170be8c729dfaa88e7aa97449b2f36c650a9 +# Parent baf64c88538f477d7f5a0cf90b670108ac312375 +8043780, PR3368: Use open(O_CLOEXEC) instead of fcntl(FD_CLOEXEC) +Summary: Use open(O_CLOEXEC) where available; fall back to FD_CLOEXEC when necessary +Reviewed-by: rasbold, dholmes + +diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp +--- openjdk/hotspot/src/os/linux/vm/os_linux.cpp ++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp +@@ -5282,38 +5282,16 @@ + errno = ENAMETOOLONG; + return -1; + } +- int fd; + int o_delete = (oflag & O_DELETE); + oflag = oflag & ~O_DELETE; + +- fd = ::open64(path, oflag, mode); +- if (fd == -1) return -1; +- +- //If the open succeeded, the file might still be a directory +- { +- struct stat64 buf64; +- int ret = ::fstat64(fd, &buf64); +- int st_mode = buf64.st_mode; +- +- if (ret != -1) { +- if ((st_mode & S_IFMT) == S_IFDIR) { +- errno = EISDIR; +- ::close(fd); +- return -1; +- } +- } else { +- ::close(fd); +- return -1; +- } +- } +- +- /* +- * All file descriptors that are opened in the JVM and not +- * specifically destined for a subprocess should have the +- * close-on-exec flag set. If we don't set it, then careless 3rd +- * party native code might fork and exec without closing all +- * appropriate file descriptors (e.g. as we do in closeDescriptors in +- * UNIXProcess.c), and this in turn might: ++ ++ /* All file descriptors that are opened in the Java process and not ++ * specifically destined for a subprocess should have the close-on-exec ++ * flag set. If we don't set it, then careless 3rd party native code ++ * might fork and exec without closing all appropriate file descriptors ++ * (e.g. as we do in closeDescriptors in UNIXProcess.c), and this in ++ * turn might: + * + * - cause end-of-file to fail to be detected on some file + * descriptors, resulting in mysterious hangs, or +@@ -5329,12 +5307,49 @@ + * 4843136: (process) pipe file descriptor from Runtime.exec not being closed + * 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9 + */ ++ // Modern Linux kernels (after 2.6.23 2007) support O_CLOEXEC with open(). ++ // O_CLOEXEC is preferable to using FD_CLOEXEC on an open file descriptor ++ // because it saves a system call and removes a small window where the flag ++ // is unset. On ancient Linux kernels the O_CLOEXEC flag will be ignored ++ // and we fall back to using FD_CLOEXEC (see below). ++#ifdef O_CLOEXEC ++ oflag |= O_CLOEXEC; ++#endif ++ ++ int fd = ::open64(path, oflag, mode); ++ if (fd == -1) return -1; ++ ++ //If the open succeeded, the file might still be a directory ++ { ++ struct stat64 buf64; ++ int ret = ::fstat64(fd, &buf64); ++ int st_mode = buf64.st_mode; ++ ++ if (ret != -1) { ++ if ((st_mode & S_IFMT) == S_IFDIR) { ++ errno = EISDIR; ++ ::close(fd); ++ return -1; ++ } ++ } else { ++ ::close(fd); ++ return -1; ++ } ++ } ++ + #ifdef FD_CLOEXEC +- { +- int flags = ::fcntl(fd, F_GETFD); +- if (flags != -1) +- ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC); ++ // Validate that the use of the O_CLOEXEC flag on open above worked. ++ // With recent kernels, we will perform this check exactly once. ++ static sig_atomic_t O_CLOEXEC_is_known_to_work = 0; ++ if (!O_CLOEXEC_is_known_to_work) { ++ int flags = ::fcntl(fd, F_GETFD); ++ if (flags != -1) { ++ if ((flags & FD_CLOEXEC) != 0) ++ O_CLOEXEC_is_known_to_work = 1; ++ else ++ ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC); + } ++ } + #endif + + if (o_delete != 0) { diff --git a/srcpkgs/openjdk8/patches/003_8078504-pr3094.patch b/srcpkgs/openjdk8/patches/003_8078504-pr3094.patch new file mode 100644 index 0000000000..9bcfa0ee58 --- /dev/null +++ b/srcpkgs/openjdk8/patches/003_8078504-pr3094.patch @@ -0,0 +1,28 @@ +# HG changeset patch +# User sgehwolf +# Date 1468778064 -3600 +# Sun Jul 17 18:54:24 2016 +0100 +# Node ID 6000574e256d84b2bab5cb9f0e2e2fa4ffa587f3 +# Parent bb14c5df70880af9e947b5a7b4b258b62d23931a +S8078504, PR3094: Zero fails to build +Reviewed-by: kvn, simonis + +diff --git openjdk.orig/hotspot/src/cpu/zero/vm/vm_version_zero.hpp openjdk/hotspot/src/cpu/zero/vm/vm_version_zero.hpp +--- openjdk.orig/hotspot/src/cpu/zero/vm/vm_version_zero.hpp ++++ openjdk/hotspot/src/cpu/zero/vm/vm_version_zero.hpp +@@ -1,6 +1,6 @@ + /* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. +- * Copyright 2007 Red Hat, Inc. ++ * Copyright 2015 Red Hat, Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -34,6 +34,7 @@ + static const char* cpu_features() { + return ""; + } ++ static void initialize(); + }; + + #endif // CPU_ZERO_VM_VM_VERSION_ZERO_HPP diff --git a/srcpkgs/openjdk8/patches/004_8087218-pr2740.patch b/srcpkgs/openjdk8/patches/004_8087218-pr2740.patch new file mode 100644 index 0000000000..7a9d155412 --- /dev/null +++ b/srcpkgs/openjdk8/patches/004_8087218-pr2740.patch @@ -0,0 +1,23 @@ +# HG changeset patch +# User vlivanov +# Date 1447818025 0 +# Wed Nov 18 03:40:25 2015 +0000 +# Node ID cbdd812ea25e27919983c363fd416b492846e426 +# Parent 3b05ef40e997e8234f396a55cf238e9b01472f12 +8087218, PR2740: Constant fold loads from final instance fields in VM anonymous classes +Reviewed-by: jrose, rbackman + +diff -Nru openjdk.orig/hotspot/src/share/vm/ci/ciField.cpp openjdk/hotspot/src/share/vm/ci/ciField.cpp +--- openjdk.orig/hotspot/src/share/vm/ci/ciField.cpp 2017-04-20 14:31:49.000000000 +0100 ++++ openjdk/hotspot/src/share/vm/ci/ciField.cpp 2017-05-10 14:55:11.722924914 +0100 +@@ -187,6 +187,10 @@ + // Even if general trusting is disabled, trust system-built closures in these packages. + if (holder->is_in_package("java/lang/invoke") || holder->is_in_package("sun/invoke")) + return true; ++ // Trust VM anonymous classes. They are private API (sun.misc.Unsafe) and can't be serialized, ++ // so there is no hacking of finals going on with them. ++ if (holder->is_anonymous()) ++ return true; + // Trust Atomic*FieldUpdaters: they are very important for performance, and make up one + // more reason not to use Unsafe, if their final fields are trusted. See more in JDK-8140483. + if (holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicIntegerFieldUpdater_Impl() || diff --git a/srcpkgs/openjdk8/patches/005_8158260-pr2991-rh1341258-aarch64.patch b/srcpkgs/openjdk8/patches/005_8158260-pr2991-rh1341258-aarch64.patch new file mode 100644 index 0000000000..12c843af10 --- /dev/null +++ b/srcpkgs/openjdk8/patches/005_8158260-pr2991-rh1341258-aarch64.patch @@ -0,0 +1,34 @@ +# HG changeset patch +# User simonis +# Date 1466155884 -7200 +# Fri Jun 17 11:31:24 2016 +0200 +# Node ID 4b40867e627dd9043bc67a4795caa9834ef69478 +# Parent 3fc29347b27fdd2075e6ec6d80bb26ab2bf667c1 +8158260, PR2991, RH1341258: PPC64: unaligned Unsafe.getInt can lead to the generation of illegal instructions +Summary: Adjust instruction generation. Includes portions of 8026049 for test case. +Reviewed-by: goetz +Contributed-by: gromero@linux.vnet.ibm.com, horii@jp.ibm.com + +diff -Nru openjdk.orig/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp openjdk/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp +--- openjdk.orig/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp 2018-03-21 09:00:58.000000000 +0000 ++++ openjdk/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp 2018-03-21 09:54:01.579562708 +0000 +@@ -1,6 +1,6 @@ + /* +- * Copyright (c) 2013, Red Hat Inc. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. ++ * Copyright (c) 2015, Red Hat Inc. All rights reserved. + * All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * +@@ -296,6 +296,11 @@ + UsePopCountInstruction = true; + } + ++ // This machine allows unaligned memory accesses ++ if (FLAG_IS_DEFAULT(UseUnalignedAccesses)) { ++ FLAG_SET_DEFAULT(UseUnalignedAccesses, true); ++ } ++ + if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) { + UseMontgomeryMultiplyIntrinsic = true; + } diff --git a/srcpkgs/openjdk8/patches/005_8158260-pr2991-rh1341258.patch b/srcpkgs/openjdk8/patches/005_8158260-pr2991-rh1341258.patch new file mode 100644 index 0000000000..4d0459b674 --- /dev/null +++ b/srcpkgs/openjdk8/patches/005_8158260-pr2991-rh1341258.patch @@ -0,0 +1,462 @@ +# HG changeset patch +# User simonis +# Date 1466155884 -7200 +# Fri Jun 17 11:31:24 2016 +0200 +# Node ID 4b40867e627dd9043bc67a4795caa9834ef69478 +# Parent 3fc29347b27fdd2075e6ec6d80bb26ab2bf667c1 +8158260, PR2991, RH1341258: PPC64: unaligned Unsafe.getInt can lead to the generation of illegal instructions +Summary: Adjust instruction generation. Includes portions of 8026049 for test case. +Reviewed-by: goetz +Contributed-by: gromero@linux.vnet.ibm.com, horii@jp.ibm.com + +diff -Nru openjdk.orig/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp openjdk/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp +--- openjdk.orig/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp 2019-01-16 07:13:59.000000000 +0000 ++++ openjdk/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp 2019-01-25 13:46:51.799453897 +0000 +@@ -201,6 +201,11 @@ + FLAG_SET_DEFAULT(UseSHA512Intrinsics, false); + } + ++ // This machine allows unaligned memory accesses ++ if (FLAG_IS_DEFAULT(UseUnalignedAccesses)) { ++ FLAG_SET_DEFAULT(UseUnalignedAccesses, true); ++ } ++ + if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) { + UseMontgomeryMultiplyIntrinsic = true; + } +diff -Nru openjdk.orig/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp openjdk/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp +--- openjdk.orig/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp 2019-01-16 07:13:59.000000000 +0000 ++++ openjdk/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp 2019-01-25 13:46:51.799453897 +0000 +@@ -375,6 +375,13 @@ + (cache_line_size > ContendedPaddingWidth)) + ContendedPaddingWidth = cache_line_size; + ++ // This machine does not allow unaligned memory accesses ++ if (UseUnalignedAccesses) { ++ if (!FLAG_IS_DEFAULT(UseUnalignedAccesses)) ++ warning("Unaligned memory access is not available on this CPU"); ++ FLAG_SET_DEFAULT(UseUnalignedAccesses, false); ++ } ++ + #ifndef PRODUCT + if (PrintMiscellaneous && Verbose) { + tty->print_cr("L1 data cache line size: %u", L1_data_cache_line_size()); +diff -Nru openjdk.orig/hotspot/src/cpu/x86/vm/vm_version_x86.cpp openjdk/hotspot/src/cpu/x86/vm/vm_version_x86.cpp +--- openjdk.orig/hotspot/src/cpu/x86/vm/vm_version_x86.cpp 2019-01-16 07:13:59.000000000 +0000 ++++ openjdk/hotspot/src/cpu/x86/vm/vm_version_x86.cpp 2019-01-25 13:46:51.799453897 +0000 +@@ -1033,6 +1033,11 @@ + (cache_line_size > ContendedPaddingWidth)) + ContendedPaddingWidth = cache_line_size; + ++ // This machine allows unaligned memory accesses ++ if (FLAG_IS_DEFAULT(UseUnalignedAccesses)) { ++ FLAG_SET_DEFAULT(UseUnalignedAccesses, true); ++ } ++ + #ifndef PRODUCT + if (PrintMiscellaneous && Verbose) { + tty->print_cr("Logical CPUs per core: %u", +diff -Nru openjdk.orig/hotspot/src/cpu/zero/vm/vm_version_zero.cpp openjdk/hotspot/src/cpu/zero/vm/vm_version_zero.cpp +--- openjdk.orig/hotspot/src/cpu/zero/vm/vm_version_zero.cpp 2019-01-16 07:13:59.000000000 +0000 ++++ openjdk/hotspot/src/cpu/zero/vm/vm_version_zero.cpp 2019-01-25 13:46:51.799453897 +0000 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright 2009 Red Hat, Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * +@@ -36,4 +36,11 @@ + # include "os_bsd.inline.hpp" + #endif + +-// This file is intentionally empty ++ ++void VM_Version::initialize() { ++ // This machine does not allow unaligned memory accesses ++ if (! FLAG_IS_DEFAULT(UseUnalignedAccesses)) { ++ warning("Unaligned memory access is not available on this CPU"); ++ FLAG_SET_DEFAULT(UseUnalignedAccesses, false); ++ } ++} +diff -Nru openjdk.orig/hotspot/src/share/vm/prims/unsafe.cpp openjdk/hotspot/src/share/vm/prims/unsafe.cpp +--- openjdk.orig/hotspot/src/share/vm/prims/unsafe.cpp 2019-01-16 07:13:59.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/prims/unsafe.cpp 2019-01-25 13:50:10.160334728 +0000 +@@ -385,6 +385,24 @@ + + #endif // not SUPPORTS_NATIVE_CX8 + ++UNSAFE_ENTRY(jboolean, Unsafe_isBigEndian0(JNIEnv *env, jobject unsafe)) ++ UnsafeWrapper("Unsafe_IsBigEndian0"); ++ { ++#ifdef VM_LITTLE_ENDIAN ++ return false; ++#else ++ return true; ++#endif ++ } ++UNSAFE_END ++ ++UNSAFE_ENTRY(jint, Unsafe_unalignedAccess0(JNIEnv *env, jobject unsafe)) ++ UnsafeWrapper("Unsafe_UnalignedAccess0"); ++ { ++ return UseUnalignedAccesses; ++ } ++UNSAFE_END ++ + #define DEFINE_GETSETOOP(jboolean, Boolean) \ + \ + UNSAFE_ENTRY(jboolean, Unsafe_Get##Boolean##140(JNIEnv *env, jobject unsafe, jobject obj, jint offset)) \ +@@ -1716,6 +1734,11 @@ + {CC "fullFence", CC "()V", FN_PTR(Unsafe_FullFence)}, + }; + ++JNINativeMethod cpu_methods[] = { ++ {CC"isBigEndian0", CC"()Z", FN_PTR(Unsafe_isBigEndian0)}, ++ {CC"unalignedAccess0", CC"()Z", FN_PTR(Unsafe_unalignedAccess0)} ++}; ++ + #undef CC + #undef FN_PTR + +@@ -1815,5 +1838,8 @@ + + // Fence methods + register_natives("1.8 fence methods", env, unsafecls, fence_methods, sizeof(fence_methods)/sizeof(JNINativeMethod)); ++ ++ // CPU methods ++ register_natives("1.9 CPU methods", env, unsafecls, cpu_methods, sizeof(cpu_methods)/sizeof(JNINativeMethod)); + } + JVM_END +diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/globals.hpp openjdk/hotspot/src/share/vm/runtime/globals.hpp +--- openjdk.orig/hotspot/src/share/vm/runtime/globals.hpp 2019-01-16 07:13:59.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/runtime/globals.hpp 2019-01-25 13:46:51.803453833 +0000 +@@ -4003,6 +4003,9 @@ + product(bool, UseLockedTracing, false, \ + "Use locked-tracing when doing event-based tracing") \ + \ ++ diagnostic(bool, UseUnalignedAccesses, false, \ ++ "Use unaligned memory accesses in sun.misc.Unsafe") \ ++ \ + product_pd(bool, PreserveFramePointer, \ + "Use the FP register for holding the frame pointer " \ + "and not as a general purpose register.") +diff -Nru openjdk.orig/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java openjdk/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java +--- openjdk.orig/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java 1970-01-01 01:00:00.000000000 +0100 ++++ openjdk/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java 2019-01-25 13:46:51.803453833 +0000 +@@ -0,0 +1,315 @@ ++/* ++ * Copyright (c) 2016 SAP SE. 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. ++ */ ++ ++/* ++ * @test ++ * @bug 8158260 ++ * @summary Test unaligned Unsafe accesses ++ * @modules java.base/jdk.internal.misc ++ * @run main/othervm -Diters=20000 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation JdkInternalMiscUnsafeUnalignedAccess ++ * @author volker.simonis@gmail.com ++ */ ++ ++import java.lang.reflect.Field; ++import java.nio.ByteOrder; ++import sun.misc.Unsafe; ++ ++public class JdkInternalMiscUnsafeUnalignedAccess { ++ static final int ITERS = Integer.getInteger("iters", 20_000); ++ private static final boolean BIG_ENDIAN = ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN); ++ private static final Unsafe UNSAFE; ++ private static final int SIZE = 1024; ++ private static long memory; ++ ++ static { ++ try { ++ Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe"); ++ unsafeField.setAccessible(true); ++ UNSAFE = (Unsafe) unsafeField.get(null); ++ } ++ catch (Exception e) { ++ throw new RuntimeException("Unable to get Unsafe instance.", e); ++ } ++ } ++ ++ static int getInt_0() { ++ return UNSAFE.getInt(memory + 0); ++ } ++ static int getInt_1() { ++ return UNSAFE.getInt(memory + 1); ++ } ++ static int getInt_4() { ++ return UNSAFE.getInt(memory + 4); ++ } ++ static int getInt_17() { ++ return UNSAFE.getInt(memory + 17); ++ } ++ ++ static long getIntAsLong_0() { ++ return UNSAFE.getInt(memory + 0); ++ } ++ static long getIntAsLong_1() { ++ return UNSAFE.getInt(memory + 1); ++ } ++ static long getIntAsLong_4() { ++ return UNSAFE.getInt(memory + 4); ++ } ++ static long getIntAsLong_17() { ++ return UNSAFE.getInt(memory + 17); ++ } ++ ++ static long getLong_0() { ++ return UNSAFE.getLong(memory + 0); ++ } ++ static long getLong_1() { ++ return UNSAFE.getLong(memory + 1); ++ } ++ static long getLong_4() { ++ return UNSAFE.getLong(memory + 4); ++ } ++ static long getLong_8() { ++ return UNSAFE.getLong(memory + 8); ++ } ++ static long getLong_17() { ++ return UNSAFE.getLong(memory + 17); ++ } ++ ++ static void putInt_0(int i) { ++ UNSAFE.putInt(memory + 0, i); ++ } ++ static void putInt_1(int i) { ++ UNSAFE.putInt(memory + 1, i); ++ } ++ static void putInt_4(int i) { ++ UNSAFE.putInt(memory + 4, i); ++ } ++ static void putInt_17(int i) { ++ UNSAFE.putInt(memory + 17, i); ++ } ++ ++ static void putLong_0(long l) { ++ UNSAFE.putLong(memory + 0, l); ++ } ++ static void putLong_1(long l) { ++ UNSAFE.putLong(memory + 1, l); ++ } ++ static void putLong_4(long l) { ++ UNSAFE.putLong(memory + 4, l); ++ } ++ static void putLong_8(long l) { ++ UNSAFE.putLong(memory + 8, l); ++ } ++ static void putLong_17(long l) { ++ UNSAFE.putLong(memory + 17, l); ++ } ++ ++ public static void main(String[] args) throws Exception { ++ ++ if (!UNSAFE.unalignedAccess()) { ++ System.out.println("Platform is not supporting unaligned access - nothing to test."); ++ return; ++ } ++ ++ memory = UNSAFE.allocateMemory(SIZE); ++ ++ UNSAFE.putInt(memory + 0, 0x00112233); ++ UNSAFE.putInt(memory + 4, 0x44556677); ++ UNSAFE.putInt(memory + 8, 0x8899aabb); ++ UNSAFE.putInt(memory + 12, 0xccddeeff); ++ UNSAFE.putInt(memory + 16, 0x01234567); ++ UNSAFE.putInt(memory + 20, 0x89abcdef); ++ UNSAFE.putInt(memory + 24, 0x01234567); ++ ++ // Unsafe.getInt() ++ int res; ++ for (int i = 0; i < ITERS; i++) { ++ res = getInt_0(); ++ if (res != 0x00112233) { ++ throw new Exception(res + " != 0x00112233"); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ res = getInt_1(); ++ if (res != (BIG_ENDIAN ? 0x11223344 : 0x77001122)) { ++ throw new Exception(res + " != " + (BIG_ENDIAN ? 0x11223344 : 0x77001122)); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ res = getInt_4(); ++ if (res != 0x44556677) { ++ throw new Exception(res + " != 0x44556677"); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ res = getInt_17(); ++ if (res != (BIG_ENDIAN ? 0x23456789 : 0xef012345)) { ++ throw new Exception(res + " != " + (BIG_ENDIAN ? 0x23456789 : 0xef012345)); ++ } ++ } ++ ++ // (long)Unsafe.getInt() ++ long lres; ++ for (int i = 0; i < ITERS; i++) { ++ lres = getIntAsLong_0(); ++ if (lres != (long)0x00112233) { ++ throw new Exception(lres + " != 0x00112233"); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ lres = getIntAsLong_1(); ++ if (lres != (BIG_ENDIAN ? (long)0x11223344 : (long)0x77001122)) { ++ throw new Exception(lres + " != " + (BIG_ENDIAN ? (long)0x11223344 : (long)0x77001122)); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ lres = getIntAsLong_4(); ++ if (lres != (long)0x44556677) { ++ throw new Exception(lres + " != 0x44556677"); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ lres = getIntAsLong_17(); ++ if (lres != (BIG_ENDIAN ? (long)0x23456789 : (long)0xef012345)) { ++ throw new Exception(lres + " != " + (BIG_ENDIAN ? (long)0x23456789 : (long)0xef012345)); ++ } ++ } ++ ++ // Unsafe.getLong() ++ for (int i = 0; i < ITERS; i++) { ++ lres = getLong_0(); ++ if (lres != (BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L)) { ++ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L)); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ lres = getLong_1(); ++ if (lres != (BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L)) { ++ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L)); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ lres = getLong_4(); ++ if (lres != (BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L)) { ++ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L)); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ lres = getLong_8(); ++ if (lres != (BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL)) { ++ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL)); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ lres = getLong_17(); ++ if (lres != (BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L)) { ++ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L)); ++ } ++ } ++ ++ // Unsafe.putInt() ++ for (int i = 0; i < ITERS; i++) { ++ putInt_0(0x00112233); ++ res = getInt_0(); ++ if (res != 0x00112233) { ++ throw new Exception(res + " != 0x00112233"); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ putInt_1(BIG_ENDIAN ? 0x11223344 : 0x77001122); ++ res = getInt_1(); ++ if (res != (BIG_ENDIAN ? 0x11223344 : 0x77001122)) { ++ throw new Exception(res + " != " + (BIG_ENDIAN ? 0x11223344 : 0x77001122)); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ putInt_4(0x44556677); ++ res = getInt_4(); ++ if (res != 0x44556677) { ++ throw new Exception(res + " != 0x44556677"); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ putInt_17(BIG_ENDIAN ? 0x23456789 : 0xef012345); ++ res = getInt_17(); ++ if (res != (BIG_ENDIAN ? 0x23456789 : 0xef012345)) { ++ throw new Exception(res + " != " + (BIG_ENDIAN ? 0x23456789 : 0xef012345)); ++ } ++ } ++ ++ ++ // Unsafe.putLong() ++ for (int i = 0; i < ITERS; i++) { ++ putLong_0(BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L); ++ lres = getLong_0(); ++ if (lres != (BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L)) { ++ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L)); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ putLong_1(BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L); ++ lres = getLong_1(); ++ if (lres != (BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L)) { ++ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L)); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ putLong_4(BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L); ++ lres = getLong_4(); ++ if (lres != (BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L)) { ++ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L)); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ putLong_8(BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL); ++ lres = getLong_8(); ++ if (lres != (BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL)) { ++ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL)); ++ } ++ } ++ ++ for (int i = 0; i < ITERS; i++) { ++ putLong_17(BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L); ++ lres = getLong_17(); ++ if (lres != (BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L)) { ++ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L)); ++ } ++ } ++ } ++ ++} diff --git a/srcpkgs/openjdk8/patches/006_8197981-pr3548.patch b/srcpkgs/openjdk8/patches/006_8197981-pr3548.patch new file mode 100644 index 0000000000..5f6d9ce9e4 --- /dev/null +++ b/srcpkgs/openjdk8/patches/006_8197981-pr3548.patch @@ -0,0 +1,32 @@ +# HG changeset patch +# User andrew +# Date 1518667645 0 +# Thu Feb 15 04:07:25 2018 +0000 +# Node ID 1d35411eb7bdf16191e220ffe3b1dc4d5d0c6041 +# Parent 999983606f5c61b093c6f6316a7b26c4cd4ca79e +8197981, PR3548: Missing return statement in __sync_val_compare_and_swap_8 +Summary: Fix issue discovered by -Wreturn-type on systems without LP64. +Reviewed-by: aph + +diff --git openjdk.orig/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp openjdk/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp +--- openjdk.orig/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp ++++ openjdk/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp +@@ -457,6 +457,7 @@ + long long unsigned int oldval, + long long unsigned int newval) { + ShouldNotCallThis(); ++ return 0; + } + }; + #endif // !_LP64 +diff --git openjdk.orig/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp openjdk/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp +--- openjdk.orig/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp ++++ openjdk/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp +@@ -498,6 +498,7 @@ + long long unsigned int oldval, + long long unsigned int newval) { + ShouldNotCallThis(); ++ return 0; + } + }; + #endif // !_LP64 diff --git a/srcpkgs/openjdk8/patches/007_8207057-pr3613.patch b/srcpkgs/openjdk8/patches/007_8207057-pr3613.patch new file mode 100644 index 0000000000..7627c18352 --- /dev/null +++ b/srcpkgs/openjdk8/patches/007_8207057-pr3613.patch @@ -0,0 +1,19 @@ +# HG changeset patch +# User andrew +# Date 1532526839 -3600 +# Wed Jul 25 14:53:59 2018 +0100 +# Node ID 66087a86ded39c2595dc61223fa03671ff051e33 +# Parent 2f2d2af6fa5c44e67e0a9987f56392315a1e4b64 +8207057, PR3613: No debug info for assembler files + +diff -Nru openjdk.orig/hotspot/make/linux/makefiles/gcc.make openjdk/hotspot/make/linux/makefiles/gcc.make +--- openjdk.orig/hotspot/make/linux/makefiles/gcc.make 2018-12-21 00:55:33.407545727 +0000 ++++ openjdk/hotspot/make/linux/makefiles/gcc.make 2018-12-21 01:14:40.357592769 +0000 +@@ -339,6 +339,7 @@ + # DEBUG_BINARIES uses full -g debug information for all configs + ifeq ($(DEBUG_BINARIES), true) + CFLAGS += -g ++ ASFLAGS += -g + else + DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) + ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) diff --git a/srcpkgs/openjdk8/patches/008_no_devirt.patch b/srcpkgs/openjdk8/patches/008_no_devirt.patch new file mode 100644 index 0000000000..967e86ade0 --- /dev/null +++ b/srcpkgs/openjdk8/patches/008_no_devirt.patch @@ -0,0 +1,20 @@ +# HG changeset patch +# User andrew +# Date 1398352866 -3600 +# Thu Apr 24 16:21:06 2014 +0100 +# Node ID 2b4f89de39c2c4fd09f927adacb3781454dbee44 +# Parent 6cb711fa264d25f3592471a81a5b865c505a9fd7 +Extend 8041658 to all files in the HotSpot build. + +diff -r 6cb711fa264d -r 2b4f89de39c2 make/linux/makefiles/gcc.make +--- openjdk/hotspot/make/linux/makefiles/gcc.make Wed Apr 23 22:06:29 2014 +0100 ++++ openjdk/hotspot/make/linux/makefiles/gcc.make Thu Apr 24 16:21:06 2014 +0100 +@@ -267,7 +267,7 @@ + OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT) + endif + ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 9), 1) +- OPT_CFLAGS/macroAssembler_x86.o += -fno-devirtualize ++ OPT_CFLAGS += -fno-devirtualize + endif + endif + diff --git a/srcpkgs/openjdk8/patches/009_override-redirect-metacity.patch b/srcpkgs/openjdk8/patches/009_override-redirect-metacity.patch new file mode 100644 index 0000000000..2dd26cb4c9 --- /dev/null +++ b/srcpkgs/openjdk8/patches/009_override-redirect-metacity.patch @@ -0,0 +1,11 @@ +diff -Nru openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java openjdk/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java +--- openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java 2010-01-04 16:57:29.000000000 +0000 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java 2010-01-04 19:47:57.000000000 +0000 +@@ -1142,6 +1142,7 @@ + + boolean isOverrideRedirect() { + return XWM.getWMID() == XWM.OPENLOOK_WM || ++ XWM.getWMID() == XWM.METACITY_WM || + Window.Type.POPUP.equals(getWindowType()); + } + diff --git a/srcpkgs/openjdk8/patches/010_pr1869.patch b/srcpkgs/openjdk8/patches/010_pr1869.patch new file mode 100644 index 0000000000..26f8c8e14b --- /dev/null +++ b/srcpkgs/openjdk8/patches/010_pr1869.patch @@ -0,0 +1,33 @@ +# HG changeset patch +# User andrew +# Date 1405461315 -3600 +# Tue Jul 15 22:55:15 2014 +0100 +# Node ID 967ae4d849eb20b4b63c399bc3f376dfc0f9d2cc +# Parent 84854c983fd81cf1a1598f8c069a2db010abc05c +PR1869: Avoid x86 workaround when running Zero rather than a JIT +Contributed-by: Matthias Klose + +diff -Nru openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp openjdk/hotspot/src/os/linux/vm/os_linux.cpp +--- openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp 2019-04-11 03:36:49.000000000 +0100 ++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp 2019-04-19 17:15:35.194017652 +0100 +@@ -5139,7 +5139,7 @@ + + Linux::capture_initial_stack(JavaThread::stack_size_at_create()); + +-#if defined(IA32) ++#if defined(IA32) && !defined(ZERO) + workaround_expand_exec_shield_cs_limit(); + #endif + +diff -Nru openjdk.orig/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +--- openjdk.orig/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp 2019-04-11 03:36:49.000000000 +0100 ++++ openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp 2019-04-19 17:15:58.329656663 +0100 +@@ -890,7 +890,7 @@ + * updates (JDK-8023956). + */ + void os::workaround_expand_exec_shield_cs_limit() { +-#if defined(IA32) ++#if defined(IA32) && !defined(ZERO) + size_t page_size = os::vm_page_size(); + + /* diff --git a/srcpkgs/openjdk8/patches/011_pr3607.patch b/srcpkgs/openjdk8/patches/011_pr3607.patch new file mode 100644 index 0000000000..c891ddbf89 --- /dev/null +++ b/srcpkgs/openjdk8/patches/011_pr3607.patch @@ -0,0 +1,52 @@ +# HG changeset patch +# User andrew +# Date 1533744073 -3600 +# Wed Aug 08 17:01:13 2018 +0100 +# Node ID 0458118b5f190097099f2ea7b025cb2d5aeb0429 +# Parent 66087a86ded39c2595dc61223fa03671ff051e33 +PR3607: CVE-2018-3639 hw: cpu: speculative store bypass mitigation + +diff -Nru openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp openjdk/hotspot/src/os/linux/vm/os_linux.cpp +--- openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp 2019-01-31 04:18:03.357394677 +0000 ++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp 2019-01-31 04:19:59.099570272 +0000 +@@ -103,6 +103,8 @@ + # include + # include + ++#include ++ + PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + + #ifndef _GNU_SOURCE +@@ -5001,6 +5003,31 @@ + } + } + ++/* Per task speculation control */ ++#ifndef PR_GET_SPECULATION_CTRL ++#define PR_GET_SPECULATION_CTRL 52 ++#endif ++#ifndef PR_SET_SPECULATION_CTRL ++#define PR_SET_SPECULATION_CTRL 53 ++#endif ++/* Speculation control variants */ ++# undef PR_SPEC_STORE_BYPASS ++# define PR_SPEC_STORE_BYPASS 0 ++/* Return and control values for PR_SET/GET_SPECULATION_CTRL */ ++# undef PR_SPEC_NOT_AFFECTED ++# undef PR_SPEC_PRCTL ++# undef PR_SPEC_ENABLE ++# undef PR_SPEC_DISABLE ++# define PR_SPEC_NOT_AFFECTED 0 ++# define PR_SPEC_PRCTL (1UL << 0) ++# define PR_SPEC_ENABLE (1UL << 1) ++# define PR_SPEC_DISABLE (1UL << 2) ++ ++static void set_speculation() __attribute__((constructor)); ++static void set_speculation() { ++ prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_DISABLE, 0, 0); ++} ++ + // this is called _before_ most of the global arguments have been parsed + void os::init(void) { + char dummy; /* used to get a guess on initial stack address */ diff --git a/srcpkgs/openjdk8/patches/012_pr3728.patch b/srcpkgs/openjdk8/patches/012_pr3728.patch new file mode 100644 index 0000000000..68a5d9e8b3 --- /dev/null +++ b/srcpkgs/openjdk8/patches/012_pr3728.patch @@ -0,0 +1,62 @@ +# HG changeset patch +# User andrew +# Date 1555557699 -3600 +# Thu Apr 18 04:21:39 2019 +0100 +# Node ID 3f9a60eb8ef03dd72438eb923fc9547b4148605d +# Parent 2366ee02c78968ed4d62f77fc88632873cffd183 +PR3728: CVE-2018-3639 fix revision to prefer PR_SPEC_DISABLE_NOEXEC to PR_SPEC_DISABLE + +diff --git openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp openjdk/hotspot/src/os/linux/vm/os_linux.cpp +--- openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp ++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp +@@ -5005,26 +5005,43 @@ + + /* Per task speculation control */ + #ifndef PR_GET_SPECULATION_CTRL +-#define PR_GET_SPECULATION_CTRL 52 ++# define PR_GET_SPECULATION_CTRL 52 + #endif + #ifndef PR_SET_SPECULATION_CTRL +-#define PR_SET_SPECULATION_CTRL 53 ++# define PR_SET_SPECULATION_CTRL 53 + #endif + /* Speculation control variants */ +-# undef PR_SPEC_STORE_BYPASS ++#ifndef PR_SPEC_STORE_BYPASS + # define PR_SPEC_STORE_BYPASS 0 ++#endif + /* Return and control values for PR_SET/GET_SPECULATION_CTRL */ +-# undef PR_SPEC_NOT_AFFECTED +-# undef PR_SPEC_PRCTL +-# undef PR_SPEC_ENABLE +-# undef PR_SPEC_DISABLE ++ ++#ifndef PR_SPEC_NOT_AFFECTED + # define PR_SPEC_NOT_AFFECTED 0 ++#endif ++#ifndef PR_SPEC_PRCTL + # define PR_SPEC_PRCTL (1UL << 0) ++#endif ++#ifndef PR_SPEC_ENABLE + # define PR_SPEC_ENABLE (1UL << 1) ++#endif ++#ifndef PR_SPEC_DISABLE + # define PR_SPEC_DISABLE (1UL << 2) ++#endif ++#ifndef PR_SPEC_FORCE_DISABLE ++# define PR_SPEC_FORCE_DISABLE (1UL << 3) ++#endif ++#ifndef PR_SPEC_DISABLE_NOEXEC ++# define PR_SPEC_DISABLE_NOEXEC (1UL << 4) ++#endif + + static void set_speculation() __attribute__((constructor)); + static void set_speculation() { ++ if ( prctl(PR_SET_SPECULATION_CTRL, ++ PR_SPEC_STORE_BYPASS, ++ PR_SPEC_DISABLE_NOEXEC, 0, 0) == 0 ) { ++ return; ++ } + prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_DISABLE, 0, 0); + } + diff --git a/srcpkgs/openjdk8/patches/013_werror.patch b/srcpkgs/openjdk8/patches/013_werror.patch new file mode 100644 index 0000000000..ba7fa9d916 --- /dev/null +++ b/srcpkgs/openjdk8/patches/013_werror.patch @@ -0,0 +1,51 @@ +# HG changeset patch +# User andrew +# Date 1408489026 -3600 +# Tue Aug 19 23:57:06 2014 +0100 +# Node ID 22d29c372fc4271930e4169a66818f67e27cf6e8 +# Parent c75d6ce2e98b901b31ac84dbbb59667e03beb9d5 +Merge jdk8u20-b23 + +diff -Nru openjdk.orig/hotspot/make/linux/makefiles/gcc.make openjdk/hotspot/make/linux/makefiles/gcc.make +--- openjdk.orig/hotspot/make/linux/makefiles/gcc.make 2019-01-25 15:02:27.660107711 +0000 ++++ openjdk/hotspot/make/linux/makefiles/gcc.make 2019-01-25 15:05:30.485236897 +0000 +@@ -198,7 +198,9 @@ + endif + + # Compiler warnings are treated as errors ++ifneq ($(COMPILER_WARNINGS_FATAL),false) + WARNINGS_ARE_ERRORS = -Werror ++endif + + ifeq ($(USE_CLANG), true) + # However we need to clean the code up before we can unrestrictedly enable this option with Clang +diff -Nru openjdk.orig/hotspot/make/solaris/makefiles/adlc.make openjdk/hotspot/make/solaris/makefiles/adlc.make +--- openjdk.orig/hotspot/make/solaris/makefiles/adlc.make 2019-01-16 07:13:59.000000000 +0000 ++++ openjdk/hotspot/make/solaris/makefiles/adlc.make 2019-01-25 15:06:44.376075821 +0000 +@@ -73,8 +73,10 @@ + + # CFLAGS_WARN holds compiler options to suppress/enable warnings. + # Compiler warnings are treated as errors +-ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1) +- CFLAGS_WARN = +w -errwarn ++ifneq ($(COMPILER_WARNINGS_FATAL),false) ++ ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1) ++ CFLAGS_WARN = +w -errwarn ++ endif + endif + # When using compiler version 5.13 (Solaris Studio 12.4), calls to explicitly + # instantiated template functions trigger this warning when +w is active. +diff -Nru openjdk.orig/hotspot/make/solaris/makefiles/gcc.make openjdk/hotspot/make/solaris/makefiles/gcc.make +--- openjdk.orig/hotspot/make/solaris/makefiles/gcc.make 2019-01-16 07:13:59.000000000 +0000 ++++ openjdk/hotspot/make/solaris/makefiles/gcc.make 2019-01-25 15:05:30.485236897 +0000 +@@ -116,7 +116,9 @@ + + + # Compiler warnings are treated as errors +-WARNINGS_ARE_ERRORS = -Werror ++ifneq ($(COMPILER_WARNINGS_FATAL),false) ++WARNINGS_ARE_ERRORS = -Werror ++endif + # 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) diff --git a/srcpkgs/openjdk8/patches/100_jdk-execinfo.patch b/srcpkgs/openjdk8/patches/100_jdk-execinfo.patch new file mode 100644 index 0000000000..e4ae562c57 --- /dev/null +++ b/srcpkgs/openjdk8/patches/100_jdk-execinfo.patch @@ -0,0 +1,20 @@ +--- openjdk.orig/jdk/src/solaris/native/sun/xawt/XToolkit.c ++++ openjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c +@@ -27,7 +27,7 @@ + #include + #include + #include +-#ifdef __linux__ ++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__) + #include + #endif + +@@ -689,7 +689,7 @@ + return ret; + } + +-#ifdef __linux__ ++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__) + void print_stack(void) + { + void *array[10]; diff --git a/srcpkgs/openjdk8/patches/101_jdk-fix-ipv6-init.patch b/srcpkgs/openjdk8/patches/101_jdk-fix-ipv6-init.patch new file mode 100644 index 0000000000..11f3bf6dd6 --- /dev/null +++ b/srcpkgs/openjdk8/patches/101_jdk-fix-ipv6-init.patch @@ -0,0 +1,42 @@ +--- openjdk/jdk/src/solaris/native/java/net/net_util_md.c.orig ++++ openjdk/jdk/src/solaris/native/java/net/net_util_md.c +@@ -561,7 +561,7 @@ + + static struct localinterface *localifs = 0; + static int localifsSize = 0; /* size of array */ +-static int nifs = 0; /* number of entries used in array */ ++static int nifs = -1; /* number of entries used in array */ + + /* not thread safe: make sure called once from one thread */ + +@@ -573,6 +573,10 @@ + int index, x1, x2, x3; + unsigned int u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,ua,ub,uc,ud,ue,uf; + ++ if (nifs >= 0) ++ return ; ++ nifs = 0; ++ + if ((f = fopen("/proc/net/if_inet6", "r")) == NULL) { + return ; + } +@@ -601,7 +605,7 @@ + localifs = (struct localinterface *) realloc ( + localifs, sizeof (struct localinterface)* (localifsSize+5)); + if (localifs == 0) { +- nifs = 0; ++ nifs = -1; + fclose (f); + return; + } +@@ -624,9 +628,7 @@ + static int getLocalScopeID (char *addr) { + struct localinterface *lif; + int i; +- if (localifs == 0) { +- initLocalIfs(); +- } ++ initLocalIfs(); + for (i=0, lif=localifs; ilocaladdr, 16) == 0) { + return lif->index; diff --git a/srcpkgs/openjdk8/patches/102_jdk-getmntent-buffer.patch b/srcpkgs/openjdk8/patches/102_jdk-getmntent-buffer.patch new file mode 100644 index 0000000000..075a9d4238 --- /dev/null +++ b/srcpkgs/openjdk8/patches/102_jdk-getmntent-buffer.patch @@ -0,0 +1,88 @@ +Give a much bigger buffer to getmntent_r. + +https://bugs.alpinelinux.org/issues/7093 + +diff --git a/openjdk/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c b/openjdk/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c +index c8500db..d0b85d6 100644 +--- openjdk/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c ++++ openjdk/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + #include "sun_nio_fs_LinuxNativeDispatcher.h" + +@@ -173,8 +174,8 @@ Java_sun_nio_fs_LinuxNativeDispatcher_getmntent(JNIEnv* env, jclass this, + jlong value, jobject entry) + { + struct mntent ent; +- char buf[1024]; +- int buflen = sizeof(buf); ++ char *buf = NULL; ++ const size_t buflen = PATH_MAX * 4; + struct mntent* m; + FILE* fp = jlong_to_ptr(value); + jsize len; +@@ -183,10 +184,17 @@ Java_sun_nio_fs_LinuxNativeDispatcher_getmntent(JNIEnv* env, jclass this, + char* dir; + char* fstype; + char* options; ++ jint res = -1; + +- m = getmntent_r(fp, &ent, (char*)&buf, buflen); +- if (m == NULL) ++ buf = malloc(buflen); ++ if (buf == NULL) { ++ JNU_ThrowOutOfMemoryError(env, "native heap"); + return -1; ++ } ++ m = getmntent_r(fp, &ent, buf, buflen); ++ if (m == NULL) ++ goto out; ++ + name = m->mnt_fsname; + dir = m->mnt_dir; + fstype = m->mnt_type; +@@ -195,32 +203,35 @@ Java_sun_nio_fs_LinuxNativeDispatcher_getmntent(JNIEnv* env, jclass this, + len = strlen(name); + bytes = (*env)->NewByteArray(env, len); + if (bytes == NULL) +- return -1; ++ goto out; + (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)name); + (*env)->SetObjectField(env, entry, entry_name, bytes); + + len = strlen(dir); + bytes = (*env)->NewByteArray(env, len); + if (bytes == NULL) +- return -1; ++ goto out; + (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)dir); + (*env)->SetObjectField(env, entry, entry_dir, bytes); + + len = strlen(fstype); + bytes = (*env)->NewByteArray(env, len); + if (bytes == NULL) +- return -1; ++ goto out; + (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)fstype); + (*env)->SetObjectField(env, entry, entry_fstype, bytes); + + len = strlen(options); + bytes = (*env)->NewByteArray(env, len); + if (bytes == NULL) +- return -1; ++ goto out; + (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)options); + (*env)->SetObjectField(env, entry, entry_options, bytes); + +- return 0; ++ res = 0; ++out: ++ free(buf); ++ return res; + } + + JNIEXPORT void JNICALL diff --git a/srcpkgs/openjdk/files/003_fix-mask_shift.patch b/srcpkgs/openjdk8/patches/103_hotspot-mask-shift.patch similarity index 74% rename from srcpkgs/openjdk/files/003_fix-mask_shift.patch rename to srcpkgs/openjdk8/patches/103_hotspot-mask-shift.patch index 21db3fd886..3d3f0972db 100644 --- a/srcpkgs/openjdk/files/003_fix-mask_shift.patch +++ b/srcpkgs/openjdk8/patches/103_hotspot-mask-shift.patch @@ -1,7 +1,7 @@ Use ~0u instead of -1 to shift an unsigned value. ---- a/src/share/vm/code/dependencies.hpp 2016-04-25 18:32:00.000000000 +0200 -+++ b/src/share/vm/code/dependencies.hpp 2016-09-13 19:46:22.684595758 +0200 +--- openjdk/hotspot/src/share/vm/code/dependencies.hpp ++++ openjdk/hotspot/src/share/vm/code/dependencies.hpp @@ -166,7 +166,7 @@ LG2_TYPE_LIMIT = 4, // assert(TYPE_LIMIT <= (1<>${PKGDESTDIR}/etc/profile.d/10_openjdk8.sh <