From 845c59552e3d091200f822e70f7dab9219464dda Mon Sep 17 00:00:00 2001 From: Simon Frankenberger Date: Tue, 10 Nov 2020 19:52:20 +0100 Subject: community/openjdk10: unify patches --- community/openjdk10/APKBUILD | 24 ++++-- community/openjdk10/JDK-8241296.patch | 25 ++++++ community/openjdk10/JDK-8245051.patch | 76 +++++++++++++++++ community/openjdk10/aarch64.patch | 20 +++++ community/openjdk10/build.patch | 8 ++ community/openjdk10/fix-bootjdk-check.patch | 4 + community/openjdk10/gcc10-compilation-fix.patch | 108 ++++++++++++++++++++++++ community/openjdk10/make-4.3.patch | 5 +- community/openjdk10/ppc64le.patch | 37 +++++--- 9 files changed, 287 insertions(+), 20 deletions(-) create mode 100644 community/openjdk10/JDK-8241296.patch create mode 100644 community/openjdk10/JDK-8245051.patch create mode 100644 community/openjdk10/gcc10-compilation-fix.patch diff --git a/community/openjdk10/APKBUILD b/community/openjdk10/APKBUILD index fab8801fa15..21e97eec1b3 100644 --- a/community/openjdk10/APKBUILD +++ b/community/openjdk10/APKBUILD @@ -3,7 +3,7 @@ pkgname=openjdk10 pkgver=10.0.2_p13 _pkgver=${pkgver/_p/+} -pkgrel=1 +pkgrel=2 pkgdesc="Oracle OpenJDK 10" url="https://hg.openjdk.java.net/jdk-updates/jdk10u" # oracle dropped support for 32 bit @@ -42,20 +42,23 @@ subpackages="$pkgname-jmods:_jmods:noarch $pkgname-src:_src:noarch $pkgname-jre-headless:_jre_headless $pkgname-jdk:_jdk" -source="jdk-$_pkgver.tar.bz2::https://hg.openjdk.java.net/jdk-updates/jdk10u/archive/jdk-$_pkgver.tar.bz2 +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-$_pkgver" +builddir="$srcdir/jdk10u-jdk-${_pkgver/+/-}" _java_home="/usr/lib/jvm/java-10-openjdk" @@ -289,12 +292,15 @@ _jdk() { mv "$_fromroot/include" "$_toroot" } -sha512sums="7491da11d5e0013db75d33e09be7a91ac0dbcde6282541a39fe471fd5368d49b15403bc7508b330ca60210b3ca02730743ba280657283a231853f6882a3ca74d jdk-10.0.2+13.tar.bz2 -e0e7957ca035346071e04aa1b09226189c69878461c0c94c8057983f9ceab493bd192799ac33be0155831a75fac8a61f40aafea1ad4bacfdb50dfe310406c777 build.patch -479d0183aece1ca3f41d4eb9e9bf69d3d0fc2668e32d8b826ae3bd117da5d83241868e8b0cab6773cb87bd7403f17d519cc190c530a783b51f28a6aee0272bea aarch64.patch -06f134112d8f6c3909f332713e8fef755e65815697f08ef8ea35f89ad658c76d9063d39754eec50de93ef709a4d37dcb0815d7a74663d8668af0e23793972395 ppc64le.patch -3029a390e36edf040349c0c9af7d90578c8d9261edc88c838f4864616b2f3b5540cf40ce60e4bf165ca87b95b84eebf3fc5c4f4105892771cedc97d8d342ecb7 make-4.3.patch -2fcca84fd6d50dc443a0a9a3b6a68d28aca8e221f4fde18ad58305fe52a25903444c397b529ed354a73722f2479c02952b6169a03bc51b6b5c683a6458d944ce fix-bootjdk-check.patch +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 diff --git a/community/openjdk10/JDK-8241296.patch b/community/openjdk10/JDK-8241296.patch new file mode 100644 index 00000000000..056d19cc390 --- /dev/null +++ b/community/openjdk10/JDK-8241296.patch @@ -0,0 +1,25 @@ +From e566dca620c43d56798770b41cd0d25a63a71b82 Mon Sep 17 00:00:00 2001 +From: Andrew Haley +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/community/openjdk10/JDK-8245051.patch b/community/openjdk10/JDK-8245051.patch new file mode 100644 index 00000000000..44e3cef2417 --- /dev/null +++ b/community/openjdk10/JDK-8245051.patch @@ -0,0 +1,76 @@ +From 3df88dc22cf28c4022776bcccaa57bd65e84450c Mon Sep 17 00:00:00 2001 +From: Xin Liu +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/community/openjdk10/aarch64.patch b/community/openjdk10/aarch64.patch index 32e9d1390e7..4898d01560d 100644 --- a/community/openjdk10/aarch64.patch +++ b/community/openjdk10/aarch64.patch @@ -1,3 +1,12 @@ +Subject: Remove fpu_control.h include +Upstream: No +Author: Simon Frankenberger + +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 @@ @@ -8,3 +17,14 @@ #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/community/openjdk10/build.patch b/community/openjdk10/build.patch index b29d66cf99a..c4b11b8bdca 100644 --- a/community/openjdk10/build.patch +++ b/community/openjdk10/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 + +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 @@ diff --git a/community/openjdk10/fix-bootjdk-check.patch b/community/openjdk10/fix-bootjdk-check.patch index af326dffe0f..862db87d980 100644 --- a/community/openjdk10/fix-bootjdk-check.patch +++ b/community/openjdk10/fix-bootjdk-check.patch @@ -1,3 +1,7 @@ +Subject: Fix detection of bootjdk on configure +Upstream: No +Author: Simon Frankenberger + 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/openjdk10/gcc10-compilation-fix.patch b/community/openjdk10/gcc10-compilation-fix.patch new file mode 100644 index 00000000000..91cba266e11 --- /dev/null +++ b/community/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 + +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 + #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/community/openjdk10/make-4.3.patch b/community/openjdk10/make-4.3.patch index eb4f69255c6..f60441070c5 100644 --- a/community/openjdk10/make-4.3.patch +++ b/community/openjdk10/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 diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index 170c3ed..697f9d2 100644 diff --git a/community/openjdk10/ppc64le.patch b/community/openjdk10/ppc64le.patch index c0498f05fad..b5e40a1c92b 100644 --- a/community/openjdk10/ppc64le.patch +++ b/community/openjdk10/ppc64le.patch @@ -1,3 +1,12 @@ +Subject: Fix compilation with different ucontext_t on musl +Upstream: No +Author: Simon Frankenberger + +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 @@ @@ -71,7 +80,17 @@ // 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 -@@ -109,20 +109,34 @@ +@@ -75,6 +75,9 @@ + # include + # include + ++#if ! (defined(__GLIBC__) || defined(__UCLIBC__)) ++# include ++#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. @@ -80,7 +99,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 } @@ -93,7 +112,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 } @@ -106,16 +125,14 @@ } intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) { -@@ -252,7 +266,13 @@ +@@ -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 -+ // 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, " @@ -133,9 +150,9 @@ 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]); -- cgit v1.2.3