From a6570325388cc08713b6fcaebcee2d09160dd292 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Thu, 30 May 2024 00:59:27 -0400 Subject: [PATCH] openjdk16-bootstrap: fix check closes #50602 --- .../patches/FixNullPtrCast.patch | 73 +++++++++++++++++++ .../patches/fix-test-i686.patch | 17 +++++ .../patches/test-glibc2.34.patch | 33 +++++++++ srcpkgs/openjdk16-bootstrap/template | 4 +- 4 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/openjdk16-bootstrap/patches/FixNullPtrCast.patch create mode 100644 srcpkgs/openjdk16-bootstrap/patches/fix-test-i686.patch create mode 100644 srcpkgs/openjdk16-bootstrap/patches/test-glibc2.34.patch diff --git a/srcpkgs/openjdk16-bootstrap/patches/FixNullPtrCast.patch b/srcpkgs/openjdk16-bootstrap/patches/FixNullPtrCast.patch new file mode 100644 index 00000000000..ef31c433d70 --- /dev/null +++ b/srcpkgs/openjdk16-bootstrap/patches/FixNullPtrCast.patch @@ -0,0 +1,73 @@ +Subject: Fix cast errors with latest GCC (11.2) +Upstream: No +Author: Simon Frankenberger + +This patch fixes multiple casting errors reported by GCC 11.2 + +--- old/src/hotspot/share/oops/access.hpp ++++ new/src/hotspot/share/oops/access.hpp +@@ -294,8 +294,8 @@ + static inline void arraycopy(arrayOop src_obj, size_t src_offset_in_bytes, + arrayOop dst_obj, size_t dst_offset_in_bytes, + size_t length) { +- AccessT::arraycopy(src_obj, src_offset_in_bytes, reinterpret_cast(NULL), +- dst_obj, dst_offset_in_bytes, reinterpret_cast(NULL), ++ AccessT::arraycopy(src_obj, src_offset_in_bytes, static_cast(NULL), ++ dst_obj, dst_offset_in_bytes, static_cast(NULL), + length); + } + +@@ -303,7 +303,7 @@ + static inline void arraycopy_to_native(arrayOop src_obj, size_t src_offset_in_bytes, + T* dst, + size_t length) { +- AccessT::arraycopy(src_obj, src_offset_in_bytes, reinterpret_cast(NULL), ++ AccessT::arraycopy(src_obj, src_offset_in_bytes, static_cast(NULL), + NULL, 0, dst, + length); + } +@@ -313,15 +313,15 @@ + arrayOop dst_obj, size_t dst_offset_in_bytes, + size_t length) { + AccessT::arraycopy(NULL, 0, src, +- dst_obj, dst_offset_in_bytes, reinterpret_cast(NULL), ++ dst_obj, dst_offset_in_bytes, static_cast(NULL), + length); + } + + static inline bool oop_arraycopy(arrayOop src_obj, size_t src_offset_in_bytes, + arrayOop dst_obj, size_t dst_offset_in_bytes, + size_t length) { +- return AccessT::oop_arraycopy(src_obj, src_offset_in_bytes, reinterpret_cast(NULL), +- dst_obj, dst_offset_in_bytes, reinterpret_cast(NULL), ++ return AccessT::oop_arraycopy(src_obj, src_offset_in_bytes, static_cast(NULL), ++ dst_obj, dst_offset_in_bytes, static_cast(NULL), + length); + } + +--- old/src/hotspot/cpu/x86/interp_masm_x86.cpp ++++ new/src/hotspot/cpu/x86/interp_masm_x86.cpp +@@ -1122,7 +1122,7 @@ + + bind(loop); + // check if current entry is used +- cmpptr(Address(rmon, BasicObjectLock::obj_offset_in_bytes()), (int32_t) NULL); ++ cmpptr(Address(rmon, BasicObjectLock::obj_offset_in_bytes()), 0); + jcc(Assembler::notEqual, exception); + + addptr(rmon, entry_size); // otherwise advance to next entry +--- old/src/hotspot/cpu/x86/interpreterRT_x86_64.cpp ++++ new/src/hotspot/cpu/x86/interpreterRT_x86_64.cpp +@@ -443,10 +443,10 @@ + _from -= Interpreter::stackElementSize; + + if (_num_int_args < Argument::n_int_register_parameters_c-1) { +- *_int_args++ = (*from_addr == 0) ? NULL : (intptr_t)from_addr; ++ *_int_args++ = (*from_addr == 0) ? (intptr_t) 0 : (intptr_t) from_addr; + _num_int_args++; + } else { +- *_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr; ++ *_to++ = (*from_addr == 0) ? (intptr_t) 0 : (intptr_t) from_addr; + } + } + diff --git a/srcpkgs/openjdk16-bootstrap/patches/fix-test-i686.patch b/srcpkgs/openjdk16-bootstrap/patches/fix-test-i686.patch new file mode 100644 index 00000000000..7e4b8496bca --- /dev/null +++ b/srcpkgs/openjdk16-bootstrap/patches/fix-test-i686.patch @@ -0,0 +1,17 @@ +on i686, this test is rounded slightly differently, so the string comparison asserts +fail while the actual comparison succeeds + +--- a/test/hotspot/gtest/gc/shared/test_workerDataArray.cpp ++++ b/test/hotspot/gtest/gc/shared/test_workerDataArray.cpp +@@ -295,11 +295,3 @@ + TEST_VM_F(UninitializedDoubleElementWorkerDataArrayTest, average_test) { + ASSERT_NEAR(6.15 / MILLIUNITS, array.average(), epsilon); + } +- +-TEST_VM_F(UninitializedDoubleElementWorkerDataArrayTest, print_summary_on_test) { +- ASSERT_STREQ(print_expected_summary(), print_summary()); +-} +- +-TEST_VM_F(UninitializedDoubleElementWorkerDataArrayTest, print_details_on_test) { +- ASSERT_STREQ(print_expected_details(), print_details()); +-} diff --git a/srcpkgs/openjdk16-bootstrap/patches/test-glibc2.34.patch b/srcpkgs/openjdk16-bootstrap/patches/test-glibc2.34.patch new file mode 100644 index 00000000000..56c556eec86 --- /dev/null +++ b/srcpkgs/openjdk16-bootstrap/patches/test-glibc2.34.patch @@ -0,0 +1,33 @@ +From f77a1a156f3da9068d012d9227c7ee0fee58f571 Mon Sep 17 00:00:00 2001 +From: David Holmes +Date: Sun, 22 Aug 2021 01:13:27 +0000 +Subject: [PATCH] 8272472: StackGuardPages test doesn't build with glibc 2.34 + +Reviewed-by: shade, stuefe, jiefu +--- + .../jtreg/runtime/StackGuardPages/exeinvoke.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c b/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c +index a46f1cef44c78..50a37001fbf33 100644 +--- a/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c ++++ b/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c +@@ -68,8 +68,17 @@ static void handler(int sig, siginfo_t *si, void *unused) { + longjmp(context, 1); + } + ++static char* altstack = NULL; ++ + void set_signal_handler() { +- static char altstack[SIGSTKSZ]; ++ if (altstack == NULL) { ++ // Dynamically allocated in case SIGSTKSZ is not constant ++ altstack = malloc(SIGSTKSZ); ++ if (altstack == NULL) { ++ fprintf(stderr, "Test ERROR. Unable to malloc altstack space\n"); ++ exit(7); ++ } ++ } + + stack_t ss = { + .ss_size = SIGSTKSZ, diff --git a/srcpkgs/openjdk16-bootstrap/template b/srcpkgs/openjdk16-bootstrap/template index b73b590b0b0..059b9273170 100644 --- a/srcpkgs/openjdk16-bootstrap/template +++ b/srcpkgs/openjdk16-bootstrap/template @@ -1,7 +1,7 @@ # Template file for 'openjdk16-bootstrap' pkgname=openjdk16-bootstrap version=16.0.2+7 -revision=1 +revision=2 _java_ver="${version%%.*}" _jdk_update="${version#*+}" _base_version="${version%+*}" @@ -48,9 +48,11 @@ checksum="b4a0e71e41a11175e8a7c1dba86ed5b0aa878413158c8d48813db1b64ac9536c provides="java-environment-${version}_1 java-runtime-${version}_1" nocross=yes repository=bootstrap +patch_args="-Np1 --directory=$build_wrksrc" # Build is still parallel, but don't use -jN. disable_parallel_build=yes +disable_parallel_check=yes case "$XBPS_TARGET_MACHINE" in ppc64*) ;;