From 037ddcc69327fc2257ea1799a315d4852faa1db6 Mon Sep 17 00:00:00 2001 From: Simon Frankenberger Date: Thu, 14 Dec 2023 07:12:33 +0100 Subject: [PATCH] community/openjdk20: enable for ppc64le --- community/openjdk20/APKBUILD | 7 +- .../JDK-8218814_Wformat-security.patch | 4 +- community/openjdk20/ppc64le.patch | 77 +++++++++++++++---- 3 files changed, 70 insertions(+), 18 deletions(-) diff --git a/community/openjdk20/APKBUILD b/community/openjdk20/APKBUILD index 8000a3c621c..b31b35864c3 100644 --- a/community/openjdk20/APKBUILD +++ b/community/openjdk20/APKBUILD @@ -7,7 +7,8 @@ pkgrel=0 pkgdesc="Oracle OpenJDK 20" provider_priority=20 url="https://github.com/openjdk/jdk20u" -arch="all !ppc64le !x86 !armhf !armv7 !riscv64" # oracle dropped support for 32 bit +# oracle dropped support for 32 bit +arch="all !x86 !armhf !armv7 !riscv64" license="GPL-2.0-with-classpath-exception" makedepends="autoconf bash @@ -277,8 +278,8 @@ _jdk() { sha512sums=" 77b46f43318288c7923cc63522410872df5b191af1ecd65d9fe0cb587be18bfdb370c7859476356f2e4ed5ed6d9c099542d7dca3fb948bed3a9674f95ba63237 jdk-20.0.2-ga.tar.gz e6283c667558e1fd6e49fa96e52af0e415a3c8037afe1d28b7ff1ec4c2ef8f49beb70a9327b7fc77eb4052a58c4ccad8b5260ec90e4bceeac7a46ff59c4369d7 gtest-1.8.1.tar.gz -60df3c57d17788187187f347bbeb0d634bc5e88886230e68e230cf90d24257c81a74cb419c1c38cd72a21d83829df48ff3ffd35222cc966274d5833082e68721 ppc64le.patch +668a49aede8e3dbb213bd0ca833290555f005544e8b0012e42f8f4b3d508ecb4383450427b8cc7fdb19df63703b303b2399e8ae8558ae97c4ea468f315e4e911 ppc64le.patch 403862d6e6919f40d705c59463e9d6ecc5ac5b3f95e107a7e91f84d64068176e4abe7b63f15ba8fc9b4ab2f1ab58f3a489e07716e4c370356e40c2699e870b4f JDK-8299245_disable-tests.patch ba59c46fb8b543b9a69caf8e974755469b10baa0b0e9f219c573fb97478bdf683e372900f3f4adfc121d34d6a65526195caef4d99ecc48d0a01b9af6859d9a5f FixNullPtrCast.patch -218217c4f0e41f709deff812e3b5dd80bf9b98935ba637f83b88a70773fefc08639a13c8072173921cd6e5605fb6e8b328758759683e7cfd3758d4bbc10a5a88 JDK-8218814_Wformat-security.patch +66f9d80d189ee2cd3658a5d4f744247731ee2659c3bae2f3e8e4ca29d834170aa265b7db9376d80c3050d10defc8247c2d8ed690d06707fe86691a6c2066c320 JDK-8218814_Wformat-security.patch " diff --git a/community/openjdk20/JDK-8218814_Wformat-security.patch b/community/openjdk20/JDK-8218814_Wformat-security.patch index 95a54d9a09d..95218e9785c 100644 --- a/community/openjdk20/JDK-8218814_Wformat-security.patch +++ b/community/openjdk20/JDK-8218814_Wformat-security.patch @@ -4,8 +4,8 @@ Upstream: Yes / closed unresolved (https://bugs.openjdk.org/browse/JDK-8218814) Remove the -Wno-format CLFAG for test objects ---- old/make/common/TestFilesCompilation.gmk 2023-07-11 17:28:44.345270760 +0200 -+++ new/make/common/TestFilesCompilation.gmk 2023-07-11 17:29:57.941716556 +0200 +--- old/make/common/TestFilesCompilation.gmk ++++ new/make/common/TestFilesCompilation.gmk @@ -100,7 +100,7 @@ CFLAGS := $$($1_BASE_CFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \ CXXFLAGS := $$($1_BASE_CXXFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \ diff --git a/community/openjdk20/ppc64le.patch b/community/openjdk20/ppc64le.patch index 79850757bf7..e93ecf2910e 100644 --- a/community/openjdk20/ppc64le.patch +++ b/community/openjdk20/ppc64le.patch @@ -7,6 +7,7 @@ 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. +diff -ru old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp --- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp +++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp @@ -47,6 +47,10 @@ @@ -20,7 +21,7 @@ and accessing the named fields (like "->nip") by the array index constants. #ifdef PRODUCT #define BLOCK_COMMENT(str) // nothing #else -@@ -1308,7 +1312,11 @@ +@@ -1316,7 +1320,11 @@ // the safepoing polling page. ucontext_t* uc = (ucontext_t*) ucontext; // Set polling address. @@ -32,7 +33,7 @@ and accessing the named fields (like "->nip") by the array index constants. if (polling_address_ptr != NULL) { *polling_address_ptr = addr; } -@@ -1371,11 +1379,20 @@ +@@ -1379,11 +1387,20 @@ || (is_stdu(instruction) && rs == 1)) { int ds = inv_ds_field(instruction); // return banged address @@ -53,9 +54,10 @@ and accessing the named fields (like "->nip") by the array index constants. return ra != 1 || rb_val >= 0 ? NULL // not a stack bang : sp + rb_val; // banged address } +diff -ru old/src/hotspot/cpu/ppc/vm_version_ppc.cpp new/src/hotspot/cpu/ppc/vm_version_ppc.cpp --- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp +++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp -@@ -52,6 +52,10 @@ +@@ -53,6 +53,10 @@ #endif #endif @@ -66,7 +68,7 @@ and accessing the named fields (like "->nip") by the array index constants. bool VM_Version::_is_determine_features_test_running = false; uint64_t VM_Version::_dscr_val = 0; -@@ -682,7 +686,7 @@ +@@ -683,7 +687,7 @@ unsigned long auxv = getauxval(AT_HWCAP2); if (auxv & PPC_FEATURE2_HTM_NOSC) { @@ -75,21 +77,70 @@ and accessing the named fields (like "->nip") by the array index constants. // 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 +diff -ru old/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp new/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp +--- old/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp ++++ new/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp +@@ -28,6 +28,10 @@ + #include "runtime/frame.inline.hpp" + #include "runtime/javaThread.hpp" + ++#if ! (defined(__GLIBC__) || defined(__UCLIBC__)) ++#include ++#endif ++ + frame JavaThread::pd_last_frame() { + assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); + +@@ -58,14 +62,22 @@ + // if we were running Java code when SIGPROF came in. + if (isInJava) { + ucontext_t* uc = (ucontext_t*) ucontext; ++#if defined(__GLIBC__) || defined(__UCLIBC__) + address pc = (address)uc->uc_mcontext.regs->nip; ++#else // Musl ++ address pc = (address)uc->uc_mcontext.gp_regs[PT_NIP]; ++#endif + + if (pc == NULL) { + // ucontext wasn't useful + return false; + } + ++#if defined(__GLIBC__) || defined(__UCLIBC__) + frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/], pc); ++#else // Musl ++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/], pc); ++#endif + + if (ret_frame.fp() == NULL) { + // The found frame does not have a valid frame pointer. +@@ -84,7 +96,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()); +diff -ru old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp --- 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 @@ +@@ -78,6 +78,10 @@ # include # include +#if ! (defined(__GLIBC__) || defined(__UCLIBC__)) +#include +#endif - + + address os::current_stack_pointer() { return (address)__builtin_frame_address(0); - } -@@ -103,24 +107,42 @@ +@@ -105,24 +109,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. @@ -132,7 +183,7 @@ and accessing the named fields (like "->nip") by the array index constants. } intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) { -@@ -128,7 +150,11 @@ +@@ -130,7 +152,11 @@ } static unsigned long ucontext_get_trap(const ucontext_t * uc) { @@ -144,7 +195,7 @@ and accessing the named fields (like "->nip") by the array index constants. } address os::fetch_frame_from_context(const void* ucVoid, -@@ -194,7 +220,11 @@ +@@ -196,7 +222,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. @@ -156,7 +207,7 @@ and accessing the named fields (like "->nip") by the array index constants. if (TraceTraps) { tty->print_cr("caught signal in transaction, " "ignoring to jump to abort handler"); -@@ -450,6 +480,7 @@ +@@ -452,6 +482,7 @@ const ucontext_t* uc = (const ucontext_t*)context; st->print_cr("Registers:"); @@ -164,7 +215,7 @@ and accessing the named fields (like "->nip") by the array index constants. 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); -@@ -489,6 +489,16 @@ +@@ -460,6 +491,16 @@ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]); if (i % 3 == 2) st->cr(); } @@ -181,7 +232,7 @@ and accessing the named fields (like "->nip") by the array index constants. st->cr(); st->cr(); } -@@ -482,12 +523,22 @@ +@@ -489,12 +530,22 @@ st->print_cr("Register to memory mapping:"); st->cr();