From 010a49c7487156da4ca8c16b441451b93a0fe3f7 Mon Sep 17 00:00:00 2001 From: triallax Date: Sun, 25 Jun 2023 17:12:54 +0100 Subject: [PATCH] openjdk11: update to 11.0.20+7. --- .../files/musl_patches/8289477.patch | 35 -- .../files/musl_patches/aarch64.patch | 11 - .../openjdk11/files/musl_patches/arm.patch | 30 -- .../openjdk11/files/musl_patches/build.patch | 399 ------------------ srcpkgs/openjdk11/template | 8 +- 5 files changed, 4 insertions(+), 479 deletions(-) delete mode 100644 srcpkgs/openjdk11/files/musl_patches/8289477.patch delete mode 100644 srcpkgs/openjdk11/files/musl_patches/aarch64.patch delete mode 100644 srcpkgs/openjdk11/files/musl_patches/arm.patch delete mode 100644 srcpkgs/openjdk11/files/musl_patches/build.patch diff --git a/srcpkgs/openjdk11/files/musl_patches/8289477.patch b/srcpkgs/openjdk11/files/musl_patches/8289477.patch deleted file mode 100644 index 57ac4866b578..000000000000 --- a/srcpkgs/openjdk11/files/musl_patches/8289477.patch +++ /dev/null @@ -1,35 +0,0 @@ -From da6d1fc0e0aeb1fdb504aced4b0dba0290ec240f Mon Sep 17 00:00:00 2001 -From: Thomas Stuefe -Date: Thu, 30 Jun 2022 06:19:25 +0000 -Subject: [PATCH] 8289477: Memory corruption with CPU_ALLOC, CPU_FREE on muslc - -Reviewed-by: dholmes, clanger ---- - src/hotspot/os/linux/os_linux.cpp | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp -index 726926218907..8ee10e201c69 100644 ---- a/src/hotspot/os/linux/os_linux.cpp -+++ b/src/hotspot/os/linux/os_linux.cpp -@@ -4591,7 +4591,8 @@ static int _cpu_count(const cpu_set_t* cpus) { - // dynamic check - see 6515172 for details. - // If anything goes wrong we fallback to returning the number of online - // processors - which can be greater than the number available to the process. --int os::Linux::active_processor_count() { -+static int get_active_processor_count() { -+ // Note: keep this function, with its CPU_xx macros, *outside* the os namespace (see JDK-8289477). - cpu_set_t cpus; // can represent at most 1024 (CPU_SETSIZE) processors - cpu_set_t* cpus_p = &cpus; - int cpus_size = sizeof(cpu_set_t); -@@ -4663,6 +4664,10 @@ int os::Linux::active_processor_count() { - return cpu_count; - } - -+int os::Linux::active_processor_count() { -+ return get_active_processor_count(); -+} -+ - // Determine the active processor count from one of - // three different sources: - // diff --git a/srcpkgs/openjdk11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk11/files/musl_patches/aarch64.patch deleted file mode 100644 index b95f455e926d..000000000000 --- a/srcpkgs/openjdk11/files/musl_patches/aarch64.patch +++ /dev/null @@ -1,11 +0,0 @@ -Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280 ---- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp -+++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp -@@ -77,7 +77,6 @@ - # include - # include - # include --# include - - #ifdef BUILTIN_SIM - #define REG_SP REG_RSP diff --git a/srcpkgs/openjdk11/files/musl_patches/arm.patch b/srcpkgs/openjdk11/files/musl_patches/arm.patch deleted file mode 100644 index 12d0022c1491..000000000000 --- a/srcpkgs/openjdk11/files/musl_patches/arm.patch +++ /dev/null @@ -1,30 +0,0 @@ -Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280 ---- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp -+++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp -@@ -71,7 +71,6 @@ - # include - # include - # include --# include - # include - - #define SPELL_REG_SP "sp" -@@ -104,6 +103,18 @@ - #define ARM_REGS_IN_CONTEXT 31 - - #else -+ -+// Stupid hack as the origin if below doesnt compile with gcc 8.2.0: -+// -+// os_linux_arm.cpp:114:5: error: missing binary operator before token "(" -+// #if NGREG == 16 -+// ^~~~~ -+// -+// The NGREG is 18, so force it to that value. -+#ifdef NGREG -+# undef NGREG -+#endif -+#define NGREG 18 - - #if NGREG == 16 - // These definitions are based on the observation that until diff --git a/srcpkgs/openjdk11/files/musl_patches/build.patch b/srcpkgs/openjdk11/files/musl_patches/build.patch deleted file mode 100644 index ec8a248d2ad3..000000000000 --- a/srcpkgs/openjdk11/files/musl_patches/build.patch +++ /dev/null @@ -1,399 +0,0 @@ -Subject: Fix compilation issues with musl libc -Upstream: No -Author: The portola team at https://openjdk.java.net/projects/portola/ - With modifications by Simon Frankenberger - -This giant patch makes it possible to compile openjdk with musl libc. -The base was taken from a diff with the portola project and adjusted for latest musl libc. - ---- old/make/ReleaseFile.gmk -+++ new/make/ReleaseFile.gmk -@@ -53,6 +53,7 @@ - $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)") - $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)") - $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)") -+ $(call info-file-item, "LIBC", "musl") - 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 -@@ -79,6 +79,7 @@ - -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \ - -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \ - -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \ -+ -DLIBC='"musl"' \ - # - - ################################################################################ ---- old/make/lib/CoreLibraries.gmk -+++ new/make/lib/CoreLibraries.gmk -@@ -219,6 +219,7 @@ - endif - - LIBJLI_CFLAGS += $(LIBZ_CFLAGS) -+LIBJLI_CFLAGS += -DLIBC=\"musl\" - - ifneq ($(USE_EXTERNAL_LIBZ), true) - LIBJLI_EXTRA_FILES += \ ---- old/src/hotspot/os/linux/os_linux.cpp -+++ new/src/hotspot/os/linux/os_linux.cpp -@@ -101,7 +101,6 @@ - # include - # include - # include --# include - # include - # include - # include -@@ -594,6 +593,11 @@ - // detecting pthread library - - void os::Linux::libpthread_init() { -+#if !defined(__GLIBC__) && !defined(__UCLIBC__) -+ // Hard code Alpine Linux supported musl compatible settings -+ os::Linux::set_glibc_version("glibc 2.9"); -+ os::Linux::set_libpthread_version("NPTL"); -+#else - // Save glibc and pthread version strings. - #if !defined(_CS_GNU_LIBC_VERSION) || \ - !defined(_CS_GNU_LIBPTHREAD_VERSION) -@@ -611,6 +615,7 @@ - str = (char *)malloc(n, mtInternal); - confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n); - os::Linux::set_libpthread_version(str); -+#endif - } - - ///////////////////////////////////////////////////////////////////////////// -@@ -3109,20 +3114,36 @@ - extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { } - extern "C" JNIEXPORT void numa_error(char *where) { } - -+static void* dlvsym_if_available(void* handle, const char* name, const char* version) { -+ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version); -+ static dlvsym_func_type dlvsym_func; -+ static bool initialized = false; -+ -+ if (!initialized) { -+ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym"); -+ initialized = true; -+ } -+ -+ if (dlvsym_func != NULL) { -+ void *f = dlvsym_func(handle, name, version); -+ if (f != NULL) { -+ return f; -+ } -+ } -+ -+ return dlsym(handle, name); -+} -+ - // Handle request to load libnuma symbol version 1.1 (API v1). If it fails - // load symbol from base version instead. - void* os::Linux::libnuma_dlsym(void* handle, const char *name) { -- void *f = dlvsym(handle, name, "libnuma_1.1"); -- if (f == NULL) { -- f = dlsym(handle, name); -- } -- return f; -+ return dlvsym_if_available(handle, name, "libnuma_1.1"); - } - - // Handle request to load libnuma symbol version 1.2 (API v2) only. - // Return NULL if the symbol is not defined in this particular version. - void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) { -- return dlvsym(handle, name, "libnuma_1.2"); -+ return dlvsym_if_available(handle, name, "libnuma_1.2"); - } - - bool os::Linux::libnuma_init() { ---- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp -+++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp -@@ -75,9 +75,6 @@ - # include - # include - # include --#ifndef AMD64 --# include --#endif - - #ifdef AMD64 - #define REG_SP REG_RSP ---- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp -+++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp -@@ -1144,7 +1144,7 @@ - static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) { - bool first = true; - size_t min_size = 0; // "first" makes this conceptually infinite. -- ScratchBlock **smallest_ptr, *smallest; -+ ScratchBlock **smallest_ptr = NULL, *smallest; - ScratchBlock *cur = *prev_ptr; - while (cur) { - assert(*prev_ptr == cur, "just checking"); ---- old/src/hotspot/share/runtime/abstract_vm_version.cpp -+++ new/src/hotspot/share/runtime/abstract_vm_version.cpp -@@ -266,7 +266,7 @@ - #endif - - #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \ -- " for " OS "-" CPU FLOAT_ARCH_STR \ -+ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \ - " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \ - " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER - ---- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp -+++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp -@@ -204,7 +204,7 @@ - #elif defined(__APPLE__) - inline int g_isnan(double f) { return isnan(f); } - #elif defined(LINUX) || defined(_ALLBSD_SOURCE) --inline int g_isnan(float f) { return isnanf(f); } -+inline int g_isnan(float f) { return isnan(f); } - inline int g_isnan(double f) { return isnan(f); } - #else - #error "missing platform-specific definition here" ---- old/src/java.base/linux/native/libnet/linux_close.c -+++ new/src/java.base/linux/native/libnet/linux_close.c -@@ -60,7 +60,7 @@ - /* - * Signal to unblock thread - */ --static int sigWakeup = (__SIGRTMAX - 2); -+static int sigWakeup; - - /* - * fdTable holds one entry per file descriptor, up to a certain -@@ -149,6 +149,7 @@ - /* - * Setup the signal handler - */ -+ sigWakeup = SIGRTMAX - 2; - sa.sa_handler = sig_wakeup; - sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); ---- old/src/java.base/unix/native/libjava/childproc.c -+++ new/src/java.base/unix/native/libjava/childproc.c -@@ -238,7 +238,13 @@ - { - if (envp == NULL || (char **) envp == environ) { - execvp(file, (char **) argv); -- return; -+ // ENOEXEC indicates that the file header was not recognized. The musl C -+ // library does not implement the fallback to /bin/sh for that case, so fall -+ // through to the code below which implements that fallback using -+ // execve_with_shell_fallback. -+ if (errno != ENOEXEC) { -+ return; -+ } - } - - if (*file == '\0') { ---- old/src/java.base/unix/native/libjava/jdk_util_md.h -+++ new/src/java.base/unix/native/libjava/jdk_util_md.h -@@ -37,7 +37,7 @@ - #define ISNAND(d) isnan(d) - #elif defined(__linux__) || defined(_ALLBSD_SOURCE) - #include --#define ISNANF(f) isnanf(f) -+#define ISNANF(f) isnan(f) - #define ISNAND(d) isnan(d) - #elif defined(_AIX) - #include ---- old/src/java.base/unix/native/libjli/java_md_solinux.c -+++ new/src/java.base/unix/native/libjli/java_md_solinux.c -@@ -236,6 +236,39 @@ - char *dmllp = NULL; - char *p; /* a utility pointer */ - -+#ifdef __linux -+#ifndef LIBC -+#error "LIBC not set" -+#endif -+ -+ if (strcmp(LIBC, "musl") == 0) { -+ /* -+ * The musl library loader requires LD_LIBRARY_PATH to be set in -+ * order to correctly resolve the dependency libjava.so has on libjvm.so. -+ * -+ * Specifically, it differs from glibc in the sense that even if -+ * libjvm.so has already been loaded it will not be considered a -+ * candidate for resolving the dependency unless the *full* path -+ * of the already loaded library matches the dependency being loaded. -+ * -+ * libjvm.so is being loaded by the launcher using a long path to -+ * dlopen, not just the basename of the library. Typically this -+ * is something like "../lib/server/libjvm.so". However, if/when -+ * libjvm.so later tries to dlopen libjava.so (which it does in -+ * order to get access to a few functions implemented in -+ * libjava.so) the musl loader will, as part of loading -+ * dependent libraries, try to load libjvm.so using only its -+ * basename "libjvm.so". Since this does not match the longer -+ * path path it was first loaded with, the already loaded -+ * library is not considered a candidate, and the loader will -+ * instead look for libjvm.so elsewhere. If it's not in -+ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so -+ * will therefore fail as well. -+ */ -+ return JNI_TRUE; -+ } -+#endif -+ - #ifdef AIX - /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */ - return JNI_TRUE; ---- old/src/java.base/unix/native/libnio/ch/NativeThread.c -+++ new/src/java.base/unix/native/libnio/ch/NativeThread.c -@@ -36,7 +36,7 @@ - #ifdef __linux__ - #include - /* Also defined in net/linux_close.c */ -- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2) -+ #define INTERRUPT_SIGNAL (SIGRTMAX - 2) - #elif _AIX - #include - /* Also defined in net/aix_close.c */ ---- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c -+++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c -@@ -27,9 +27,6 @@ - #include - #include - #include --#ifdef __linux__ --#include --#endif - - #include - #include -@@ -783,26 +780,6 @@ - } - return ret; - } -- --#ifdef __linux__ --void print_stack(void) --{ -- void *array[10]; -- size_t size; -- char **strings; -- size_t i; -- -- size = backtrace (array, 10); -- strings = backtrace_symbols (array, size); -- -- fprintf (stderr, "Obtained %zd stack frames.\n", size); -- -- for (i = 0; i < size; i++) -- fprintf (stderr, "%s\n", strings[i]); -- -- free (strings); --} --#endif - - Window get_xawt_root_shell(JNIEnv *env) { - static jclass classXRootWindow = NULL; ---- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h -+++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h -@@ -35,15 +35,15 @@ - #ifdef DEBUG - /* Just to make sure these interfaces are not used here. */ - #undef free -- #define free(p) Do not use this interface. -+ #define free do_not_use_this_interface_free - #undef malloc -- #define malloc(p) Do not use this interface. -+ #define malloc do_not_use_this_interface_malloc - #undef calloc -- #define calloc(p) Do not use this interface. -+ #define calloc do_not_use_this_interface_calloc - #undef realloc -- #define realloc(p) Do not use this interface. -+ #define realloc do_not_use_this_interface_realloc - #undef strdup -- #define strdup(p) Do not use this interface. -+ #define strdup do_not_use_this_interface_strdup - #endif - - #include "log_messages.h" ---- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c -+++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c -@@ -33,6 +33,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -91,6 +92,20 @@ - } - } - -+int get_java_stacksize () { -+ size_t stacksize; -+ pthread_attr_t attr; -+ JDK1_1InitArgs jdk_args; -+ -+ jdk_args.version = JNI_VERSION_1_1; -+ JNI_GetDefaultJavaVMInitArgs(&jdk_args); -+ if (jdk_args.javaStackSize <= 0) { -+ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n"); -+ exit(7); -+ } -+ return jdk_args.javaStackSize; -+} -+ - void *run_java_overflow (void *p) { - JNIEnv *env; - jclass class_id; -@@ -258,13 +273,19 @@ - exit(7); - } - -+ int stack_size = get_java_stacksize(); - pthread_t thr; -+ pthread_attr_t thread_attr; - -+ pthread_attr_init(&thread_attr); -+ pthread_attr_setstacksize(&thread_attr, stack_size); -+ - if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) { - printf("\nTesting JAVA_OVERFLOW\n"); - - printf("Testing stack guard page behaviour for other thread\n"); -- pthread_create (&thr, NULL, run_java_overflow, NULL); -+ -+ pthread_create (&thr, &thread_attr, run_java_overflow, NULL); - pthread_join (thr, NULL); - - printf("Testing stack guard page behaviour for initial thread\n"); -@@ -277,7 +298,7 @@ - printf("\nTesting NATIVE_OVERFLOW\n"); - - printf("Testing stack guard page behaviour for other thread\n"); -- pthread_create (&thr, NULL, run_native_overflow, NULL); -+ pthread_create (&thr, &thread_attr, run_native_overflow, NULL); - pthread_join (thr, NULL); - - printf("Testing stack guard page behaviour for initial thread\n"); diff --git a/srcpkgs/openjdk11/template b/srcpkgs/openjdk11/template index e0d7ba7fb632..9d7c0ee6bf03 100644 --- a/srcpkgs/openjdk11/template +++ b/srcpkgs/openjdk11/template @@ -1,7 +1,7 @@ # Template file for 'openjdk11' pkgname=openjdk11 -version=11.0.12+7 -revision=3 +version=11.0.20+7 +revision=1 _java_ver="${version%%.*}" _jdk_home="usr/lib/jvm/openjdk${_java_ver}" archs="x86_64* i686* aarch64* armv7* ppc64*" @@ -37,7 +37,7 @@ maintainer="Kyle Nusbaum " license="GPL-2.0-only WITH Classpath-exception-2.0" homepage="http://openjdk.java.net/" distfiles="https://github.com/openjdk/jdk${_java_ver}u/archive/jdk-${version}.tar.gz" -checksum=9a37c9641b45f5c51fe19c1ccae141daeb5dcdbd59fa2f56e7dea7bf09484bec +checksum=33f559f4223a4403fab31448473009a27d032dd2085fa655c49b9b6bcffe1728 provides="java-environment-${version}_1" # Build is still parallel, but don't use -jN. @@ -221,7 +221,7 @@ openjdk11-static-libs_package() { openjdk11-jmods_package() { short_desc+=" - JMODs" - depends="${pkgname}-${version}_${revision}" + depends="${sourcepkg}-${version}_${revision}" pkg_install() { vmove $_jdk_home/jmods }