git: a705af9bfceb - main - java/openjdk8: Restore workaround for aarch64 assertions

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Wed, 14 Sep 2022 08:53:23 UTC
The branch main has been updated by dim (src committer):

URL: https://cgit.FreeBSD.org/ports/commit/?id=a705af9bfceba0fafc2612898a7afcedcb7c1865

commit a705af9bfceba0fafc2612898a7afcedcb7c1865
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-09-14 08:52:30 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-09-14 08:52:48 +0000

    java/openjdk8: Restore workaround for aarch64 assertions
    
    See also <https://bugs.openjdk.org/browse/JDK-8247766>.
    
    Even though the upstream fix has been applied to this version of the
    JDK, some users still report the assertion "guarantee(val < (1U <<
    nbits)) failed: Field too big for insn" occurring, when it is built with
    recent versions of clang.
    
    Therefore, restore the workaround that uses clang 12 to build the JDK on
    aarch64.
    
    PR:             264065
    MFH:            2022Q3
---
 java/openjdk8/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/java/openjdk8/Makefile b/java/openjdk8/Makefile
index 424b00ec9720..55def79f9ee0 100644
--- a/java/openjdk8/Makefile
+++ b/java/openjdk8/Makefile
@@ -204,6 +204,16 @@ LIB_DEPENDS+=	libffi.so:devel/libffi
 .if ${COMPILER_TYPE} == clang
 MAKE_ENV+=	COMPILER_WARNINGS_FATAL=false USE_CLANG=true
 CONFIGURE_ENV+=	LIBCXX="-lc++"
+.if ${COMPILER_VERSION} >= 130 && ${ARCH} == aarch64
+# PR258954: see <https://bugs.openjdk.org/browse/JDK-8247766>. Even though the
+# upstream fix has been applied to this version of the JDK, users still report
+# the assertion "guarantee(val < (1U << nbits)) failed: Field too big for insn"
+# occurring, when it is built with recent versions of clang.
+LLVM_VER=	12
+BUILD_DEPENDS+=	clang${LLVM_VER}:devel/llvm${LLVM_VER}
+CC=		${LOCALBASE}/bin/clang${LLVM_VER}
+CXX=		${LOCALBASE}/bin/clang++${LLVM_VER}
+.endif
 .endif
 
 # GCC is broken with PCH: https://lists.freebsd.org/pipermail/svn-src-all/2015-March/101722.html