diff options
author | Simon Frankenberger <simon@fraho.eu> | 2020-11-10 19:50:34 +0100 |
---|---|---|
committer | Milan P. Stanić <mps@arvanta.net> | 2020-11-29 12:23:45 +0000 |
commit | 176f7a9a3cb1857ce0fc76281747a8a49b9af7e6 (patch) | |
tree | 0e6040d96d945f973938c0cd6426b717a12ebc75 | |
parent | c5182d16571d189c5d15a7f97d6abc440c2011f7 (diff) | |
download | aports-176f7a9a3cb1857ce0fc76281747a8a49b9af7e6.tar.gz aports-176f7a9a3cb1857ce0fc76281747a8a49b9af7e6.tar.bz2 aports-176f7a9a3cb1857ce0fc76281747a8a49b9af7e6.tar.xz |
community/openjdk9: unify patches
-rw-r--r-- | community/openjdk9/APKBUILD | 25 | ||||
-rw-r--r-- | community/openjdk9/JDK-8187578.patch | 29 | ||||
-rw-r--r-- | community/openjdk9/JDK-8241296.patch | 25 | ||||
-rw-r--r-- | community/openjdk9/JDK-8245051.patch | 76 | ||||
-rw-r--r-- | community/openjdk9/aarch64.patch | 20 | ||||
-rw-r--r-- | community/openjdk9/build.patch | 8 | ||||
-rw-r--r-- | community/openjdk9/fix-bootjdk-check.patch | 4 | ||||
-rw-r--r-- | community/openjdk9/gcc10-compilation-fix.patch | 108 | ||||
-rw-r--r-- | community/openjdk9/make-4.3.patch | 5 | ||||
-rw-r--r-- | community/openjdk9/ppc64le.patch | 43 |
10 files changed, 323 insertions, 20 deletions
diff --git a/community/openjdk9/APKBUILD b/community/openjdk9/APKBUILD index 95d5c5ae19..8219677768 100644 --- a/community/openjdk9/APKBUILD +++ b/community/openjdk9/APKBUILD @@ -3,7 +3,7 @@ pkgname=openjdk9 pkgver=9.0.4_p12 _pkgver=${pkgver/_p/+} -pkgrel=2 +pkgrel=3 pkgdesc="Oracle OpenJDK 9" url="https://hg.openjdk.java.net/jdk-updates/jdk9u" # oracle dropped support for 32 bit @@ -55,6 +55,10 @@ source="jdk-$_pkgver-root.tar.bz2::https://hg.openjdk.java.net/jdk-updates/jdk9u ppc64le.patch make-4.3.patch fix-bootjdk-check.patch + gcc10-compilation-fix.patch + JDK-8187578.patch + JDK-8245051.patch + JDK-8241296.patch HelloWorld.java TestECDSA.java @@ -149,6 +153,11 @@ build() { --with-version-pre= \ --with-version-opt="alpine-r$pkgrel" \ --with-version-build=${_pkgver#*+} + + # set these flags to create debug builds on build errors: +# --with-native-debug-symbols=internal \ +# --with-debug-level=fastdebug \ + MAKEFLAGS='' make jdk-image } @@ -316,11 +325,15 @@ sha512sums="cef3655ae7db657e6c81aa86587e451e58896bb6ee786495f6d757096334435b6a4d 259228d3f439dde239e38cdebb8c3bbb83804ab141d87a9c236310707de9c58cd78cd80ceb4c17755cc1048071f24462839988112c2698f7ec1453a8810610f2 jdk-9.0.4+12-jdk.tar.bz2 ef3c70be906a4b0dd9c9195c88da045909ee3ef144941fb7b4495ed66b4162f481095cad87626d2bd38e5a62134b440223cd008dd6123b6b43c00e338610a692 jdk-9.0.4+12-langtools.tar.bz2 848c6ece418e250561572ad704baeb565580098cfc5f849d4e1a3b41b916aae3487eb4d8d0b319f3a503d122ec064ed4de0678d06821c9a2bdb09c990e589c97 jdk-9.0.4+12-nashorn.tar.bz2 -386490c3be4c9aa9dc4b73911bc0b97298ff8b1a50e53bd601f4d2a7b3e469f5b8e70e446b2bbe6876854302a373522b4819fde24c85eafc00f9524268096615 build.patch -3cc00d9b81377fdffb7f5b3f732a35cebd2575825d85df88330740903dd98de30fe75e69229811d52f2ef192c1df0715c2696edf31f64c8d7de4b502a16792e4 aarch64.patch -7244d0dfdb78d2f03ea992ef770ed888e2bd48f49e58438e7f0a763633c9aa8fc27b953d82c023f8f99ff23009a15031c99b2ef5550d277c63db684cd984ce8e ppc64le.patch -8460dde4d40d57254f14e995090bc4255ee7662d18c19f127d56a1d12d53ec56731574a784ed5d68e89aef1133da760f30ae0982389cf1512ccab1d5f62c4b75 make-4.3.patch -a132df211c86aed5af8564cb584b4ee69ce07f3186f5f6ca4b5c1af4355c47f060534d0fd65e9415b0082de2c4912de63a776fff63241b8f3b20951fb45f9f73 fix-bootjdk-check.patch +c2936ce815595da58337e1d14d484a9b300b8634888dcf27fd0577f176ad4b3655db5487ee0cace7562c82012c7d9c7ab1c1b42a4c5e753ab8efe4f9a2ad6ed3 build.patch +d488b49552ad489e52ea7856fa65ac3bd6301cb14db959729a9e6b590ab09c7dc2aa5a5e7dda6fbd69bde57e7fc24499df67e04f297b4a509e1aed4bf579207c aarch64.patch +ec0caf9ffcb2a10e9a4ae43d379f4d6a9387398a94a4dd1d09748f1d5c2af0f28f2b573334cba2b44a2fbfaae0d259b41d814f6dc8c3812377f061298c0f1db5 ppc64le.patch +09be87facf942dc2a4711c44939c1e0e557cb931a3db678543c288d3fb1dce85414ad7e6444f8e1c66c26fd170b9cb741dd53d66a1a98bc8200173ab05f583d2 make-4.3.patch +c2cba2987030924afabb4a8fd56cb6173ce3719b67c8374cadedb4b8f4da4efb33ef5df38106101caaf7fdbf9100fce1b1f9ccbf3e4d55cb7266efd508ad8a89 fix-bootjdk-check.patch +846c79eb4ebfdec42a59bdd10996968ac2b1b26b973acf963dba1790ff330f0f33bcaa953c37de312383a1f6b6ea1807f8ac1891c1c9d8b1f21c401e8ec76050 gcc10-compilation-fix.patch +2798a4866e2d34eafc32fe83c768ff5c27179db55312223eb403d43461c701b349818f65112129487a7d628cf679ed560c84f429cd047796277d47b8b4678d1d JDK-8187578.patch +78925ea347400ee67f21a405f4c5beae6227764f06d85bbefbe3ca977b9bcd9e8a42a514471c836f4e0f65a1ebfc02429c17e10f23d0125c88c76b0d04164362 JDK-8245051.patch +33504e31e99f370a8825c6d321e0b6e7f46eebf0c8adc171a62b63a956d85137fce2992f827651212e8aaf270352d27b26bc4cdbe3ca653e7ddcfc577d24092b JDK-8241296.patch d1767dddd8e0956e25c0f77ed45c6fc86a1191bae1704a6dc33be490fd20eaa50461fe5c2a3349512059d555651e2eb41437dd3c1096c351e8ee68b4534a2579 HelloWorld.java 27e91edef89d26c0c5b9a813e2045f8d2b348745a506ae37b34b660fa7093da9a4e0e676ea41dc4a5c901bce02e5304d95e90f68d6c99cbf461b2da40a7a9853 TestECDSA.java b02dff8d549f88317bb4c741a9e269e8d59eef990197d085388fc49c7423a4eb9367dbe1e02bffb10e7862f5980301eb58d4494e177d0e8f60af6b05c7fbbe60 TestCryptoLevel.java diff --git a/community/openjdk9/JDK-8187578.patch b/community/openjdk9/JDK-8187578.patch new file mode 100644 index 0000000000..952fd7ec90 --- /dev/null +++ b/community/openjdk9/JDK-8187578.patch @@ -0,0 +1,29 @@ +From b5dd6a9a45b8e9120733798b915eb8111a7c65ef Mon Sep 17 00:00:00 2001 +From: Erik Helin <ehelin@openjdk.org> +Date: Fri, 15 Sep 2017 14:47:13 +0200 +Subject: [PATCH] 8187578: BitMap::reallocate should check if old_map is NULL +Origin: https://github.com/openjdk/jdk11u/commit/b5dd6a9a45b8e9120733798b915eb8111a7c65ef +Modified: File to patch has another location in JDK9 + +Reviewed-by: stefank, eosterlund, dholmes +--- + src/hotspot/share/utilities/bitMap.cpp | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/hotspot/share/utilities/bitMap.cpp b/src/hotspot/share/utilities/bitMap.cpp +index 21a3229411..687b98e708 100644 +--- a/hotspot/src/share/vm/utilities/bitMap.cpp ++++ b/hotspot/src/share/vm/utilities/bitMap.cpp +@@ -78,8 +78,10 @@ BitMap::bm_word_t* BitMap::reallocate(const Allocator& allocator, bm_word_t* old + if (new_size_in_words > 0) { + map = allocator.allocate(new_size_in_words); + +- Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) map, +- MIN2(old_size_in_words, new_size_in_words)); ++ if (old_map != NULL) { ++ Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) map, ++ MIN2(old_size_in_words, new_size_in_words)); ++ } + + if (new_size_in_words > old_size_in_words) { + clear_range_of_words(map, old_size_in_words, new_size_in_words); diff --git a/community/openjdk9/JDK-8241296.patch b/community/openjdk9/JDK-8241296.patch new file mode 100644 index 0000000000..56f5e68b7a --- /dev/null +++ b/community/openjdk9/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/hotspot/src/share/vm/runtime/thread.cpp ++++ b/hotspot/src/share/vm/runtime/thread.cpp +@@ -788,7 +788,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/community/openjdk9/JDK-8245051.patch b/community/openjdk9/JDK-8245051.patch new file mode 100644 index 0000000000..f2e9932b1f --- /dev/null +++ b/community/openjdk9/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/hotspot/src/share/vm/c1/c1_Instruction.hpp ++++ b/hotspot/src/share/vm/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/hotspot/src/share/vm/c1/c1_ValueMap.cpp ++++ b/hotspot/src/share/vm/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/community/openjdk9/aarch64.patch b/community/openjdk9/aarch64.patch index d5b794d771..ddfa116daa 100644 --- a/community/openjdk9/aarch64.patch +++ b/community/openjdk9/aarch64.patch @@ -1,3 +1,12 @@ +Subject: Remove fpu_control.h include and partly apply patch for JDK-8224851 +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/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp +++ new/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp @@ -77,7 +77,6 @@ @@ -8,3 +17,14 @@ #ifdef BUILTIN_SIM #define REG_SP REG_RSP +--- old/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp ++++ new/hotspot/src/cpu/aarch64/vm/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/community/openjdk9/build.patch b/community/openjdk9/build.patch index a67d7167eb..e33d5af6c7 100644 --- a/community/openjdk9/build.patch +++ b/community/openjdk9/build.patch @@ -1,3 +1,11 @@ +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/common/autoconf/build-aux/config.guess +++ new/common/autoconf/build-aux/config.guess @@ -30,6 +30,17 @@ diff --git a/community/openjdk9/fix-bootjdk-check.patch b/community/openjdk9/fix-bootjdk-check.patch index 596abb28cc..32d766f957 100644 --- a/community/openjdk9/fix-bootjdk-check.patch +++ b/community/openjdk9/fix-bootjdk-check.patch @@ -1,3 +1,7 @@ +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. diff --git a/community/openjdk9/gcc10-compilation-fix.patch b/community/openjdk9/gcc10-compilation-fix.patch new file mode 100644 index 0000000000..d4cd2b0d76 --- /dev/null +++ b/community/openjdk9/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/jdk/src/java.base/unix/native/libjava/childproc.c ++++ new/jdk/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/jdk/src/java.base/unix/native/libjava/childproc.h ++++ new/jdk/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/jdk/src/java.security.jgss/unix/native/libj2gss/NativeFunc.c ++++ new/jdk/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/jdk/src/java.security.jgss/unix/native/libj2gss/NativeFunc.h ++++ new/jdk/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/jdk/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/jdk/src/jdk.sctp/unix/native/libsctp/Sctp.h ++++ new/jdk/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/community/openjdk9/make-4.3.patch b/community/openjdk9/make-4.3.patch index 604dd46ad6..2ee8814926 100644 --- a/community/openjdk9/make-4.3.patch +++ b/community/openjdk9/make-4.3.patch @@ -1,4 +1,7 @@ -upstream report: https://bugs.openjdk.java.net/browse/JDK-8237879. +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 diff --git a/community/openjdk9/ppc64le.patch b/community/openjdk9/ppc64le.patch index 8995627304..a842f8021b 100644 --- a/community/openjdk9/ppc64le.patch +++ b/community/openjdk9/ppc64le.patch @@ -1,3 +1,12 @@ +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/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp +++ new/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp @@ -1292,7 +1292,11 @@ @@ -60,7 +69,17 @@ } --- old/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp +++ new/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp -@@ -109,20 +109,34 @@ +@@ -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. @@ -69,7 +88,7 @@ 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[32]; ++ return (address)uc->uc_mcontext.gp_regs[PT_NIP]; +#endif } @@ -82,7 +101,7 @@ 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[32] = (unsigned long)pc; ++ uc->uc_mcontext.gp_regs[PT_NIP] = (unsigned long)pc; +#endif } @@ -95,21 +114,19 @@ } intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) { -@@ -252,7 +266,13 @@ +@@ -252,7 +269,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 -+ // why 33? -+ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc." -+ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) { ++ 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"); -@@ -557,6 +577,7 @@ +@@ -557,6 +578,7 @@ const ucontext_t* uc = (const ucontext_t*)context; st->print_cr("Registers:"); @@ -117,14 +134,14 @@ 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); -@@ -565,8 +586,18 @@ +@@ -565,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[32]); -+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]); -+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]); ++ 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]); @@ -136,7 +153,7 @@ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc); st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp)); -@@ -593,7 +624,11 @@ +@@ -593,7 +625,11 @@ // this is only for the "general purpose" registers for (int i = 0; i < 32; i++) { st->print("r%-2d=", i); |