Re: git: fd7028d74968 - main - java/openjdk19: Fix the build on aarch64

From: Dima Panov <fluffy_at_FreeBSD.org>
Date: Mon, 13 Feb 2023 05:29:39 UTC
Moin-moin!

Isn't bootstrap also needs to rebuild?

Any boostap-openjkd* is non-usable on macbook with m1 (vmware session)

jdk17, for example


configure: Found potential Boot JDK using configure arguments
configure: Potential Boot JDK found at /usr/local/bootstrap-openjdk17 is not a working JDK; ignoring
configure: Output from java -version was: #
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x000000004a18cf80, pid=70306, tid=349426
#
# JRE version:  (17.0.1+12) (build )
# Java VM: OpenJDK 64-Bit Server VM (17.0.1+12-1, mixed mode, tiered, compressed oops, g1 gc, bsd-aarch64)
# Problematic frame:
# v  ~BufferBlob::native signature handlers
#
# Core dump will be written. Default location: /wrkdirs/usr/ports/java/openjdk17/work/jdk17u-jdk-17.0.6-10-1/java.core
#
# An error report file with more information is saved as:
# /wrkdirs/usr/ports/java/openjdk17/work/jdk17u-jdk-17.0.6-10-1/hs_err_pid70306.log
#
#


On 11.02.2023 22:08, Greg Lewis wrote:
> The branch main has been updated by glewis:
> 
> URL: https://cgit.FreeBSD.org/ports/commit/?id=fd7028d74968d3f692fd42e81514d561398aaa02
> 
> commit fd7028d74968d3f692fd42e81514d561398aaa02
> Author:     Greg Lewis <glewis@FreeBSD.org>
> AuthorDate: 2023-02-11 19:08:28 +0000
> Commit:     Greg Lewis <glewis@FreeBSD.org>
> CommitDate: 2023-02-11 19:08:28 +0000
> 
>      java/openjdk19: Fix the build on aarch64
>      
>      * Apply a similar patch as was applied to java/openjdk17
> ---
>   java/openjdk19/Makefile                             |  5 +++++
>   ...ra-patch-src_hotspot_share_runtime_arguments.cpp | 21 +++++++++++++++++++++
>   2 files changed, 26 insertions(+)
> 
> diff --git a/java/openjdk19/Makefile b/java/openjdk19/Makefile
> index a652a90aa78e..abf11ebb221b 100644
> --- a/java/openjdk19/Makefile
> +++ b/java/openjdk19/Makefile
> @@ -157,6 +157,11 @@ CONFIGURE_ARGS+=	--disable-dtrace
>   .if ${ARCH} == powerpc64 && ${OSREL:C/\.[0-9]//} == 12
>   EXTRA_PATCHES=		${PATCHDIR}/extra-patch-src_hotspot_cpu_ppc_vm__version__ppc.hpp
>   .endif
> +.if ${ARCH} == aarch64
> +CONFIGURE_ARGS+=	--with-boot-jdk-jvmargs=-XX:-UseCompressedClassPointers
> +MAKE_ENV+=		JAVA_TOOL_OPTIONS="-XX:-UseCompressedClassPointers"
> +EXTRA_PATCHES=		${PATCHDIR}/extra-patch-src_hotspot_share_runtime_arguments.cpp
> +.endif
>   
>   .if empty(ICONV_LIB)
>   ICONV_CFLAGS=	-DLIBICONV_PLUG
> diff --git a/java/openjdk19/files/extra-patch-src_hotspot_share_runtime_arguments.cpp b/java/openjdk19/files/extra-patch-src_hotspot_share_runtime_arguments.cpp
> new file mode 100644
> index 000000000000..80ef25c560f6
> --- /dev/null
> +++ b/java/openjdk19/files/extra-patch-src_hotspot_share_runtime_arguments.cpp
> @@ -0,0 +1,21 @@
> +--- src/hotspot/share/runtime/arguments.cpp.orig	2023-01-15 10:13:55.469227000 -0800
> ++++ src/hotspot/share/runtime/arguments.cpp	2023-01-15 10:20:49.218102000 -0800
> +@@ -1557,6 +1557,10 @@
> + // set_use_compressed_oops().
> + void Arguments::set_use_compressed_klass_ptrs() {
> + #ifdef _LP64
> ++#  if defined(__FreeBSD__) && defined(AARCH64)
> ++  FLAG_SET_DEFAULT(UseCompressedClassPointers, false);
> ++  FLAG_SET_ERGO(UseCompressedClassPointers, false);
> ++#  else
> +   // On some architectures, the use of UseCompressedClassPointers implies the use of
> +   // UseCompressedOops. The reason is that the rheap_base register of said platforms
> +   // is reused to perform some optimized spilling, in order to use rheap_base as a
> +@@ -1582,6 +1586,7 @@
> +       }
> +     }
> +   }
> ++#  endif // __FreeBSD__ && AARCH64
> + #endif // _LP64
> + }
> +
> 

-- 
Sincerely,
Dima (fluffy@FreeBSD.org, https://t.me/FluffyBSD)
(desktop, kde, x11, office, ports-secteam)@FreeBSD team