mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-05-06 04:46:42 +02:00
testing/openjdk16: new aport
This commit is contained in:
parent
c1b3f87b47
commit
0d2def96cf
285
testing/openjdk16/APKBUILD
Normal file
285
testing/openjdk16/APKBUILD
Normal file
@ -0,0 +1,285 @@
|
||||
# Contributor: Simon Frankenberger <simon-alpine@fraho.eu>
|
||||
# Maintainer: Simon Frankenberger <simon-alpine@fraho.eu>
|
||||
pkgname=openjdk16
|
||||
pkgver=16.0.0_p36
|
||||
#_pkgver=${pkgver%_p*}-ga
|
||||
_pkgver=16-ga
|
||||
pkgrel=0
|
||||
pkgdesc="Oracle OpenJDK 16"
|
||||
url="https://hg.openjdk.java.net/jdk-updates/jdk16u"
|
||||
arch="all !x86 !armhf !armv7 !mips !mips64" # oracle dropped support for 32 bit
|
||||
license="GPL-2.0-with-classpath-exception"
|
||||
makedepends="autoconf
|
||||
bash
|
||||
gawk
|
||||
grep
|
||||
make
|
||||
openjdk15-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
|
||||
libxrandr-dev
|
||||
libxrender-dev
|
||||
libxt-dev
|
||||
libxtst-dev
|
||||
linux-headers
|
||||
zlib-dev"
|
||||
depends="$pkgname-jmods $pkgname-demos $pkgname-doc $pkgname-jdk" # for the virtual openjdk16 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/jdk16u/archive/jdk-$_pkgver.tar.gz
|
||||
gtest-1.8.1.tar.gz::https://github.com/google/googletest/archive/release-1.8.1.tar.gz
|
||||
|
||||
ppc64le.patch
|
||||
|
||||
HelloWorld.java
|
||||
TestECDSA.java
|
||||
TestCryptoLevel.java
|
||||
Alpine_Bug_10126.java
|
||||
"
|
||||
builddir="$srcdir/jdk16u-jdk-${_pkgver/+/-}"
|
||||
|
||||
_java_home="/usr/lib/jvm/java-16-openjdk"
|
||||
|
||||
ldpath="$_java_home/lib:$_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
|
||||
}
|
||||
|
||||
build() {
|
||||
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 \
|
||||
--build=$CBUILD \
|
||||
--host=$CHOST \
|
||||
--target=$CTARGET \
|
||||
--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-gtest=../googletest-release-1.8.1 \
|
||||
$_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##*_p}" \
|
||||
--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/linux-*-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
|
||||
# they don't take long, DO NOT DISABLE THEM!
|
||||
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/linux-*-server-release/images/jdk/* "$pkgdir/$_java_home"
|
||||
}
|
||||
|
||||
_jmods() {
|
||||
pkgdesc="Oracle OpenJDK 16 (jmods)"
|
||||
depends=""
|
||||
_fromroot="$pkgdir/$_java_home"
|
||||
_toroot="$subpkgdir/$_java_home"
|
||||
|
||||
mkdir -p "$_toroot"
|
||||
mv "$_fromroot/jmods" "$_toroot"
|
||||
}
|
||||
|
||||
_demos() {
|
||||
pkgdesc="Oracle OpenJDK 16 (demos)"
|
||||
depends=""
|
||||
_fromroot="$pkgdir/$_java_home"
|
||||
_toroot="$subpkgdir/$_java_home"
|
||||
|
||||
mkdir -p "$_toroot"
|
||||
mv "$_fromroot/demo" "$_toroot"
|
||||
}
|
||||
|
||||
_doc() {
|
||||
pkgdesc="Oracle OpenJDK 16 (Documentation)"
|
||||
depends=""
|
||||
_fromroot="$pkgdir/$_java_home"
|
||||
_toroot="$subpkgdir/$_java_home"
|
||||
|
||||
mkdir -p "$_toroot"
|
||||
mv "$_fromroot/man" "$_toroot"
|
||||
}
|
||||
|
||||
_jre() {
|
||||
pkgdesc="Oracle OpenJDK 16 (JRE)"
|
||||
depends="$pkgname-jre-headless"
|
||||
_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/libjsound.so" \
|
||||
"$_fromroot/lib/liblcms.so" \
|
||||
"$_fromroot/lib/libsplashscreen.so" \
|
||||
"$_toroot/lib"
|
||||
}
|
||||
|
||||
_src() {
|
||||
pkgdesc="Oracle OpenJDK 16 (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 16 (JRE headless)"
|
||||
depends="java-common java-cacerts"
|
||||
_fromroot="$pkgdir/$_java_home"
|
||||
_toroot="$subpkgdir/$_java_home"
|
||||
|
||||
mkdir -p "$_toroot"
|
||||
mv "$_fromroot/lib" "$_toroot"
|
||||
|
||||
mkdir -p "$_toroot/bin"
|
||||
for i in java \
|
||||
jfr \
|
||||
jpackage \
|
||||
keytool \
|
||||
rmid \
|
||||
rmiregistry; 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.md" "$_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 16 (JDK)"
|
||||
depends="$pkgname-jre"
|
||||
_fromroot="$pkgdir/$_java_home"
|
||||
_toroot="$subpkgdir/$_java_home"
|
||||
|
||||
mkdir -p "$_toroot"
|
||||
mv "$_fromroot/bin" "$_toroot"
|
||||
mv "$_fromroot/include" "$_toroot"
|
||||
}
|
||||
|
||||
sha512sums="4eeb76af07adb0041f4f5bab9decc251ee2a587ee6f9270fa4b11bd9e81b24d5ae56b5dec3a998d58045b4e4f8ab2109adbdbb6d502d004a1d2d6d5c7286007c jdk-16-ga.tar.gz
|
||||
e6283c667558e1fd6e49fa96e52af0e415a3c8037afe1d28b7ff1ec4c2ef8f49beb70a9327b7fc77eb4052a58c4ccad8b5260ec90e4bceeac7a46ff59c4369d7 gtest-1.8.1.tar.gz
|
||||
05845450afd2d8be9f9f3a69d24c92f2e18593beeb43d748efee53e92edaedacdde2bfcf46b07eb702e036fd3defe2e6418628c26d8e6114653aa521a5d309ce ppc64le.patch
|
||||
d1767dddd8e0956e25c0f77ed45c6fc86a1191bae1704a6dc33be490fd20eaa50461fe5c2a3349512059d555651e2eb41437dd3c1096c351e8ee68b4534a2579 HelloWorld.java
|
||||
27e91edef89d26c0c5b9a813e2045f8d2b348745a506ae37b34b660fa7093da9a4e0e676ea41dc4a5c901bce02e5304d95e90f68d6c99cbf461b2da40a7a9853 TestECDSA.java
|
||||
b02dff8d549f88317bb4c741a9e269e8d59eef990197d085388fc49c7423a4eb9367dbe1e02bffb10e7862f5980301eb58d4494e177d0e8f60af6b05c7fbbe60 TestCryptoLevel.java
|
||||
cc466f64fcc8762cf6e3c1f5739be6425209b27aa58acff4e7eb126003d61fa18266f0e79e57e9d84224654010185ab45dc0a8043543dea227258458a00a1eb1 Alpine_Bug_10126.java"
|
||||
13
testing/openjdk16/Alpine_Bug_10126.java
Normal file
13
testing/openjdk16/Alpine_Bug_10126.java
Normal file
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
3
testing/openjdk16/HelloWorld.java
Normal file
3
testing/openjdk16/HelloWorld.java
Normal file
@ -0,0 +1,3 @@
|
||||
public class HelloWorld {
|
||||
public static void main(String[] args) { System.out.println("Hello World!"); }
|
||||
}
|
||||
72
testing/openjdk16/TestCryptoLevel.java
Normal file
72
testing/openjdk16/TestCryptoLevel.java
Normal file
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
49
testing/openjdk16/TestECDSA.java
Normal file
49
testing/openjdk16/TestECDSA.java
Normal file
@ -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.");
|
||||
}
|
||||
}
|
||||
248
testing/openjdk16/ppc64le.patch
Normal file
248
testing/openjdk16/ppc64le.patch
Normal file
@ -0,0 +1,248 @@
|
||||
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
|
||||
@@ -47,6 +47,10 @@
|
||||
#include "utilities/macros.hpp"
|
||||
#include "utilities/powerOfTwo.hpp"
|
||||
|
||||
+#if ! (defined(__GLIBC__) || defined(__UCLIBC__))
|
||||
+#include <asm/ptrace.h>
|
||||
+#endif
|
||||
+
|
||||
#ifdef PRODUCT
|
||||
#define BLOCK_COMMENT(str) // nothing
|
||||
#else
|
||||
@@ -1272,7 +1276,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;
|
||||
}
|
||||
@@ -1335,11 +1343,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
|
||||
@@ -52,6 +52,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+#if ! (defined(__GLIBC__) || defined(__UCLIBC__))
|
||||
+#include <asm/ptrace.h>
|
||||
+#endif
|
||||
+
|
||||
bool VM_Version::_is_determine_features_test_running = false;
|
||||
uint64_t VM_Version::_dscr_val = 0;
|
||||
|
||||
@@ -709,7 +713,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
|
||||
@@ -76,7 +76,11 @@
|
||||
# include <poll.h>
|
||||
# include <ucontext.h>
|
||||
|
||||
+#if ! (defined(__GLIBC__) || defined(__UCLIBC__))
|
||||
+#include <asm/ptrace.h>
|
||||
+#endif
|
||||
|
||||
+
|
||||
address os::current_stack_pointer() {
|
||||
intptr_t* csp;
|
||||
|
||||
@@ -108,24 +112,42 @@
|
||||
// - 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::Posix::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
|
||||
}
|
||||
|
||||
static address ucontext_get_lr(const ucontext_t * uc) {
|
||||
+#if defined(__GLIBC__) || defined(__UCLIBC__)
|
||||
return (address)uc->uc_mcontext.regs->link;
|
||||
+#else // Musl
|
||||
+ return (address)uc->uc_mcontext.gp_regs[PT_LNK];
|
||||
+#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) {
|
||||
@@ -133,7 +155,11 @@
|
||||
}
|
||||
|
||||
static unsigned long ucontext_get_trap(const ucontext_t * uc) {
|
||||
+#if defined(__GLIBC__) || defined(__UCLIBC__)
|
||||
return uc->uc_mcontext.regs->trap;
|
||||
+#else // Musl
|
||||
+ return uc->uc_mcontext.gp_regs[PT_TRAP];
|
||||
+#endif
|
||||
}
|
||||
|
||||
address os::fetch_frame_from_context(const void* ucVoid,
|
||||
@@ -203,7 +229,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");
|
||||
@@ -451,6 +481,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);
|
||||
@@ -459,8 +490,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));
|
||||
@@ -483,12 +524,22 @@
|
||||
st->print_cr("Register to memory mapping:");
|
||||
st->cr();
|
||||
|
||||
+#if defined(__GLIBC__) || defined(__UCLIBC__)
|
||||
st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
|
||||
st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
|
||||
st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
|
||||
+#else // Musl
|
||||
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[PT_NIP]);
|
||||
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[PT_LNK]);
|
||||
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[PT_CTR]);
|
||||
+#endif
|
||||
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();
|
||||
}
|
||||
Only in new: src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp.orig
|
||||
--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
|
||||
+++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
|
||||
@@ -27,6 +27,10 @@
|
||||
#include "runtime/frame.inline.hpp"
|
||||
#include "runtime/thread.hpp"
|
||||
|
||||
+#if ! (defined(__GLIBC__) || defined(__UCLIBC__))
|
||||
+#include <asm/ptrace.h>
|
||||
+#endif
|
||||
+
|
||||
frame JavaThread::pd_last_frame() {
|
||||
assert(has_last_Java_frame(), "must have last_Java_sp() when suspended");
|
||||
|
||||
@@ -55,8 +59,13 @@
|
||||
// if we were running Java code when SIGPROF came in.
|
||||
if (isInJava) {
|
||||
ucontext_t* uc = (ucontext_t*) ucontext;
|
||||
+#if defined(__GLIBC__) || defined(__UCLIBC__)
|
||||
frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
|
||||
(address)uc->uc_mcontext.regs->nip);
|
||||
+#else // Musl
|
||||
+ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
|
||||
+ (address)uc->uc_mcontext.gp_regs[PT_NIP]);
|
||||
+#endif
|
||||
|
||||
if (ret_frame.pc() == NULL) {
|
||||
// ucontext wasn't useful
|
||||
@@ -69,7 +78,11 @@
|
||||
if (!Method::is_valid_method(m)) return false;
|
||||
if (!Metaspace::contains(m->constMethod())) return false;
|
||||
|
||||
+#if defined(__GLIBC__) || defined(__UCLIBC__)
|
||||
uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
|
||||
+#else // Musl
|
||||
+ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
|
||||
+#endif
|
||||
uint64_t istate_bcp = istate->bcp;
|
||||
uint64_t code_start = (uint64_t)(m->code_base());
|
||||
uint64_t code_end = (uint64_t)(m->code_base() + m->code_size());
|
||||
Loading…
x
Reference in New Issue
Block a user