diff --git a/srcpkgs/openjdk11/files/musl_patches/build.patch b/srcpkgs/openjdk11/files/musl_patches/build.patch index 81ed0f53b1..2b5ff8a51d 100644 --- a/srcpkgs/openjdk11/files/musl_patches/build.patch +++ b/srcpkgs/openjdk11/files/musl_patches/build.patch @@ -9,26 +9,6 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com 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 @@ -77,6 +77,7 @@ diff --git a/srcpkgs/openjdk11/files/musl_patches/ppc.patch b/srcpkgs/openjdk11/files/musl_patches/ppc.patch new file mode 100644 index 0000000000..d306d501e4 --- /dev/null +++ b/srcpkgs/openjdk11/files/musl_patches/ppc.patch @@ -0,0 +1,45 @@ +Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280 +--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp ++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp +@@ -47,6 +47,8 @@ + #include "opto/intrinsicnode.hpp" + #endif + ++#include ++ + #ifdef PRODUCT + #define BLOCK_COMMENT(str) // nothing + #else +--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp ++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp +@@ -845,7 +845,7 @@ void VM_Version::determine_features() { + 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,7 +75,7 @@ + # include + # include + # include +- ++# include + + address os::current_stack_pointer() { + intptr_t* csp; +--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp ++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp +@@ -23,6 +23,8 @@ + * + */ + ++#include ++ + #include "precompiled.hpp" + #include "runtime/frame.inline.hpp" + #include "runtime/thread.hpp" diff --git a/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch deleted file mode 100644 index 67f6642142..0000000000 --- a/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch +++ /dev/null @@ -1,221 +0,0 @@ -Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280 ---- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp -+++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp -@@ -1290,7 +1290,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; - } -@@ -1311,15 +1315,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; -@@ -1382,11 +1395,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 -@@ -768,7 +768,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 -@@ -108,24 +108,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[32]; -+#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[32] = (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[36]; -+#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 +151,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[40]; -+#endif - } - - ExtendedPC os::fetch_frame_from_context(const void* ucVoid, -@@ -259,7 +281,13 @@ - // 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) { -+#endif - if (TraceTraps) { - tty->print_cr("caught signal in transaction, " - "ignoring to jump to abort handler"); -@@ -586,6 +614,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); -@@ -594,8 +623,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->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)); -@@ -618,12 +657,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[32]); -+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]); -+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]); -+#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(); - } ---- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp -+++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp -@@ -56,8 +56,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[32]); -+#endif - - if (ret_frame.pc() == NULL) { - // ucontext wasn't useful -@@ -69,7 +74,11 @@ - if (!((Method*)(istate->method))->is_metaspace_object()) { - 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)(((Method*)(istate->method))->code_base()); - uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size()); diff --git a/srcpkgs/openjdk11/template b/srcpkgs/openjdk11/template index 3a0174da72..6133a5e9bb 100644 --- a/srcpkgs/openjdk11/template +++ b/srcpkgs/openjdk11/template @@ -46,28 +46,30 @@ shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt. disable_parallel_build=yes build_options="docs" +# no hotspot JIT for ppc32 +case "$XBPS_TARGET_MACHINE" in + ppc64*) ;; + ppc*) _use_zero=yes ;; +esac + +if [ -n "$_use_zero" ]; then + makedepends+=" libffi-devel" + configure_args+=" --with-jvm-variants=zero" + case "$XBPS_TARGET_MACHINE" in + ppc*) configure_args+=" --with-boot-jdk-jvmargs=-XX:ThreadStackSize=2560";; + esac +fi + case "$XBPS_TARGET_LIBC" in glibc) build_options_default+=" docs";; esac -if [ "$CROSS_BUILD" ]; then +if [ ! "$CROSS_BUILD" ]; then + hostmakedepends+=" openjdk10-bootstrap" + configure_args+=" --with-boot-jdk=/usr/lib/jvm/java-10-openjdk" +else hostmakedepends+=" openjdk11" configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk11" -elif [ "$XBPS_ARCH" = "x86_64-musl" ]; then - hostmakedepends+=" alsa-lib freetype giflib lcms libXi libXrender libXtst" - distfiles+=" https://alpha.de.repo.voidlinux.org/distfiles/openjdk-11.0.0.5+10-${XBPS_ARCH}.tar.gz" - checksum+=" 037520d9eb077628e137d638f3084689610e8a2fbc9efe50e10823dbac7897a4" - configure_args+=" --with-boot-jdk=${XBPS_BUILDDIR}/${wrksrc}/openjdk11" -elif [ "$XBPS_ARCH" = "i686" ]; then - hostmakedepends+=" alsa-lib freetype giflib lcms libXi libXrender libXtst" - distfiles+=" https://alpha.de.repo.voidlinux.org/distfiles/openjdk-11.0.0.5+10-${XBPS_ARCH}.tar.gz" - checksum+=" 90f4f43431487c2560c5be5f5fac979b6e0ff34933eaef1c1e37cd4b0e8cfb63" - configure_args+=" --with-boot-jdk=${XBPS_BUILDDIR}/${wrksrc}/openjdk11" -elif [ "$XBPS_ARCH" = "x86_64" ]; then - hostmakedepends+=" openjdk11-bin" - configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk11-bin" -else - broken="No suitable bootstrap binary found" fi alternatives=" @@ -118,11 +120,6 @@ post_extract() { if [ "$XBPS_TARGET_LIBC" = "musl" ]; then rm -r src/jdk.hotspot.agent fi - if [ -z $CROSS_BUILD ]; then - if [ "$XBPS_ARCH" = "x86_64-musl" ] || [ "$XBPS_ARCH" = "i686" ]; then - mv ${wrksrc}/../openjdk11 ${wrksrc}/openjdk11 - fi - fi } post_patch() { @@ -137,6 +134,15 @@ post_patch() { do_configure() { CFLAGS=${CFLAGS/-D_FORTIFY_SOURCE=2/} CXXFLAGS=${CXXFLAGS/-D_FORTIFY_SOURCE=2/} + + # force ELFv2 for ppc64 just in case + case "$XBPS_TARGET_MACHINE" in + ppc64*) + CFLAGS+=" -DABI_ELFv2" + CXXFLAGS+=" -DABI_ELFv2" + ;; + esac + configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/} if [ "$XBPS_CCACHE" ] && [ -z "$CROSS_BUILD" ]; then configure_args+=" --enable-ccache"