pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/lang/openjdk11
Module Name: pkgsrc
Committed By: pho
Date: Mon Aug 4 13:22:07 UTC 2025
Modified Files:
pkgsrc/lang/openjdk11: Makefile bootstrap.mk distinfo hacks.mk
options.mk
pkgsrc/lang/openjdk11/patches: patch-make_autoconf_flags-cflags.m4
Added Files:
pkgsrc/lang/openjdk11/patches:
patch-src_hotspot_cpu_aarch64_frame__aarch64.hpp
patch-src_hotspot_cpu_aarch64_jniFastGetField__aarch64.cpp
patch-src_hotspot_cpu_aarch64_macroAssembler__aarch64.cpp
patch-src_hotspot_cpu_aarch64_macroAssembler__aarch64.hpp
patch-src_hotspot_cpu_aarch64_sharedRuntime__aarch64.cpp
patch-src_hotspot_cpu_aarch64_stubGenerator__aarch64.cpp
patch-src_hotspot_cpu_aarch64_templateInterpreterGenerator__aarch64.cpp
patch-src_hotspot_os__cpu_bsd__aarch64_os__bsd__aarch64.cpp
patch-src_hotspot_share_c1_c1__Runtime1.cpp
patch-src_hotspot_share_interpreter_interpreterRuntime.cpp
patch-src_hotspot_share_jvmci_jvmciEnv.hpp
patch-src_hotspot_share_opto_runtime.cpp
patch-src_hotspot_share_prims_jniCheck.cpp
patch-src_hotspot_share_prims_jvmtiEnter.xsl
patch-src_hotspot_share_prims_jvmtiEnv.cpp
patch-src_hotspot_share_prims_whitebox.inline.hpp
patch-src_hotspot_share_runtime_deoptimization.cpp
patch-src_hotspot_share_runtime_interfaceSupport.inline.hpp
patch-src_hotspot_share_runtime_safefetch.inline.hpp
patch-src_hotspot_share_runtime_safepoint.cpp
patch-src_hotspot_share_runtime_thread.cpp
patch-src_hotspot_share_runtime_threadWXSetters.inline.hpp
Log Message:
lang/openjdk11: Workaround for the VM dying on Apple Silicon chips
See the patch for threadWXSetters.inline.hpp for details. I rebuilt the
bootkit for aarch64 with new patches applied. This may cause some
performance regression on Cortex series, but as I stated in the patch
comment, relying on assumptions made on implementation details of chips is
fundamentally unsound, and that's why it didn't work on Apple Silicon in
the first place.
Also backported fixes regarding floating point arithmetics that appeared in
OpenJDK 22.
To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 pkgsrc/lang/openjdk11/Makefile
cvs rdiff -u -r1.9 -r1.10 pkgsrc/lang/openjdk11/bootstrap.mk
cvs rdiff -u -r1.47 -r1.48 pkgsrc/lang/openjdk11/distinfo
cvs rdiff -u -r1.2 -r1.3 pkgsrc/lang/openjdk11/hacks.mk
cvs rdiff -u -r1.8 -r1.9 pkgsrc/lang/openjdk11/options.mk
cvs rdiff -u -r1.4 -r1.5 \
pkgsrc/lang/openjdk11/patches/patch-make_autoconf_flags-cflags.m4
cvs rdiff -u -r0 -r1.1 \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_frame__aarch64.hpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_jniFastGetField__aarch64.cpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_macroAssembler__aarch64.cpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_macroAssembler__aarch64.hpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_sharedRuntime__aarch64.cpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_stubGenerator__aarch64.cpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_templateInterpreterGenerator__aarch64.cpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_c1_c1__Runtime1.cpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_interpreter_interpreterRuntime.cpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_jvmci_jvmciEnv.hpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_opto_runtime.cpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_jniCheck.cpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_jvmtiEnter.xsl \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_jvmtiEnv.cpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_whitebox.inline.hpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_deoptimization.cpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_interfaceSupport.inline.hpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_safefetch.inline.hpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_safepoint.cpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_thread.cpp \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_threadWXSetters.inline.hpp
cvs rdiff -u -r0 -r1.3 \
pkgsrc/lang/openjdk11/patches/patch-src_hotspot_os__cpu_bsd__aarch64_os__bsd__aarch64.cpp
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/lang/openjdk11/Makefile
diff -u pkgsrc/lang/openjdk11/Makefile:1.74 pkgsrc/lang/openjdk11/Makefile:1.75
--- pkgsrc/lang/openjdk11/Makefile:1.74 Sun Jun 15 13:41:51 2025
+++ pkgsrc/lang/openjdk11/Makefile Mon Aug 4 13:22:05 2025
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.74 2025/06/15 13:41:51 ryoon Exp $
+# $NetBSD: Makefile,v 1.75 2025/08/04 13:22:05 pho Exp $
DISTNAME= jdk11u-${GITHUB_TAG:C/\+/-/}
PKGNAME= openjdk11-1.${GITHUB_TAG:C/\+/./:C/jdk-([.0-9]+).*/\1/}
@@ -34,6 +34,7 @@ CONFIG_GUESS_OVERRIDE+= make/autoconf/bu
CONFIG_SUB_OVERRIDE+= make/autoconf/build-aux/autoconf-config.sub
CONFIG_GUESS_OVERRIDE+= make/autoconf/build-aux/autoconf-config.guess
USE_LANGUAGES= c c++
+USE_CXX_FEATURES= c++11
USE_TOOLS+= bash gmake pax pkg-config unzip:run zip:run autoconf automake
UNLIMIT_RESOURCES= datasize stacksize virtualsize cputime
@@ -43,7 +44,10 @@ BUILDLINK_PASSTHRU_DIRS+= ${ALT_BOOTDIR}
BOOT_JVMARGS= -XX:+UnlockDiagnosticVMOptions \
-XX:-UseSemaphoreGCThreadsSynchronization
-CONFIGURE_ARGS+= --prefix=${PREFIX:Q}
+# ${WRKSRC}/doc/building.mk explicitly states that its Makefiles are unsafe
+# to use -j.
+MAKE_JOBS_SAFE= no
+
CONFIGURE_ARGS+= --openjdk-target=${MACHINE_GNU_PLATFORM:Q}
CONFIGURE_ARGS+= --with-boot-jdk=${ALT_BOOTDIR}
CONFIGURE_ARGS+= --with-boot-jdk-jvmargs=${BOOT_JVMARGS:Q}
Index: pkgsrc/lang/openjdk11/bootstrap.mk
diff -u pkgsrc/lang/openjdk11/bootstrap.mk:1.9 pkgsrc/lang/openjdk11/bootstrap.mk:1.10
--- pkgsrc/lang/openjdk11/bootstrap.mk:1.9 Tue Dec 12 12:37:44 2023
+++ pkgsrc/lang/openjdk11/bootstrap.mk Mon Aug 4 13:22:05 2025
@@ -1,11 +1,11 @@
-# $NetBSD: bootstrap.mk,v 1.9 2023/12/12 12:37:44 ryoon Exp $
+# $NetBSD: bootstrap.mk,v 1.10 2025/08/04 13:22:05 pho Exp $
.if ${OPSYS} == "NetBSD" && ${OPSYS_VERSION} < 080000
PKG_FAIL_REASON+= "Only supports NetBSD >= 8"
.endif
-.if (!empty(MACHINE_PLATFORM:MNetBSD-*-aarch64) || !empty(MACHINE_PLATFORM:MNetBSD-*-*earm*)) && ${OPSYS_VERSION} < 099983
-PKG_FAIL_REASON+= "PR 55248: please update to NetBSD >= 9.99.83 to use this package"
+.if !empty(MACHINE_PLATFORM:MNetBSD-*-aarch64) && ${OPSYS_VERSION} < 090400
+PKG_FAIL_REASON+= "Only supports NetBSD >= 9.4"
.endif
ONLY_FOR_PLATFORM+= NetBSD-*-i386
@@ -25,7 +25,7 @@ EXTRACT_ONLY+= ${BOOT.nb7-amd64}
.endif
ONLY_FOR_PLATFORM+= NetBSD-*-aarch64
-BOOT.nb9-aarch64= bootstrap-jdk-1.11.0.7.10-netbsd-9-aarch64-20200509.tar.xz
+BOOT.nb9-aarch64= bootstrap-jdk-1.11.0.27.6-netbsd-9-aarch64-20250804.tar.xz
SITES.${BOOT.nb9-aarch64}= ${MASTER_SITE_LOCAL:=openjdk11/}
.if !empty(MACHINE_PLATFORM:MNetBSD-*-aarch64) || make(distinfo)
DISTFILES+= ${BOOT.nb9-aarch64}
Index: pkgsrc/lang/openjdk11/distinfo
diff -u pkgsrc/lang/openjdk11/distinfo:1.47 pkgsrc/lang/openjdk11/distinfo:1.48
--- pkgsrc/lang/openjdk11/distinfo:1.47 Sun Jun 15 13:41:51 2025
+++ pkgsrc/lang/openjdk11/distinfo Mon Aug 4 13:22:05 2025
@@ -1,23 +1,23 @@
-$NetBSD: distinfo,v 1.47 2025/06/15 13:41:51 ryoon Exp $
+$NetBSD: distinfo,v 1.48 2025/08/04 13:22:05 pho Exp $
BLAKE2s (bootstrap-jdk-1.11.0.15.10-netbsd-8-earmv6hf-20220525.tar.xz) = f93572f551f242344e5d6d5e46b9812e5b426772842b5fa06fea4422e327c871
SHA512 (bootstrap-jdk-1.11.0.15.10-netbsd-8-earmv6hf-20220525.tar.xz) =
c4030c99e4c1bb209f0c1ca6c10665c3f4c906f9d7dc13b912c3fbb8031f3dbb6f8d2e5e966cbbc452c307ba5d6de816c0f000b5b7c5d4e3fe8511baf12aab49
Size (bootstrap-jdk-1.11.0.15.10-netbsd-8-earmv6hf-20220525.tar.xz) = 92279544 bytes
+BLAKE2s (bootstrap-jdk-1.11.0.27.6-netbsd-9-aarch64-20250804.tar.xz) = 68bd15487eb52b1800fc32fff95625b7bc512c82f0ca7ec7326df237124afa72
+SHA512 (bootstrap-jdk-1.11.0.27.6-netbsd-9-aarch64-20250804.tar.xz) = d6800c43357104ab09c7a9fb86443005de7951385a1a1128f1a943445764af9f730ea146cb3194f84a8da6c10d4000ce8675f67ab2142ebab6b68d3f3faaba9a
+Size (bootstrap-jdk-1.11.0.27.6-netbsd-9-aarch64-20250804.tar.xz) = 110043364 bytes
BLAKE2s (bootstrap-jdk-1.11.0.5.8-netbsd-7-amd64-20190928.tar.xz) = b57b09661581b7dc6e3700a777f030dfa2fef6f953533456686bfd0dde9157d0
SHA512 (bootstrap-jdk-1.11.0.5.8-netbsd-7-amd64-20190928.tar.xz) = 6e61996f7e3c3492b0c878644db30d72021dc4096639992e53b4440d4e2e18cd92e5630ecd4600d1917a1e63a7c814b63f74f811a40588febfe19ad8d3208a9d
Size (bootstrap-jdk-1.11.0.5.8-netbsd-7-amd64-20190928.tar.xz) = 105760636 bytes
BLAKE2s (bootstrap-jdk-1.11.0.5.8-netbsd-7-i386-20190928.tar.xz) = c54603eabe28bae659a2042cb3b69588840a57502e741c3de333ac70ea1dedc2
SHA512 (bootstrap-jdk-1.11.0.5.8-netbsd-7-i386-20190928.tar.xz) = 1bf5336e9bfeea9ecbcd347f2ea8dd3c9633df42cab13a09c7afaae94faa95b92d862dd97caf380a7037825c3324377240d5d0639b2e0b31a2d7a6316ed56359
Size (bootstrap-jdk-1.11.0.5.8-netbsd-7-i386-20190928.tar.xz) = 96662264 bytes
-BLAKE2s (bootstrap-jdk-1.11.0.7.10-netbsd-9-aarch64-20200509.tar.xz) = 5aac0ec747ac714032dfcb4cc4f093ee3f9ddeb070301856727a8597cedd65cf
-SHA512 (bootstrap-jdk-1.11.0.7.10-netbsd-9-aarch64-20200509.tar.xz) = 735f47d7398a48f0963c5d629c6c319dfe22d84bacd45f84a34f4784433c8cf6bfe6b356363a4591f035bec4a32e2e38d0a9c6be361aa57e5f0170ad4e16a1ad
-Size (bootstrap-jdk-1.11.0.7.10-netbsd-9-aarch64-20200509.tar.xz) = 99673444 bytes
BLAKE2s (jdk11u-jdk-11.0.27-6-1.tar.gz) = f6cb29c7378c404ad66e94a323c33781ad38fd5911e9efcb435c4444dc7ad82c
SHA512 (jdk11u-jdk-11.0.27-6-1.tar.gz) = b8b808585a67a8ed09b83b07f4ed8304bb6fd2e89eb729c89c188c94aede655a24e67a1b6803a4d4fba70b91a76daf356ba7b7d4826b858eb598f7dac22de22c
Size (jdk11u-jdk-11.0.27-6-1.tar.gz) = 116708083 bytes
SHA1 (patch-make_autoconf_build-performance.m4) = d52cb5897e9fb6e3b0cdbe34641d8caa218b21b7
SHA1 (patch-make_autoconf_buildjdk-spec.gmk.in) = d0b600237853c17ecc2864604f0bd847ba6b0149
-SHA1 (patch-make_autoconf_flags-cflags.m4) = f8ef1f5f62234ff2c7d8d6e44cba85929cc5bd62
+SHA1 (patch-make_autoconf_flags-cflags.m4) = 04ef9cbf5e2b192af6e634243d496cfc24d11717
SHA1 (patch-make_autoconf_hotspot.m4) = 437c8b09114933cca22c4a847a90a415cd113e5a
SHA1 (patch-make_autoconf_lib-alsa.m4) = 999fbf951363f6b49b22aad81537728f22d7c381
SHA1 (patch-make_autoconf_lib-bundled.m4) = 35a4cdb3c4c3e4893b583cc73a0a79fda6f487e0
@@ -25,9 +25,31 @@ SHA1 (patch-make_autoconf_lib-freetype.m
SHA1 (patch-make_autoconf_lib-x11.m4) = f609a726f2d795f1d05cc933df587d3440c09b9f
SHA1 (patch-make_data_fontconfig_bsd.fontconfig.properties) = 9fd9f6ef4af0eece0b4ca0acbb44331566f17e07
SHA1 (patch-make_launcher_LauncherCommon.gmk) = e306dac42c5bdd908775b78c80128c9a96781b06
+SHA1 (patch-src_hotspot_cpu_aarch64_frame__aarch64.hpp) = 263be050505100a9ff37d75e2aa465e0ffb04d68
+SHA1 (patch-src_hotspot_cpu_aarch64_jniFastGetField__aarch64.cpp) = 92026071ff9354dd845ede6aa8f47c12ba883faf
+SHA1 (patch-src_hotspot_cpu_aarch64_macroAssembler__aarch64.cpp) = 0b720cdfef884368432b818bb56648b462539125
+SHA1 (patch-src_hotspot_cpu_aarch64_macroAssembler__aarch64.hpp) = 301d16361542eec9123b9a4cf0a64978cc863ed6
+SHA1 (patch-src_hotspot_cpu_aarch64_sharedRuntime__aarch64.cpp) = 248188cc49cfca7fb26b907525f19b9cec5caffd
+SHA1 (patch-src_hotspot_cpu_aarch64_stubGenerator__aarch64.cpp) = 146a6ab00271395ddfdb42bf50375ec6c1bfd18c
+SHA1 (patch-src_hotspot_cpu_aarch64_templateInterpreterGenerator__aarch64.cpp) = 1a017334bdab5717ea2aaf4ae77a1e3974ebee0e
+SHA1 (patch-src_hotspot_os__cpu_bsd__aarch64_os__bsd__aarch64.cpp) = 17918e89d4575a3f55c9e163370d7daf95043866
SHA1 (patch-src_hotspot_os__cpu_bsd__arm_bsd__arm__32.s) = 474a66abfb25030d4e32134816c14b157d1ebe6a
SHA1 (patch-src_hotspot_os_bsd_os__bsd.cpp) = 6322cbdda03dee528e89ac8b725f3df5e2165797
SHA1 (patch-src_hotspot_os_bsd_os__perf__bsd.cpp) = 7bb57f82f3a93adc1970ed4215148fc02ecbcd5a
SHA1 (patch-src_hotspot_os_posix_os__posix.cpp) = e70e8c1e59f0be184a7a1d6e9d11ac7b934ce4b2
+SHA1 (patch-src_hotspot_share_c1_c1__Runtime1.cpp) = a5e22891f91792e16aced8738c916b7c3e583010
+SHA1 (patch-src_hotspot_share_interpreter_interpreterRuntime.cpp) = 50da5fb63869733859bbae7756eef07b4718fd7f
+SHA1 (patch-src_hotspot_share_jvmci_jvmciEnv.hpp) = 75c7e29a69c75abc7747a7f1ba792400889f6157
SHA1 (patch-src_hotspot_share_libadt_dict.cpp) = a5c62973f563742d4ccc7db341b33366d14e2a01
+SHA1 (patch-src_hotspot_share_opto_runtime.cpp) = 65c60e5ca89be4d7003a4667c43f18a936a9a95d
+SHA1 (patch-src_hotspot_share_prims_jniCheck.cpp) = a3e92b764d9b7aef64ed3908435921ba4d7fec1c
+SHA1 (patch-src_hotspot_share_prims_jvmtiEnter.xsl) = a29d326249ae0a1fb960c7aa17f5128869869000
+SHA1 (patch-src_hotspot_share_prims_jvmtiEnv.cpp) = 475117e9d8578291294b5752029b92fe86fccae6
+SHA1 (patch-src_hotspot_share_prims_whitebox.inline.hpp) = 3efde30edae364d19541b9aceb9a2f52edbc364a
+SHA1 (patch-src_hotspot_share_runtime_deoptimization.cpp) = d791d59c9491f7bc448c9f7c10afdfa950e0f5b0
+SHA1 (patch-src_hotspot_share_runtime_interfaceSupport.inline.hpp) = a4d92a4aab76fcd4754004876dc27753322f3aa7
+SHA1 (patch-src_hotspot_share_runtime_safefetch.inline.hpp) = 1dc90818272e04b8b8825e54241c78e233e34593
+SHA1 (patch-src_hotspot_share_runtime_safepoint.cpp) = 0c694e52ae6a9e2e893d832e58b555fa9c316e75
+SHA1 (patch-src_hotspot_share_runtime_thread.cpp) = 54cbd9300afc23dbd90db4c21eced285cee56e8f
+SHA1 (patch-src_hotspot_share_runtime_threadWXSetters.inline.hpp) = f704bb060803e500415b5d300e26857cf7288ca5
SHA1 (patch-src_java.desktop_unix_native_common_awt_fontpath.c) = c27a058dbcc836fa5a9f979f193284a706a7c50b
Index: pkgsrc/lang/openjdk11/hacks.mk
diff -u pkgsrc/lang/openjdk11/hacks.mk:1.2 pkgsrc/lang/openjdk11/hacks.mk:1.3
--- pkgsrc/lang/openjdk11/hacks.mk:1.2 Sun May 3 20:07:34 2020
+++ pkgsrc/lang/openjdk11/hacks.mk Mon Aug 4 13:22:05 2025
@@ -1,4 +1,4 @@
-# $NetBSD: hacks.mk,v 1.2 2020/05/03 20:07:34 tnn Exp $
+# $NetBSD: hacks.mk,v 1.3 2025/08/04 13:22:05 pho Exp $
.if !defined(OPENJDK11_HACKS_MK)
OPENJDK11_HACKS_MK= # empty
@@ -18,9 +18,12 @@ post-wrapper:
# JDK can correctly build itself. Compiling or running programs other than
# openjdk itself on such hardware may still cause unexpected behaviour.
#
-
-.if !empty(MACHINE_PLATFORM:MNetBSD-*-*arm*) || \
- !empty(MACHINE_PLATFORM:MNetBSD-*-aarch64)
+# The issue has been fixed in OpenJDK 22 for aarch64, and we have
+# backported the fix to this package. We aren't sure if it's still an issue
+# on 32bit ARM. Probably not? You know when the issue bites you: javac
+# enters into an infinite loop while parsing subnormal numeric constants.
+#
+.if ${MACHINE_PLATFORM:MNetBSD-*-*arm*}
PKG_HACKS+= broken-ieee-floats
SUBST_CLASSES+= fpu
SUBST_STAGE.fpu= pre-build
Index: pkgsrc/lang/openjdk11/options.mk
diff -u pkgsrc/lang/openjdk11/options.mk:1.8 pkgsrc/lang/openjdk11/options.mk:1.9
--- pkgsrc/lang/openjdk11/options.mk:1.8 Wed May 25 06:05:34 2022
+++ pkgsrc/lang/openjdk11/options.mk Mon Aug 4 13:22:05 2025
@@ -1,4 +1,4 @@
-# $NetBSD: options.mk,v 1.8 2022/05/25 06:05:34 tnn Exp $
+# $NetBSD: options.mk,v 1.9 2025/08/04 13:22:05 pho Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.openjdk11
PKG_OPTIONS_OPTIONAL_GROUPS= variant
@@ -45,8 +45,10 @@ BUILDLINK_DEPMETHOD.libXt?= build
.include "../../x11/libXtst/buildlink3.mk"
.include "../../x11/libXrandr/buildlink3.mk"
.else
+CONFIGURE_ARGS+= --x-includes=${X11BASE}/include
+CONFIGURE_ARGS+= --x-libraries=${X11BASE}/lib
CONFIGURE_ARGS+= --enable-headless-only
-# We apparently still need the Xlib headers to build headless. why?
+# We apparently still need the Xlib headers and libraries to build headless. why?
BUILDLINK_DEPMETHOD.libX11?= build
.include "../../x11/libX11/buildlink3.mk"
BUILDLINK_DEPMETHOD.libXext?=build
Index: pkgsrc/lang/openjdk11/patches/patch-make_autoconf_flags-cflags.m4
diff -u pkgsrc/lang/openjdk11/patches/patch-make_autoconf_flags-cflags.m4:1.4 pkgsrc/lang/openjdk11/patches/patch-make_autoconf_flags-cflags.m4:1.5
--- pkgsrc/lang/openjdk11/patches/patch-make_autoconf_flags-cflags.m4:1.4 Tue Oct 1 14:48:00 2024
+++ pkgsrc/lang/openjdk11/patches/patch-make_autoconf_flags-cflags.m4 Mon Aug 4 13:22:06 2025
@@ -1,9 +1,10 @@
-$NetBSD: patch-make_autoconf_flags-cflags.m4,v 1.4 2024/10/01 14:48:00 ryoon Exp $
+$NetBSD: patch-make_autoconf_flags-cflags.m4,v 1.5 2025/08/04 13:22:06 pho Exp $
We prefer to use explicit run paths.
Add lib/jli to link libjli.so dynamically. Fix runtime error of Bazel.
+Require c++11 as we have some patches using it.
---- make/autoconf/flags-cflags.m4.orig 2024-08-26 15:59:52.654571089 +0000
+--- make/autoconf/flags-cflags.m4.orig 2025-04-19 23:57:10.000000000 +0000
+++ make/autoconf/flags-cflags.m4
@@ -42,8 +42,8 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
# --disable-new-dtags forces use of RPATH instead of RUNPATH for rpaths.
@@ -39,3 +40,21 @@ Add lib/jli to link libjli.so dynamicall
fi
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
+@@ -566,7 +559,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
+ TOOLCHAIN_CFLAGS_JDK="-pipe"
+ TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
+
+- CXXSTD_CXXFLAG="-std=gnu++98"
++ CXXSTD_CXXFLAG="-std=gnu++11"
+ FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$CXXSTD_CXXFLAG -Werror],
+ IF_FALSE: [CXXSTD_CXXFLAG=""])
+ TOOLCHAIN_CFLAGS_JDK_CXXONLY="$CXXSTD_CXXFLAG"
+@@ -817,7 +810,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
+ $1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer"
+ fi
+
+- $1_CXXSTD_CXXFLAG="-std=gnu++98"
++ $1_CXXSTD_CXXFLAG="-std=gnu++11"
+ FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${$1_CXXSTD_CXXFLAG} -Werror],
+ PREFIX: $3, IF_FALSE: [$1_CXXSTD_CXXFLAG=""])
+ $1_TOOLCHAIN_CFLAGS_JDK_CXXONLY="${$1_CXXSTD_CXXFLAG}"
Added files:
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_frame__aarch64.hpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_frame__aarch64.hpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_frame__aarch64.hpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_hotspot_cpu_aarch64_frame__aarch64.hpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Backport a bugfix appeared in Java 22:
+https://github.com/openjdk/jdk21u-dev/commit/9e582fcbb8ab34b44ff01ac13de5cc4d6487396d
+
+--- src/hotspot/cpu/aarch64/frame_aarch64.hpp.orig 2025-08-01 18:15:42.300499547 +0000
++++ src/hotspot/cpu/aarch64/frame_aarch64.hpp
+@@ -95,7 +95,7 @@
+ // Entry frames
+ // n.b. these values are determined by the layout defined in
+ // stubGenerator for the Java call stub
+- entry_frame_after_call_words = 27,
++ entry_frame_after_call_words = 29,
+ entry_frame_call_wrapper_offset = -8,
+
+ // we don't need a save area
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_jniFastGetField__aarch64.cpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_jniFastGetField__aarch64.cpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_jniFastGetField__aarch64.cpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,32 @@
+$NetBSD: patch-src_hotspot_cpu_aarch64_jniFastGetField__aarch64.cpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/cpu/aarch64/jniFastGetField_aarch64.cpp.orig 2025-04-19 23:57:10.000000000 +0000
++++ src/hotspot/cpu/aarch64/jniFastGetField_aarch64.cpp
+@@ -57,8 +57,6 @@ static const Register result = r7
+ // (8262896). So each FastGetXXXField is wrapped into a C++ statically
+ // compiled template function that optionally switches to WXExec if necessary.
+
+-#ifdef __APPLE__
+-
+ static address generated_fast_get_field[T_LONG + 1 - T_BOOLEAN];
+
+ template<int BType> struct BasicTypeToJni {};
+@@ -85,15 +83,6 @@ address JNI_FastGetField::generate_fast_
+ return (address)static_fast_get_field_wrapper<BType>;
+ }
+
+-#else // __APPLE__
+-
+-template<int BType>
+-address JNI_FastGetField::generate_fast_get_int_field1() {
+- return generate_fast_get_int_field0((BasicType)BType);
+-}
+-
+-#endif // __APPLE__
+-
+ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
+ const char *name;
+ switch (type) {
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_macroAssembler__aarch64.cpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_macroAssembler__aarch64.cpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_macroAssembler__aarch64.cpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_hotspot_cpu_aarch64_macroAssembler__aarch64.cpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Backport a bugfix appeared in Java 22:
+https://github.com/openjdk/jdk/commit/50f31240555888018f0f496ab29c8a5932dce459
+
+--- src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp.orig 2025-08-01 18:07:27.105868141 +0000
++++ src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
+@@ -3670,6 +3670,23 @@ void MacroAssembler::load_klass(Register
+ }
+ }
+
++void MacroAssembler::restore_cpu_control_state_after_jni(Register tmp1, Register tmp2) {
++ if (RestoreMXCSROnJNICalls) {
++ Label OK;
++ get_fpcr(tmp1);
++ mov(tmp2, tmp1);
++ // Set FPCR to the state we need. We do want Round to Nearest. We
++ // don't want non-IEEE rounding modes or floating-point traps.
++ bfi(tmp1, zr, 22, 4); // Clear DN, FZ, and Rmode
++ bfi(tmp1, zr, 8, 5); // Clear exception-control bits (8-12)
++ bfi(tmp1, zr, 0, 2); // Clear AH:FIZ
++ eor(tmp2, tmp1, tmp2);
++ cbz(tmp2, OK); // Only reset FPCR if it's wrong
++ set_fpcr(tmp1);
++ bind(OK);
++ }
++}
++
+ // ((OopHandle)result).resolve();
+ void MacroAssembler::resolve_oop_handle(Register result, Register tmp) {
+ // OopHandle::resolve is an indirection.
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_macroAssembler__aarch64.hpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_macroAssembler__aarch64.hpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_macroAssembler__aarch64.hpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,37 @@
+$NetBSD: patch-src_hotspot_cpu_aarch64_macroAssembler__aarch64.hpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Backport a bugfix appeared in Java 22:
+https://github.com/openjdk/jdk/commit/50f31240555888018f0f496ab29c8a5932dce459
+https://github.com/openjdk/jdk21u-dev/commit/9e582fcbb8ab34b44ff01ac13de5cc4d6487396d
+
+--- src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp.orig 2025-08-01 18:05:51.700767534 +0000
++++ src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp
+@@ -559,6 +559,18 @@ public:
+ msr(0b011, 0b0100, 0b0100, 0b001, zr);
+ }
+
++ // FPCR : op1 == 011
++ // CRn == 0100
++ // CRm == 0100
++ // op2 == 000
++ inline void get_fpcr(Register reg) {
++ mrs(0b11, 0b0100, 0b0100, 0b000, reg);
++ }
++
++ inline void set_fpcr(Register reg) {
++ msr(0b011, 0b0100, 0b0100, 0b000, reg);
++ }
++
+ // DCZID_EL0: op1 == 011
+ // CRn == 0000
+ // CRm == 0000
+@@ -946,6 +958,9 @@ public:
+ #define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__)
+ #define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__)
+
++ // Restore cpu control state after JNI call
++ void restore_cpu_control_state_after_jni(Register tmp1, Register tmp2);
++
+ // only if +VerifyFPU
+ void verify_FPU(int stack_depth, const char* s = "illegal FPU state");
+
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_sharedRuntime__aarch64.cpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_sharedRuntime__aarch64.cpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_sharedRuntime__aarch64.cpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_hotspot_cpu_aarch64_sharedRuntime__aarch64.cpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Backport a bugfix appeared in Java 22:
+https://github.com/openjdk/jdk/commit/50f31240555888018f0f496ab29c8a5932dce459
+
+--- src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp.orig 2025-08-01 17:56:57.114189168 +0000
++++ src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp
+@@ -1806,6 +1806,9 @@ nmethod* SharedRuntime::generate_native_
+ intptr_t return_pc = (intptr_t) __ pc();
+ oop_maps->add_gc_map(return_pc - start, map);
+
++ // Restore cpu control state after JNI call
++ __ restore_cpu_control_state_after_jni(rscratch1, rscratch2);
++
+ // Unpack native results.
+ switch (ret_type) {
+ case T_BOOLEAN: __ c2bool(r0); break;
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_stubGenerator__aarch64.cpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_stubGenerator__aarch64.cpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_stubGenerator__aarch64.cpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,55 @@
+$NetBSD: patch-src_hotspot_cpu_aarch64_stubGenerator__aarch64.cpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Backport a bugfix appeared in Java 22:
+https://github.com/openjdk/jdk21u-dev/commit/9e582fcbb8ab34b44ff01ac13de5cc4d6487396d
+
+--- src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp.orig 2025-08-01 18:21:30.132638820 +0000
++++ src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp
+@@ -160,8 +160,9 @@ class StubGenerator: public StubCodeGene
+
+ // Call stub stack layout word offsets from fp
+ enum call_stub_layout {
+- sp_after_call_off = -26,
++ sp_after_call_off = -28,
+
++ fpcr_off = sp_after_call_off,
+ d15_off = -26,
+ d13_off = -24,
+ d11_off = -22,
+@@ -191,8 +192,9 @@ class StubGenerator: public StubCodeGene
+ StubCodeMark mark(this, "StubRoutines", "call_stub");
+ address start = __ pc();
+
+- const Address sp_after_call(rfp, sp_after_call_off * wordSize);
++ const Address sp_after_call (rfp, sp_after_call_off * wordSize);
+
++ const Address fpcr_save (rfp, fpcr_off * wordSize);
+ const Address call_wrapper (rfp, call_wrapper_off * wordSize);
+ const Address result (rfp, result_off * wordSize);
+ const Address result_type (rfp, result_type_off * wordSize);
+@@ -241,6 +243,14 @@ class StubGenerator: public StubCodeGene
+ __ stpd(v13, v12, d13_save);
+ __ stpd(v15, v14, d15_save);
+
++ __ get_fpcr(rscratch1);
++ __ str(rscratch1, fpcr_save);
++ // Set FPCR to the state we need. We do want Round to Nearest. We
++ // don't want non-IEEE rounding modes or floating-point traps.
++ __ bfi(rscratch1, zr, 22, 4); // Clear DN, FZ, and Rmode
++ __ bfi(rscratch1, zr, 8, 5); // Clear exception-control bits (8-12)
++ __ set_fpcr(rscratch1);
++
+ // install Java thread in global register now we have saved
+ // whatever value it held
+ __ mov(rthread, c_rarg7);
+@@ -352,6 +362,10 @@ class StubGenerator: public StubCodeGene
+ __ ldp(r22, r21, r22_save);
+ __ ldp(r20, r19, r20_save);
+
++ // restore fpcr
++ __ ldr(rscratch1, fpcr_save);
++ __ set_fpcr(rscratch1);
++
+ __ ldp(c_rarg0, c_rarg1, call_wrapper);
+ __ ldrw(c_rarg2, result_type);
+ __ ldr(c_rarg3, method);
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_templateInterpreterGenerator__aarch64.cpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_templateInterpreterGenerator__aarch64.cpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_cpu_aarch64_templateInterpreterGenerator__aarch64.cpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_hotspot_cpu_aarch64_templateInterpreterGenerator__aarch64.cpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Backport a bugfix appeared in Java 22:
+https://github.com/openjdk/jdk/commit/50f31240555888018f0f496ab29c8a5932dce459
+
+--- src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp.orig 2025-08-01 18:02:38.517120527 +0000
++++ src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
+@@ -1365,6 +1365,9 @@ address TemplateInterpreterGenerator::ge
+ __ get_method(rmethod);
+ // result potentially in r0 or v0
+
++ // Restore cpu control state after JNI call
++ __ restore_cpu_control_state_after_jni(rscratch1, rscratch2);
++
+ // make room for the pushes we're about to do
+ __ sub(rscratch1, esp, 4 * wordSize);
+ __ andr(sp, rscratch1, -16);
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_c1_c1__Runtime1.cpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_c1_c1__Runtime1.cpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_c1_c1__Runtime1.cpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_hotspot_share_c1_c1__Runtime1.cpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/share/c1/c1_Runtime1.cpp.orig 2025-08-01 08:04:17.725306672 +0000
++++ src/hotspot/share/c1/c1_Runtime1.cpp
+@@ -836,7 +836,7 @@ JRT_ENTRY(void, Runtime1::patch_code(Jav
+
+ // Enable WXWrite: the function is called by c1 stub as a runtime function
+ // (see another implementation above).
+- MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
++ AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
+
+ ResourceMark rm(thread);
+ RegisterMap reg_map(thread, false);
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_interpreter_interpreterRuntime.cpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_interpreter_interpreterRuntime.cpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_interpreter_interpreterRuntime.cpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_hotspot_share_interpreter_interpreterRuntime.cpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/share/interpreter/interpreterRuntime.cpp.orig 2025-08-01 08:05:13.541716842 +0000
++++ src/hotspot/share/interpreter/interpreterRuntime.cpp
+@@ -1007,7 +1007,7 @@ IRT_END
+
+ nmethod* InterpreterRuntime::frequency_counter_overflow(JavaThread* thread, address branch_bcp) {
+ // Enable WXWrite: the function is called directly by interpreter.
+- MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
++ AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
+
+ nmethod* nm = frequency_counter_overflow_inner(thread, branch_bcp);
+ assert(branch_bcp != NULL || nm == NULL, "always returns null for non OSR requests");
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_jvmci_jvmciEnv.hpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_jvmci_jvmciEnv.hpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_jvmci_jvmciEnv.hpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_hotspot_share_jvmci_jvmciEnv.hpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/share/jvmci/jvmciEnv.hpp.orig 2025-08-01 08:06:09.852615593 +0000
++++ src/hotspot/share/jvmci/jvmciEnv.hpp
+@@ -37,7 +37,7 @@ class CompileTask;
+ // Bring the JVMCI compiler thread into the VM state.
+ #define JVMCI_VM_ENTRY_MARK \
+ JavaThread* thread = JavaThread::current(); \
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
+ ThreadInVMfromNative __tiv(thread); \
+ ResetNoHandleMark rnhm; \
+ HandleMarkCleaner __hm(thread); \
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_opto_runtime.cpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_opto_runtime.cpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_opto_runtime.cpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_hotspot_share_opto_runtime.cpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/share/opto/runtime.cpp.orig 2025-08-01 08:07:00.594301599 +0000
++++ src/hotspot/share/opto/runtime.cpp
+@@ -1447,7 +1447,7 @@ address OptoRuntime::handle_exception_C(
+ address OptoRuntime::rethrow_C(oopDesc* exception, JavaThread* thread, address ret_pc) {
+
+ // Enable WXWrite: the function called directly by compiled code.
+- MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
++ AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
+
+ #ifndef PRODUCT
+ SharedRuntime::_rethrow_ctr++; // count rethrows
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_jniCheck.cpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_jniCheck.cpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_jniCheck.cpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_hotspot_share_prims_jniCheck.cpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/share/prims/jniCheck.cpp.orig 2025-08-01 08:07:44.950353010 +0000
++++ src/hotspot/share/prims/jniCheck.cpp
+@@ -100,7 +100,7 @@ extern "C" {
+ if (env != xenv) { \
+ NativeReportJNIFatalError(thr, warn_wrong_jnienv); \
+ } \
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thr)); \
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thr)); \
+ VM_ENTRY_BASE(result_type, header, thr)
+
+
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_jvmtiEnter.xsl
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_jvmtiEnter.xsl:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_jvmtiEnter.xsl Mon Aug 4 13:22:06 2025
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_hotspot_share_prims_jvmtiEnter.xsl,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/share/prims/jvmtiEnter.xsl.orig 2025-08-01 08:09:37.206406219 +0000
++++ src/hotspot/share/prims/jvmtiEnter.xsl
+@@ -432,7 +432,7 @@ struct jvmtiInterface_1_ jvmti</xsl:text
+ <xsl:if test="count(@impl)=0 or not(contains(@impl,'innative'))">
+ <xsl:text>JavaThread* current_thread = (JavaThread*)this_thread;</xsl:text>
+ <xsl:value-of select="$space"/>
+- <xsl:text>MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current_thread));</xsl:text>
++ <xsl:text>AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current_thread));</xsl:text>
+ <xsl:value-of select="$space"/>
+ <xsl:text>ThreadInVMfromNative __tiv(current_thread);</xsl:text>
+ <xsl:value-of select="$space"/>
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_jvmtiEnv.cpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_jvmtiEnv.cpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_jvmtiEnv.cpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,34 @@
+$NetBSD: patch-src_hotspot_share_prims_jvmtiEnv.cpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/share/prims/jvmtiEnv.cpp.orig 2025-08-01 08:08:39.663737473 +0000
++++ src/hotspot/share/prims/jvmtiEnv.cpp
+@@ -172,7 +172,7 @@ JvmtiEnv::GetThreadLocalStorage(jthread
+ // other than the current thread is required we need to transition
+ // from native so as to resolve the jthread.
+
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current_thread));
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current_thread));
+ ThreadInVMfromNative __tiv(current_thread);
+ VM_ENTRY_BASE(jvmtiError, JvmtiEnv::GetThreadLocalStorage , current_thread)
+ debug_only(VMNativeEntryWrapper __vew;)
+@@ -3288,7 +3288,7 @@ JvmtiEnv::RawMonitorEnter(JvmtiRawMonito
+ int r = 0;
+ Thread* thread = Thread::current();
+ // 8266889: raw_enter changes Java thread state, needs WXWrite
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread));
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread));
+
+ if (thread->is_Java_thread()) {
+ JavaThread* current_thread = (JavaThread*)thread;
+@@ -3387,7 +3387,7 @@ JvmtiEnv::RawMonitorWait(JvmtiRawMonitor
+ int r = 0;
+ Thread* thread = Thread::current();
+ // 8266889: raw_wait changes Java thread state, needs WXWrite
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread));
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread));
+
+ if (thread->is_Java_thread()) {
+ JavaThread* current_thread = (JavaThread*)thread;
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_whitebox.inline.hpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_whitebox.inline.hpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_prims_whitebox.inline.hpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_hotspot_share_prims_whitebox.inline.hpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/share/prims/whitebox.inline.hpp.orig 2025-08-01 08:10:12.055800765 +0000
++++ src/hotspot/share/prims/whitebox.inline.hpp
+@@ -32,7 +32,7 @@
+
+ #define WB_ENTRY(result_type, header) JNI_ENTRY(result_type, header) \
+ ClearPendingJniExcCheck _clearCheck(env); \
+- MACOS_AARCH64_ONLY(ThreadWXEnable _wx(WXWrite, thread));
++ AARCH64_ONLY(ThreadWXEnable _wx(WXWrite, thread));
+
+ #define WB_END JNI_END
+
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_deoptimization.cpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_deoptimization.cpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_deoptimization.cpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_hotspot_share_runtime_deoptimization.cpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/share/runtime/deoptimization.cpp.orig 2025-08-01 08:12:23.402260027 +0000
++++ src/hotspot/share/runtime/deoptimization.cpp
+@@ -2096,7 +2096,7 @@ Deoptimization::update_method_data_from_
+
+ Deoptimization::UnrollBlock* Deoptimization::uncommon_trap(JavaThread* thread, jint trap_request, jint exec_mode) {
+ // Enable WXWrite: current function is called from methods compiled by C2 directly
+- MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
++ AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
+
+ if (TraceDeoptimization) {
+ tty->print("Uncommon trap ");
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_interfaceSupport.inline.hpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_interfaceSupport.inline.hpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_interfaceSupport.inline.hpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,106 @@
+$NetBSD: patch-src_hotspot_share_runtime_interfaceSupport.inline.hpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/share/runtime/interfaceSupport.inline.hpp.orig 2025-04-19 23:57:10.000000000 +0000
++++ src/hotspot/share/runtime/interfaceSupport.inline.hpp
+@@ -405,7 +405,7 @@ class RuntimeHistogramElement : public H
+ #define VM_LEAF_BASE(result_type, header) \
+ TRACE_CALL(result_type, header) \
+ debug_only(NoHandleMark __hm;) \
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, \
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, \
+ Thread::current())); \
+ os::verify_stack_alignment(); \
+ /* begin of body */
+@@ -444,7 +444,7 @@ class RuntimeHistogramElement : public H
+
+ #define IRT_ENTRY(result_type, header) \
+ result_type header { \
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
+ ThreadInVMfromJava __tiv(thread); \
+ VM_ENTRY_BASE(result_type, header, thread) \
+ debug_only(VMEntryWrapper __vew;)
+@@ -458,7 +458,7 @@ class RuntimeHistogramElement : public H
+
+ #define IRT_ENTRY_NO_ASYNC(result_type, header) \
+ result_type header { \
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
+ ThreadInVMfromJavaNoAsyncException __tiv(thread); \
+ VM_ENTRY_BASE(result_type, header, thread) \
+ debug_only(VMEntryWrapper __vew;)
+@@ -467,7 +467,7 @@ class RuntimeHistogramElement : public H
+
+ #define JRT_ENTRY(result_type, header) \
+ result_type header { \
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
+ ThreadInVMfromJava __tiv(thread); \
+ VM_ENTRY_BASE(result_type, header, thread) \
+ debug_only(VMEntryWrapper __vew;)
+@@ -481,7 +481,7 @@ class RuntimeHistogramElement : public H
+
+ #define JRT_ENTRY_NO_ASYNC(result_type, header) \
+ result_type header { \
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
+ ThreadInVMfromJavaNoAsyncException __tiv(thread); \
+ VM_ENTRY_BASE(result_type, header, thread) \
+ debug_only(VMEntryWrapper __vew;)
+@@ -490,7 +490,7 @@ class RuntimeHistogramElement : public H
+ // to get back into Java from the VM
+ #define JRT_BLOCK_ENTRY(result_type, header) \
+ result_type header { \
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
+ TRACE_CALL(result_type, header) \
+ HandleMarkCleaner __hm(thread);
+
+@@ -521,7 +521,7 @@ extern "C" {
+ result_type JNICALL header { \
+ JavaThread* thread=JavaThread::thread_from_jni_environment(env); \
+ assert( !VerifyJNIEnvThread || (thread == Thread::current()), "JNIEnv is only valid in same thread"); \
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
+ ThreadInVMfromNative __tiv(thread); \
+ debug_only(VMNativeEntryWrapper __vew;) \
+ VM_ENTRY_BASE(result_type, header, thread)
+@@ -534,7 +534,7 @@ extern "C" {
+ result_type JNICALL header { \
+ JavaThread* thread=JavaThread::thread_from_jni_environment(env); \
+ assert( !VerifyJNIEnvThread || (thread == Thread::current()), "JNIEnv is only valid in same thread"); \
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
+ ThreadInVMfromNative __tiv(thread); \
+ debug_only(VMNativeEntryWrapper __vew;) \
+ VM_QUICK_ENTRY_BASE(result_type, header, thread)
+@@ -559,7 +559,7 @@ extern "C" {
+ extern "C" { \
+ result_type JNICALL header { \
+ JavaThread* thread=JavaThread::thread_from_jni_environment(env); \
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
+ ThreadInVMfromNative __tiv(thread); \
+ debug_only(VMNativeEntryWrapper __vew;) \
+ VM_ENTRY_BASE(result_type, header, thread)
+@@ -569,7 +569,7 @@ extern "C" {
+ extern "C" { \
+ result_type JNICALL header { \
+ JavaThread* thread = JavaThread::current(); \
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
+ ThreadInVMfromNative __tiv(thread); \
+ debug_only(VMNativeEntryWrapper __vew;) \
+ VM_ENTRY_BASE(result_type, header, thread)
+@@ -579,7 +579,7 @@ extern "C" {
+ extern "C" { \
+ result_type JNICALL header { \
+ JavaThread* thread=JavaThread::thread_from_jni_environment(env); \
+- MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
++ AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
+ ThreadInVMfromNative __tiv(thread); \
+ debug_only(VMNativeEntryWrapper __vew;) \
+ VM_QUICK_ENTRY_BASE(result_type, header, thread)
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_safefetch.inline.hpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_safefetch.inline.hpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_safefetch.inline.hpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,43 @@
+$NetBSD: patch-src_hotspot_share_runtime_safefetch.inline.hpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/share/runtime/safefetch.inline.hpp.orig 2025-04-19 23:57:10.000000000 +0000
++++ src/hotspot/share/runtime/safefetch.inline.hpp
+@@ -32,7 +32,7 @@
+ // to be valid. If the load causes a fault, the error value is returned.
+ inline int SafeFetch32(int* adr, int errValue) {
+ assert(StubRoutines::SafeFetch32_stub(), "stub not yet generated");
+-#if defined(__APPLE__) && defined(AARCH64)
++#if defined(AARCH64)
+ Thread* thread = Thread::current_or_null_safe();
+ assert(thread != NULL, "required for W^X management");
+ ThreadWXEnable wx(WXExec, thread);
+@@ -42,7 +42,7 @@ inline int SafeFetch32(int* adr, int err
+
+ inline intptr_t SafeFetchN(intptr_t* adr, intptr_t errValue) {
+ assert(StubRoutines::SafeFetchN_stub(), "stub not yet generated");
+-#if defined(__APPLE__) && defined(AARCH64)
++#if defined(AARCH64)
+ Thread* thread = Thread::current_or_null_safe();
+ assert(thread != NULL, "required for W^X management");
+ ThreadWXEnable wx(WXExec, thread);
+@@ -52,7 +52,7 @@ inline intptr_t SafeFetchN(intptr_t* adr
+
+ // returns true if SafeFetch32 and SafeFetchN can be used safely (stubroutines are already generated)
+ inline bool CanUseSafeFetch32() {
+-#if defined (__APPLE__) && defined(AARCH64)
++#if defined(AARCH64)
+ if (Thread::current_or_null_safe() == NULL) { // workaround for JDK-8282475
+ return false;
+ }
+@@ -61,7 +61,7 @@ inline bool CanUseSafeFetch32() {
+ }
+
+ inline bool CanUseSafeFetchN() {
+-#if defined (__APPLE__) && defined(AARCH64)
++#if defined(AARCH64)
+ if (Thread::current_or_null_safe() == NULL) {
+ return false;
+ }
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_safepoint.cpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_safepoint.cpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_safepoint.cpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_hotspot_share_runtime_safepoint.cpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/share/runtime/safepoint.cpp.orig 2025-08-01 08:17:24.285983943 +0000
++++ src/hotspot/share/runtime/safepoint.cpp
+@@ -956,7 +956,7 @@ void SafepointSynchronize::handle_pollin
+ }
+
+ // Enable WXWrite: the function is called implicitly from java code.
+- MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
++ AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
+
+ if (PrintSafepointStatistics) {
+ inc_page_trap_count();
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_thread.cpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_thread.cpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_thread.cpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_hotspot_share_runtime_thread.cpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/share/runtime/thread.cpp.orig 2025-08-01 08:15:36.406910243 +0000
++++ src/hotspot/share/runtime/thread.cpp
+@@ -2547,7 +2547,7 @@ void JavaThread::check_safepoint_and_sus
+ // thread state is _thread_in_native_trans.
+ void JavaThread::check_special_condition_for_native_trans(JavaThread *thread) {
+ // Enable WXWrite: called directly from interpreter native wrapper.
+- MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
++ AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
+
+ check_safepoint_and_suspend_for_native_trans(thread);
+
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_threadWXSetters.inline.hpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_threadWXSetters.inline.hpp:1.1
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_share_runtime_threadWXSetters.inline.hpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,63 @@
+$NetBSD: patch-src_hotspot_share_runtime_threadWXSetters.inline.hpp,v 1.1 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips:
+https://mail-index.netbsd.org/tech-pkg/2025/07/12/msg031385.html
+
+The problem is basically that Hotspot outrightly violates the architecture
+spec, and then it does all kinds of weird workarounds to compensate,
+assuming their workarounds happen to work on some implementations of actual
+chips. It essentially relies on implementation details of chips:
+https://cr.openjdk.org/~jrose/jvm/hotspot-cmc.html
+
+However, their workaround does not work on Apple Silicon. It's not Apple's
+fault, because Hotspot knowingly violates the spec. The problem does not
+come to the surface on Darwin/aarch64 but it's only by an accident:
+Darwin/aarch64 strictly forbids executing code in writable pages, and
+provides a non-portable function pthread_jit_write_protect_np(), which
+Hotspot uses every time it needs to modify code in memory.
+
+The function temporarily write-protects every executable page in the entire
+process space but only for the calling thread, so that the thread can
+execute code in pages that are otherwise writable. The important fact is
+that the function happens to issue data and instruction memory barriers
+(i.e. DSB and ISB) in its implementation. It turned out these barriers were
+what made Hotspot work on Apple Silicon.
+
+So, in order to make it work on non-Darwin OSes on Apple Silicon, and
+possibly on other non-Cortex aarch64 chips, we must issue memory barriers
+every time it would call pthread_jit_write_protect_np() on
+Darwin/aarch64. FreeBSD suffers from the same problem:
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265284
+
+--- src/hotspot/share/runtime/threadWXSetters.inline.hpp.orig 2025-08-01 07:55:07.225394550 +0000
++++ src/hotspot/share/runtime/threadWXSetters.inline.hpp
+@@ -43,6 +43,29 @@ public:
+ }
+ }
+ };
++#elif defined(AARCH64)
++class ThreadWXEnable {
++ WXMode _new_mode;
++public:
++ ThreadWXEnable(WXMode new_mode, Thread*) :
++ _new_mode(new_mode)
++ {
++ if (_new_mode == WXExec) {
++ // We are going to execute some code that has been potentially
++ // modified.
++ __asm__ __volatile__ ("dsb\tsy\n"
++ "isb\tsy" : : : "memory");
++ }
++ }
++ ~ThreadWXEnable() {
++ if (_new_mode == WXWrite) {
++ // We may have modified some code that is going to be executed
++ // outside of this block.
++ __asm__ __volatile__ ("dsb\tsy\n"
++ "isb\tsy" : : : "memory");
++ }
++ }
++};
+ #endif // __APPLE__ && AARCH64
+
+ #endif // SHARE_RUNTIME_THREADWXSETTERS_INLINE_HPP
Index: pkgsrc/lang/openjdk11/patches/patch-src_hotspot_os__cpu_bsd__aarch64_os__bsd__aarch64.cpp
diff -u /dev/null pkgsrc/lang/openjdk11/patches/patch-src_hotspot_os__cpu_bsd__aarch64_os__bsd__aarch64.cpp:1.3
--- /dev/null Mon Aug 4 13:22:07 2025
+++ pkgsrc/lang/openjdk11/patches/patch-src_hotspot_os__cpu_bsd__aarch64_os__bsd__aarch64.cpp Mon Aug 4 13:22:06 2025
@@ -0,0 +1,23 @@
+$NetBSD: patch-src_hotspot_os__cpu_bsd__aarch64_os__bsd__aarch64.cpp,v 1.3 2025/08/04 13:22:06 pho Exp $
+
+Workaround for the Hotspot VM dying on Apple Silicon chips. See
+the patch to threadWXSetters.inline.hpp for details.
+
+--- src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp.orig 2025-08-01 08:01:30.302760008 +0000
++++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp
+@@ -1053,6 +1053,7 @@ JVM_handle_bsd_signal(int sig,
+
+ // check if fault address is within thread stack
+ if (thread->on_local_stack(addr)) {
++ AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
+ // stack overflow
+ if (thread->in_stack_yellow_reserved_zone(addr)) {
+ if (thread->thread_state() == _thread_in_Java) {
+@@ -1100,6 +1101,7 @@ JVM_handle_bsd_signal(int sig,
+ if (thread->thread_state() == _thread_in_Java) {
+ // Java thread running in Java code => find exception handler if any
+ // a fault inside compiled code, the interpreter, or a stub
++ AARCH64_ONLY(ThreadWXEnable wx(WXWrite, thread));
+
+ // Handle signal from NativeJump::patch_verified_entry().
+ if ((sig == SIGILL || sig == SIGTRAP)
Home |
Main Index |
Thread Index |
Old Index