summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach van Rijn <me@zv.io>2022-02-04 23:53:15 +0000
committerZach van Rijn <me@zv.io>2022-11-02 11:12:02 -0500
commitcbcd0f6720324b38a76b1c0ae6d3df73492d198e (patch)
treeba7956e851343dc4a99f7d6fd9ac1ed5761be72c
parent1f9acbf52539c1ebd7ad8e474ca6fe26d2bb8958 (diff)
downloadpackages-cbcd0f6720324b38a76b1c0ae6d3df73492d198e.tar.gz
packages-cbcd0f6720324b38a76b1c0ae6d3df73492d198e.tar.bz2
packages-cbcd0f6720324b38a76b1c0ae6d3df73492d198e.tar.xz
packages-cbcd0f6720324b38a76b1c0ae6d3df73492d198e.zip
user/openjdk10: new package
-rw-r--r--user/openjdk10/APKBUILD315
-rw-r--r--user/openjdk10/Alpine_Bug_10126.java13
-rw-r--r--user/openjdk10/HelloWorld.java3
-rw-r--r--user/openjdk10/JDK-8241296.patch25
-rw-r--r--user/openjdk10/JDK-8245051.patch76
-rw-r--r--user/openjdk10/TestCryptoLevel.java72
-rw-r--r--user/openjdk10/TestECDSA.java49
-rw-r--r--user/openjdk10/aarch64.patch30
-rw-r--r--user/openjdk10/build.patch545
-rw-r--r--user/openjdk10/fix-bootjdk-check.patch363
-rw-r--r--user/openjdk10/gcc10-compilation-fix.patch108
-rw-r--r--user/openjdk10/make-4.3.patch20
-rw-r--r--user/openjdk10/ppc64le.patch178
13 files changed, 1797 insertions, 0 deletions
diff --git a/user/openjdk10/APKBUILD b/user/openjdk10/APKBUILD
new file mode 100644
index 000000000..4a5078d56
--- /dev/null
+++ b/user/openjdk10/APKBUILD
@@ -0,0 +1,315 @@
+# Contributor: Simon Frankenberger <simon-alpine@fraho.eu>
+# Maintainer: Zach van Rijn <me@zv.io>
+pkgname=openjdk10
+pkgver=10.0.2_p13
+_pkgver=$(printf "%s" "${pkgver}" | sed -e 's/_p/+/')
+pkgrel=3
+pkgdesc="Oracle OpenJDK 10"
+provider_priority=10
+url="https://hg.openjdk.java.net/jdk-updates/jdk10u"
+# oracle dropped support for 32 bit
+# mips64 and riscv64 blocked by openjdk9
+arch="all !x86 !armhf !armv7 !mips64 !riscv64"
+license="GPL-2.0-with-classpath-exception"
+makedepends="autoconf
+ bash
+ file
+ grep
+ make
+ openjdk9-jdk
+ zip
+ alsa-lib-dev
+ cups-dev
+ elfutils-dev
+ fontconfig-dev
+ freetype-dev
+ giflib-dev
+ lcms2-dev
+ libexecinfo-dev
+ libffi-dev
+ libjpeg-turbo-dev
+ libx11-dev
+ libxext-dev
+ libxrender-dev
+ libxt-dev
+ libxtst-dev
+ linux-headers
+ zlib-dev
+ cmd:which
+ "
+depends="$pkgname-jmods $pkgname-demos $pkgname-doc $pkgname-jdk" # for the virtual openjdk10 package
+subpackages="$pkgname-jmods:_jmods:noarch
+ $pkgname-demos:_demos:noarch
+ $pkgname-doc:_doc:noarch
+ $pkgname-jre:_jre
+ $pkgname-src:_src:noarch
+ $pkgname-jre-headless:_jre_headless
+ $pkgname-jdk:_jdk"
+source="jdk-$_pkgver.tar.gz::https://github.com/openjdk/jdk10u/archive/jdk-$_pkgver.tar.gz
+
+ build.patch
+ aarch64.patch
+ ppc64le.patch
+ make-4.3.patch
+ fix-bootjdk-check.patch
+ gcc10-compilation-fix.patch
+ JDK-8245051.patch
+ JDK-8241296.patch
+
+ HelloWorld.java
+ TestECDSA.java
+ TestCryptoLevel.java
+ Alpine_Bug_10126.java
+"
+builddir="$srcdir/jdk10u-jdk-$(printf "%s" "${_pkgver}" | tr '+' '-')"
+
+_java_home="/usr/lib/jvm/java-10-openjdk"
+
+ldpath="$_java_home/lib:$_java_home/lib/jli:$_java_home/lib/server"
+sonameprefix="$pkgname:"
+
+# enable running the JTReg tests in check?
+# see comment in that function for explanation
+_run_jtreg=${_run_jtreg:-0}
+if [ $_run_jtreg -ne 0 ]; then
+ makedepends="$makedepends java-jtreg"
+ checkdepends="$checkdepends ttf-freefont xvfb-run"
+fi
+
+prepare() {
+ default_prepare
+
+ # update autoconf files to detect alpine
+ update_config_sub
+ update_config_guess
+
+ # remove not compilable module (hotspot jdk.hotspot.agent)
+ # this needs libthread_db which is only provided by glibc
+ #
+ # haven't found any way to disable this module so just remove it.
+ rm -r src/jdk.hotspot.agent
+}
+
+build() {
+ export PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+ if [ $_run_jtreg -ne 0 ]; then
+ _with_jtreg="--with-jtreg=/usr/share/java/jtreg"
+ else
+ _with_jtreg="--with-jtreg=no"
+ fi
+
+ # CFLAGS, CXXFLAGS and LDFLAGS are ignored as shown by a warning
+ # in the output of ./configure unless used like such:
+ # --with-extra-cflags="$CFLAGS"
+ # --with-extra-cxxflags="$CXXFLAGS"
+ # --with-extra-ldflags="$LDFLAGS"
+ # See also paragraph "Configure Control Variables" from "common/doc/building.md"
+ # shellcheck disable=2097 disable=2098
+ CFLAGS='' CXXFLAGS='' LDFLAGS='' \
+ bash ./configure \
+ --openjdk-target=$CHOST \
+ --prefix="$_java_home" \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --localstatedir=/var \
+ --with-extra-cflags="$CFLAGS" \
+ --with-extra-cxxflags="$CXXFLAGS" \
+ --with-extra-ldflags="$LDFLAGS" \
+ --with-zlib=system \
+ --with-libjpeg=system \
+ --with-giflib=system \
+ --with-libpng=system \
+ --with-lcms=system \
+ --with-jobs=${JOBS:-4} \
+ --with-test-jobs=${JOBS:-4} \
+ --with-native-debug-symbols=none \
+ $_with_jtreg \
+ --disable-warnings-as-errors \
+ --disable-precompiled-headers \
+ --enable-dtrace=no \
+ --with-jvm-variants=server \
+ --with-debug-level=release \
+ --with-version-pre= \
+ --with-version-opt="alpine-r$pkgrel" \
+ --with-version-build=${_pkgver#*+} \
+ --with-vendor-name="Alpine" \
+ --with-vendor-url="https://alpinelinux.org/" \
+ --with-vendor-bug-url="https://gitlab.alpinelinux.org/alpine/aports/issues" \
+ --with-vendor-vm-bug-url="https://gitlab.alpinelinux.org/alpine/aports/issues"
+ MAKEFLAGS='' make jdk-image
+}
+
+check() {
+ local _java_bin="./build/*-normal-server-release/images/jdk/bin"
+
+ # 1) compile and run a simple hello world
+ $_java_bin/javac -d . "$srcdir"/HelloWorld.java
+ $_java_bin/java HelloWorld
+
+ # 2) compile and run a testcase for unlimited policy
+ $_java_bin/javac -d . "$srcdir"/TestCryptoLevel.java
+ $_java_bin/java -cp . --add-opens java.base/javax.crypto=ALL-UNNAMED TestCryptoLevel
+
+ # 3) compile and run a testcase for ECDSA signatures
+ $_java_bin/javac -d . "$srcdir"/TestECDSA.java
+ $_java_bin/java TestECDSA
+
+ # 4) compile and run testcase for bug 10126
+ $_java_bin/javac -d . "$srcdir"/Alpine_Bug_10126.java
+ $_java_bin/java Alpine_Bug_10126
+
+ # run the gtest unittest suites
+ MAKEFLAGS='' make test-hotspot-gtest
+
+ # The jtreg tests take very, very long to finish and show some failures (9 - 12 on my machine, varying between runs)
+ # I think these are not critical and can be safely ignored.
+ # As the tests take too long, they are disabled by default.
+ # When updating this aport please let them run at least once on your machine to see if the failure count changes.
+ if [ $_run_jtreg -ne 0 ]; then
+ _logfile=$( mktemp -p "$builddir" )
+ MAKEFLAGS='' xvfb-run make \
+ run-test-tier1 \
+ run-test-tier2 \
+ run-test-tier3 \
+ | tee "$_logfile"
+ msg "---------------------------------------"
+ msg "The build log can be found at $_logfile"
+ # abort the build so you may take a look at the logfile
+ false
+ return 1
+ fi
+}
+
+package() {
+ mkdir -p "$pkgdir/$_java_home"
+ cp -r build/*-normal-server-release/images/jdk/* "$pkgdir/$_java_home"
+}
+
+_jmods() {
+ pkgdesc="Oracle OpenJDK 10 (jmods)"
+ depends=""
+ _fromroot="$pkgdir/$_java_home"
+ _toroot="$subpkgdir/$_java_home"
+
+ mkdir -p "$_toroot"
+ mv "$_fromroot/jmods" "$_toroot"
+}
+
+_demos() {
+ pkgdesc="Oracle OpenJDK 10 (demos)"
+ depends=""
+ _fromroot="$pkgdir/$_java_home"
+ _toroot="$subpkgdir/$_java_home"
+
+ mkdir -p "$_toroot"
+ mv "$_fromroot/demo" "$_toroot"
+}
+
+_doc() {
+ pkgdesc="Oracle OpenJDK 10 (Documentation)"
+ depends=""
+ _fromroot="$pkgdir/$_java_home"
+ _toroot="$subpkgdir/$_java_home"
+
+ mkdir -p "$_toroot"
+
+ # handle man
+ mv "$_fromroot/man" "$_toroot"
+}
+
+_jre() {
+ pkgdesc="Oracle OpenJDK 10 (JRE)"
+ depends="$pkgname-jre-headless"
+ provides=java-jre
+ _fromroot="$pkgdir/$_java_home"
+ _toroot="$subpkgdir/$_java_home"
+
+ mkdir -p "$_toroot/lib"
+ mv "$_fromroot/lib/libawt_xawt.so" \
+ "$_fromroot/lib/libfontmanager.so" \
+ "$_fromroot/lib/libjavajpeg.so" \
+ "$_fromroot/lib/libjawt.so" \
+ "$_fromroot/lib/libjsoundalsa.so" \
+ "$_fromroot/lib/liblcms.so" \
+ "$_fromroot/lib/libsplashscreen.so" \
+ "$_toroot/lib"
+}
+
+_src() {
+ pkgdesc="Oracle OpenJDK 10 (sources)"
+ depends="$pkgname-jre-headless"
+ mkdir -p "$subpkgdir/$_java_home"/lib
+ mv "$pkgdir"/$_java_home/lib/src.zip \
+ "$subpkgdir"/$_java_home/lib/
+}
+
+_jre_headless() {
+ pkgdesc="Oracle OpenJDK 10 (JRE headless)"
+ depends="java-common java-cacerts"
+ provides=java-jre-headless
+ _fromroot="$pkgdir/$_java_home"
+ _toroot="$subpkgdir/$_java_home"
+
+ mkdir -p "$_toroot"
+ mv "$_fromroot/lib" "$_toroot"
+
+ mkdir -p "$_toroot/bin"
+ for i in appletviewer \
+ idlj \
+ java \
+ jjs \
+ jrunscript \
+ keytool \
+ orbd \
+ pack200 \
+ rmid \
+ rmiregistry \
+ servertool \
+ tnameserv \
+ unpack200; do
+ mv "$_fromroot/bin/$i" "$_toroot/bin/$i"
+ done
+
+ mv "$_fromroot/legal" "$_toroot"
+ mv "$_fromroot/conf" "$_toroot"
+ mv "$_fromroot/release" "$_toroot"
+ cp "$builddir/ASSEMBLY_EXCEPTION" "$_toroot"
+ cp "$builddir/LICENSE" "$_toroot"
+ cp "$builddir/README" "$_toroot"
+
+ # symlink to shared cacerts store
+ rm "$_toroot/lib/security/cacerts"
+ ln -sf /etc/ssl/certs/java/cacerts \
+ "$_toroot/lib/security/cacerts"
+
+ # symlink for java-common to work (expects jre in $_java_home/jre)
+ ln -sf . "$_toroot/jre"
+}
+
+_jdk() {
+ pkgdesc="Oracle OpenJDK 10 (JDK)"
+ depends="$pkgname-jre"
+ provides=java-jdk
+ _fromroot="$pkgdir/$_java_home"
+ _toroot="$subpkgdir/$_java_home"
+
+ mkdir -p "$_toroot"
+ mv "$_fromroot/bin" "$_toroot"
+ mv "$_fromroot/include" "$_toroot"
+}
+
+sha512sums="8d8e47006308d9a794090f1051a4f1fad1eabe609736e9039f29a60a9593d6c415759d607ee4557cceb18d6ce76b30d6d186b9453525fd4a2e6d158848cfd30c jdk-10.0.2+13.tar.gz
+ae8740c9a61c458986375a605294fa5b262772c43c5a520373b186da983be4d9407cf7bd33d3cd906fd3e1b1cb4481a74c8123fbd262d54506edefc859265fef build.patch
+6825ddfad1b61f7ffdebfb7189243d7f2d5c75e0b656b36c439b001c030b1d441dad22eb1b6ad4495ed208f72aac2e1cbde3a1cdee77b89b27d557695b851e66 aarch64.patch
+0cc8e06ef66ee3a982fc14ad0189d897f1de7fa3e5a741363906495ace06e329f2207ef1dcc84c08af1a1a58aed1c93c25d084552920f3def96920ef7ac39f9b ppc64le.patch
+2d7e829830f43d1c1849183a558dbfb108cd9750c1d6da4ebb7b9afdfa111e5a5ff63936f67f97f9317780a4f8e0e4c3d75c929746314254dc0b06f68b7480ec make-4.3.patch
+0a08b2198f059be9bdc1c19571c53e6be24d81a36888f5fe251de34709b29ccfb4e17e293aa1d5d6310160ee41f673b1028dbf50332d4be5364f1c15fa87a6b9 fix-bootjdk-check.patch
+33964c1f7834826c96695f759587ea889966dfa11d52b94d1e70ef88c600b837f7fa1588764f6f52e6198682e5e675723254b891d6916dc45c14111b234cdf81 gcc10-compilation-fix.patch
+a41008618734c87e512eae60dfd217a8eb9fa08ab416852aae1ceb8ae57ef7f943a9090f190ba275722d71687a8531e791d68eb29d2ad1a0e88cc2539dec9877 JDK-8245051.patch
+4282a77485139f67bb45f58c129109346fd35b4eaf4dc8927ea45c8348e9c49b7a3d29c9bd83ff7f53fedbca45bb4d7a75e217e89d295e66305043caeb44ce54 JDK-8241296.patch
+d1767dddd8e0956e25c0f77ed45c6fc86a1191bae1704a6dc33be490fd20eaa50461fe5c2a3349512059d555651e2eb41437dd3c1096c351e8ee68b4534a2579 HelloWorld.java
+27e91edef89d26c0c5b9a813e2045f8d2b348745a506ae37b34b660fa7093da9a4e0e676ea41dc4a5c901bce02e5304d95e90f68d6c99cbf461b2da40a7a9853 TestECDSA.java
+b02dff8d549f88317bb4c741a9e269e8d59eef990197d085388fc49c7423a4eb9367dbe1e02bffb10e7862f5980301eb58d4494e177d0e8f60af6b05c7fbbe60 TestCryptoLevel.java
+cc466f64fcc8762cf6e3c1f5739be6425209b27aa58acff4e7eb126003d61fa18266f0e79e57e9d84224654010185ab45dc0a8043543dea227258458a00a1eb1 Alpine_Bug_10126.java"
diff --git a/user/openjdk10/Alpine_Bug_10126.java b/user/openjdk10/Alpine_Bug_10126.java
new file mode 100644
index 000000000..a381c9ed7
--- /dev/null
+++ b/user/openjdk10/Alpine_Bug_10126.java
@@ -0,0 +1,13 @@
+public class Alpine_Bug_10126 {
+ public static void main(String[] args) throws Exception {
+ try (java.net.Socket sock = javax.net.ssl.SSLSocketFactory.getDefault().createSocket("gitlab.alpinelinux.org", 443);
+ java.io.InputStream in = sock.getInputStream();
+ java.io.OutputStream out = sock.getOutputStream()) {
+ out.write("GET / HTTP/1.0\n\nHost: gitlab.alpinelinux.org\n\nConnection: close\n\n\n\n".getBytes());
+ out.flush();
+ while (in.read(new byte[1024]) != -1) ;
+ }
+ System.out.println("Secured connection performed successfully");
+ }
+}
+
diff --git a/user/openjdk10/HelloWorld.java b/user/openjdk10/HelloWorld.java
new file mode 100644
index 000000000..0be813a19
--- /dev/null
+++ b/user/openjdk10/HelloWorld.java
@@ -0,0 +1,3 @@
+public class HelloWorld {
+ public static void main(String[] args) { System.out.println("Hello World!"); }
+}
diff --git a/user/openjdk10/JDK-8241296.patch b/user/openjdk10/JDK-8241296.patch
new file mode 100644
index 000000000..056d19cc3
--- /dev/null
+++ b/user/openjdk10/JDK-8241296.patch
@@ -0,0 +1,25 @@
+From e566dca620c43d56798770b41cd0d25a63a71b82 Mon Sep 17 00:00:00 2001
+From: Andrew Haley <aph@openjdk.org>
+Date: Thu, 19 Mar 2020 14:53:57 +0000
+Subject: [PATCH] 8241296: Segfault in JNIHandleBlock::oops_do()
+
+Reviewed-by: stefank, shade
+---
+ src/hotspot/share/runtime/thread.cpp | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp
+index 0aa68f3941..ca7f0b0fa4 100644
+--- a/src/hotspot/share/runtime/thread.cpp
++++ b/src/hotspot/share/runtime/thread.cpp
+@@ -827,7 +827,9 @@ bool Thread::claim_oops_do_par_case(int strong_roots_parity) {
+ }
+
+ void Thread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
+- active_handles()->oops_do(f);
++ if (active_handles() != NULL) {
++ active_handles()->oops_do(f);
++ }
+ // Do oop for ThreadShadow
+ f->do_oop((oop*)&_pending_exception);
+ handle_area()->oops_do(f);
diff --git a/user/openjdk10/JDK-8245051.patch b/user/openjdk10/JDK-8245051.patch
new file mode 100644
index 000000000..44e3cef24
--- /dev/null
+++ b/user/openjdk10/JDK-8245051.patch
@@ -0,0 +1,76 @@
+From 3df88dc22cf28c4022776bcccaa57bd65e84450c Mon Sep 17 00:00:00 2001
+From: Xin Liu <xliu@openjdk.org>
+Date: Wed, 20 May 2020 11:29:11 -0700
+Subject: [PATCH] 8245051: c1 is broken if it is compiled by gcc without
+ -fno-lifetime-dse
+Origin: https://github.com/openjdk/jdk11u/commit/3df88dc22cf28c4022776bcccaa57bd65e84450c
+Modified: File to patch has another location in JDK9
+
+Initialize BlockBegin block id in constructor rather than operator new
+
+Reviewed-by: kbarrett, thartmann
+---
+ src/hotspot/share/c1/c1_Instruction.hpp | 8 +++-----
+ src/hotspot/share/c1/c1_ValueMap.cpp | 1 +
+ 2 files changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/src/hotspot/share/c1/c1_Instruction.hpp b/src/hotspot/share/c1/c1_Instruction.hpp
+index 8b8f397995..a94a21e423 100644
+--- a/src/hotspot/share/c1/c1_Instruction.hpp
++++ b/src/hotspot/share/c1/c1_Instruction.hpp
+@@ -303,7 +303,6 @@
+ XHandlers* _exception_handlers; // Flat list of exception handlers covering this instruction
+
+ friend class UseCountComputer;
+- friend class BlockBegin;
+
+ void update_exception_state(ValueStack* state);
+
+@@ -349,7 +348,6 @@
+ void* operator new(size_t size) throw() {
+ Compilation* c = Compilation::current();
+ void* res = c->arena()->Amalloc(size);
+- ((Instruction*)res)->_id = c->get_next_id();
+ return res;
+ }
+
+@@ -410,7 +408,8 @@
+
+ // creation
+ Instruction(ValueType* type, ValueStack* state_before = NULL, bool type_is_constant = false)
+- : _use_count(0)
++ : _id(Compilation::current()->get_next_id())
++ , _use_count(0)
+ #ifndef PRODUCT
+ , _printable_bci(-99)
+ #endif
+@@ -1648,8 +1647,6 @@
+ void* operator new(size_t size) throw() {
+ Compilation* c = Compilation::current();
+ void* res = c->arena()->Amalloc(size);
+- ((BlockBegin*)res)->_id = c->get_next_id();
+- ((BlockBegin*)res)->_block_id = c->get_next_block_id();
+ return res;
+ }
+
+@@ -1661,6 +1658,7 @@
+ // creation
+ BlockBegin(int bci)
+ : StateSplit(illegalType)
++ , _block_id(Compilation::current()->get_next_block_id())
+ , _bci(bci)
+ , _depth_first_number(-1)
+ , _linear_scan_number(-1)
+diff --git a/src/hotspot/share/c1/c1_ValueMap.cpp b/src/hotspot/share/c1/c1_ValueMap.cpp
+index fd45abda2f..e7cafeb252 100644
+--- a/src/hotspot/share/c1/c1_ValueMap.cpp
++++ b/src/hotspot/share/c1/c1_ValueMap.cpp
+@@ -488,6 +488,7 @@
+ : _current_map(NULL)
+ , _value_maps(ir->linear_scan_order()->length(), ir->linear_scan_order()->length(), NULL)
+ , _compilation(ir->compilation())
++ , _has_substitutions(false)
+ {
+ TRACE_VALUE_NUMBERING(tty->print_cr("****** start of global value numbering"));
+
+
diff --git a/user/openjdk10/TestCryptoLevel.java b/user/openjdk10/TestCryptoLevel.java
new file mode 100644
index 000000000..3ed6c8dc1
--- /dev/null
+++ b/user/openjdk10/TestCryptoLevel.java
@@ -0,0 +1,72 @@
+/* TestCryptoLevel -- Ensure unlimited crypto policy is in use.
+ Copyright (C) 2012 Red Hat, Inc.
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as
+published by the Free Software Foundation, either version 3 of the
+License, or (at your option) any later version.
+
+This program 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 Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+import java.security.Permission;
+import java.security.PermissionCollection;
+
+public class TestCryptoLevel
+{
+ public static void main(String[] args)
+ throws NoSuchFieldException, ClassNotFoundException,
+ IllegalAccessException, InvocationTargetException
+ {
+ Class<?> cls = null;
+ Method def = null, exempt = null;
+
+ try
+ {
+ cls = Class.forName("javax.crypto.JceSecurity");
+ }
+ catch (ClassNotFoundException ex)
+ {
+ System.err.println("Running a non-Sun JDK.");
+ System.exit(0);
+ }
+ try
+ {
+ def = cls.getDeclaredMethod("getDefaultPolicy");
+ exempt = cls.getDeclaredMethod("getExemptPolicy");
+ }
+ catch (NoSuchMethodException ex)
+ {
+ System.err.println("Running IcedTea with the original crypto patch.");
+ System.exit(0);
+ }
+ def.setAccessible(true);
+ exempt.setAccessible(true);
+ PermissionCollection defPerms = (PermissionCollection) def.invoke(null);
+ PermissionCollection exemptPerms = (PermissionCollection) exempt.invoke(null);
+ Class<?> apCls = Class.forName("javax.crypto.CryptoAllPermission");
+ Field apField = apCls.getDeclaredField("INSTANCE");
+ apField.setAccessible(true);
+ Permission allPerms = (Permission) apField.get(null);
+ if (defPerms.implies(allPerms) && (exemptPerms == null || exemptPerms.implies(allPerms)))
+ {
+ System.err.println("Running with the unlimited policy.");
+ System.exit(0);
+ }
+ else
+ {
+ System.err.println("WARNING: Running with a restricted crypto policy.");
+ System.exit(-1);
+ }
+ }
+}
diff --git a/user/openjdk10/TestECDSA.java b/user/openjdk10/TestECDSA.java
new file mode 100644
index 000000000..abd81d1ce
--- /dev/null
+++ b/user/openjdk10/TestECDSA.java
@@ -0,0 +1,49 @@
+/* TestECDSA -- Ensure ECDSA signatures are working.
+ Copyright (C) 2016 Red Hat, Inc.
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as
+published by the Free Software Foundation, either version 3 of the
+License, or (at your option) any later version.
+
+This program 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 Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+import java.math.BigInteger;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.Signature;
+
+/**
+ * @test
+ */
+public class TestECDSA {
+
+ public static void main(String[] args) throws Exception {
+ KeyPairGenerator keyGen = KeyPairGenerator.getInstance("EC");
+ KeyPair key = keyGen.generateKeyPair();
+
+ byte[] data = "This is a string to sign".getBytes("UTF-8");
+
+ Signature dsa = Signature.getInstance("NONEwithECDSA");
+ dsa.initSign(key.getPrivate());
+ dsa.update(data);
+ byte[] sig = dsa.sign();
+ System.out.println("Signature: " + new BigInteger(1, sig).toString(16));
+
+ Signature dsaCheck = Signature.getInstance("NONEwithECDSA");
+ dsaCheck.initVerify(key.getPublic());
+ dsaCheck.update(data);
+ boolean success = dsaCheck.verify(sig);
+ if (!success) {
+ throw new RuntimeException("Test failed. Signature verification error");
+ }
+ System.out.println("Test passed.");
+ }
+}
diff --git a/user/openjdk10/aarch64.patch b/user/openjdk10/aarch64.patch
new file mode 100644
index 000000000..4898d0156
--- /dev/null
+++ b/user/openjdk10/aarch64.patch
@@ -0,0 +1,30 @@
+Subject: Remove fpu_control.h include
+Upstream: No
+Author: Simon Frankenberger <simon-alpine@fraho.eu>
+
+The header is not present with musl and including it results in build error.
+It's not needed anyways.
+
+The second patch fixes "error: redeclaration of 'using MacroAssembler::call_VM_leaf_base'"
+
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -76,7 +76,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
+--- old/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp
++++ new/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp
+@@ -39,8 +39,6 @@
+ protected:
+
+ protected:
+- using MacroAssembler::call_VM_leaf_base;
+-
+ // Interpreter specific version of call_VM_base
+ using MacroAssembler::call_VM_leaf_base;
+
diff --git a/user/openjdk10/build.patch b/user/openjdk10/build.patch
new file mode 100644
index 000000000..c4b11b8bd
--- /dev/null
+++ b/user/openjdk10/build.patch
@@ -0,0 +1,545 @@
+Subject: Fix compilation issues with musl libc
+Upstream: No
+Author: The portola team at https://openjdk.java.net/projects/portola/
+ With modifications by Simon Frankenberger <simon-alpine@fraho.eu>
+
+This giant patch makes it possible to compile openjdk with musl libc.
+The base was taken from a diff with the portola project and adjusted for latest musl libc.
+
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -140,6 +140,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -340,6 +340,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(addprefix -I, $(LIBJLI_SRC_DIRS))
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_CFLAGS += $(ZLIB_CPPFLAGS)
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -100,7 +100,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -524,6 +523,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -541,6 +545,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2897,20 +2902,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ 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) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");;
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -73,9 +73,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -898,7 +898,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -260,7 +260,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #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"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,7 +298,14 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
+
diff --git a/user/openjdk10/fix-bootjdk-check.patch b/user/openjdk10/fix-bootjdk-check.patch
new file mode 100644
index 000000000..862db87d9
--- /dev/null
+++ b/user/openjdk10/fix-bootjdk-check.patch
@@ -0,0 +1,363 @@
+Subject: Fix detection of bootjdk on configure
+Upstream: No
+Author: Simon Frankenberger <simon-alpine@fraho.eu>
+
+The alpine builders print out a warning about sched_getaffinity() not working.
+This causes the version check for the boot jdk to fail.
+Patch the command to determine the version number to ignore any errors and warnings.
+
+--- old/make/autoconf/boot-jdk.m4
++++ new/make/autoconf/boot-jdk.m4
+@@ -74,10 +74,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- [FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`]
++ [FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`]
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
+ AC_MSG_NOTICE([(Your Boot JDK must be version 9 or 10)])
+--- old/make/autoconf/generated-configure.sh
++++ new/make/autoconf/generated-configure.sh
+@@ -25595,10 +25595,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -25797,10 +25797,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -25987,10 +25987,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -26176,10 +26176,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -26365,10 +26365,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -26545,10 +26545,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -26876,10 +26876,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -27207,10 +27207,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -27425,10 +27425,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -27608,10 +27608,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -27819,10 +27819,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -28002,10 +28002,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -28213,10 +28213,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -28396,10 +28396,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -28607,10 +28607,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -28790,10 +28790,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -28988,10 +28988,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -29169,10 +29169,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -29368,10 +29368,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -29549,10 +29549,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -29747,10 +29747,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -29928,10 +29928,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -30127,10 +30127,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -30308,10 +30308,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -30488,10 +30488,10 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '10([\.+-].*)?|9([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+@@ -31490,10 +31490,10 @@
+ BUILD_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $EGREP -v warning | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+- FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"'`
++ FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '10([\.+-].*)?'`
+ if test "x$FOUND_CORRECT_VERSION" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Build JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring" >&5
+ $as_echo "$as_me: Potential Build JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring" >&6;}
diff --git a/user/openjdk10/gcc10-compilation-fix.patch b/user/openjdk10/gcc10-compilation-fix.patch
new file mode 100644
index 000000000..91cba266e
--- /dev/null
+++ b/user/openjdk10/gcc10-compilation-fix.patch
@@ -0,0 +1,108 @@
+Subject: Fix build error with gcc >= 10.0
+Upstream: Yes
+Upstream-Url: https://bugs.openjdk.java.net/browse/JDK-8235903
+Author: Simon Frankenberger <simon-alpine@fraho.eu>
+
+This is a backport of the fixes to make it compile with gcc10 again.
+
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -33,6 +33,7 @@
+
+ #include "childproc.h"
+
++const char * const *parentPathv;
+
+ ssize_t
+ restartableWrite(int fd, const void *buf, size_t count)
+--- old/src/java.base/unix/native/libjava/childproc.h
++++ new/src/java.base/unix/native/libjava/childproc.h
+@@ -118,7 +118,7 @@
+ * The cached and split version of the JDK's effective PATH.
+ * (We don't support putenv("PATH=...") in native code)
+ */
+-const char * const *parentPathv;
++extern const char * const *parentPathv;
+
+ ssize_t restartableWrite(int fd, const void *buf, size_t count);
+ int restartableDup2(int fd_from, int fd_to);
+--- old/src/java.security.jgss/unix/native/libj2gss/NativeFunc.c
++++ new/src/java.security.jgss/unix/native/libj2gss/NativeFunc.c
+@@ -28,6 +28,9 @@
+ #include <dlfcn.h>
+ #include "NativeFunc.h"
+
++/* global GSS function table */
++GSS_FUNCTION_TABLE_PTR ftab;
++
+ /* standard GSS method names (ordering is from mapfile) */
+ static const char RELEASE_NAME[] = "gss_release_name";
+ static const char IMPORT_NAME[] = "gss_import_name";
+--- old/src/java.security.jgss/unix/native/libj2gss/NativeFunc.h
++++ new/src/java.security.jgss/unix/native/libj2gss/NativeFunc.h
+@@ -265,6 +265,6 @@
+ typedef GSS_FUNCTION_TABLE *GSS_FUNCTION_TABLE_PTR;
+
+ /* global GSS function table */
+-GSS_FUNCTION_TABLE_PTR ftab;
++extern GSS_FUNCTION_TABLE_PTR ftab;
+
+ #endif
+--- /dev/null
++++ new/src/jdk.sctp/unix/native/libsctp/Sctp.c
+@@ -0,0 +1,34 @@
++/*
++ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation. Oracle designates this
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
++ * or visit www.oracle.com if you need additional information or have any
++ * questions.
++ */
++
++#include "Sctp.h"
++
++sctp_getladdrs_func* nio_sctp_getladdrs;
++sctp_freeladdrs_func* nio_sctp_freeladdrs;
++sctp_getpaddrs_func* nio_sctp_getpaddrs;
++sctp_freepaddrs_func* nio_sctp_freepaddrs;
++sctp_bindx_func* nio_sctp_bindx;
++sctp_peeloff_func* nio_sctp_peeloff;
++
+--- old/src/jdk.sctp/unix/native/libsctp/Sctp.h
++++ new/src/jdk.sctp/unix/native/libsctp/Sctp.h
+@@ -322,12 +322,12 @@
+
+ #endif /* __linux__ */
+
+-sctp_getladdrs_func* nio_sctp_getladdrs;
+-sctp_freeladdrs_func* nio_sctp_freeladdrs;
+-sctp_getpaddrs_func* nio_sctp_getpaddrs;
+-sctp_freepaddrs_func* nio_sctp_freepaddrs;
+-sctp_bindx_func* nio_sctp_bindx;
+-sctp_peeloff_func* nio_sctp_peeloff;
++extern sctp_getladdrs_func* nio_sctp_getladdrs;
++extern sctp_freeladdrs_func* nio_sctp_freeladdrs;
++extern sctp_getpaddrs_func* nio_sctp_getpaddrs;
++extern sctp_freepaddrs_func* nio_sctp_freepaddrs;
++extern sctp_bindx_func* nio_sctp_bindx;
++extern sctp_peeloff_func* nio_sctp_peeloff;
+
+ jboolean loadSocketExtensionFuncs(JNIEnv* env);
+
diff --git a/user/openjdk10/make-4.3.patch b/user/openjdk10/make-4.3.patch
new file mode 100644
index 000000000..f60441070
--- /dev/null
+++ b/user/openjdk10/make-4.3.patch
@@ -0,0 +1,20 @@
+Subject: Fix build error with make >= 4.3
+Upstream: Yes
+Upstream-Url: https://bugs.openjdk.java.net/browse/JDK-8237879
+Author: Simon Frankenberger <simon-alpine@fraho.eu>
+
+diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk
+index 170c3ed..697f9d2 100644
+--- a/make/common/MakeBase.gmk
++++ b/make/common/MakeBase.gmk
+@@ -967,7 +967,9 @@ DependOnVariableHelper = \
+ $(info NewVariable $1: >$(strip $($1))<) \
+ $(info OldVariable $1: >$(strip $($1_old))<)) \
+ $(call WriteFile, $1_old:=$(call DoubleDollar,$(call EscapeHash,$($1))), \
+- $(call DependOnVariableFileName, $1, $2))) \
++ $(call DependOnVariableFileName, $1, $2)) \
++ $(eval $(call DependOnVariableFileName, $1, $2): ) \
++ ) \
+ $(call DependOnVariableFileName, $1, $2) \
+ )
+
diff --git a/user/openjdk10/ppc64le.patch b/user/openjdk10/ppc64le.patch
new file mode 100644
index 000000000..b5e40a1c9
--- /dev/null
+++ b/user/openjdk10/ppc64le.patch
@@ -0,0 +1,178 @@
+Subject: Fix compilation with different ucontext_t on musl
+Upstream: No
+Author: Simon Frankenberger <simon-alpine@fraho.eu>
+
+The machine state registers have to be accessed differently when
+running on musl libc. This patch fix this by replacing
+"uc_mcontext.regs->grp" with "uc_mcontext.gp_regs"
+and accessing the named fields (like "->nip") by the array index constants.
+
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1294,7 +1294,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1315,15 +1319,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1386,11 +1399,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -745,7 +745,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -75,6 +75,9 @@
+ # include <poll.h>
+ # include <ucontext.h>
+
++#if ! (defined(__GLIBC__) || defined(__UCLIBC__))
++# include <asm/ptrace.h>
++#endif
+
+ address os::current_stack_pointer() {
+ intptr_t* csp;
+@@ -109,20 +112,34 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[PT_NIP];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[PT_NIP] = (unsigned long)pc;
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -252,7 +264,11 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ if (second_uc->uc_mcontext.gp_regs[PT_MSR] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -558,6 +578,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -566,8 +587,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[PT_NIP]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[PT_LNK]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[PT_CTR]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -594,7 +625,11 @@
+ // this is only for the "general purpose" registers
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }