diff --git a/common/shlibs b/common/shlibs index 57e4623cbeb..69babe7cf7b 100644 --- a/common/shlibs +++ b/common/shlibs @@ -1797,6 +1797,12 @@ libawt_xawt.so openjdk7-bootstrap-7u221b02_1 libjava.so openjdk7-bootstrap-7u221b02_1 libjli.so openjdk7-bootstrap-7u221b02_1 libjvm.so openjdk7-bootstrap-7u221b02_1 +libjawt.so openjdk9-bootstrap-9.0.4p12_1 +libawt.so openjdk9-bootstrap-9.0.4p12_1 +libawt_xawt.so openjdk9-bootstrap-9.0.4p12_1 +libjava.so openjdk9-bootstrap-9.0.4p12_1 +libjli.so openjdk9-bootstrap-9.0.4p12_1 +libjvm.so openjdk9-bootstrap-9.0.4p12_1 libucl.so.5 libucl-0.8.1_1 libhandle.so.1 xfsprogs-3.2.1_1 libnfnetlink.so.0 libnfnetlink-1.0.1_1 diff --git a/srcpkgs/openjdk9-bootstrap/INSTALL.msg b/srcpkgs/openjdk9-bootstrap/INSTALL.msg new file mode 100644 index 00000000000..f33a40ba677 --- /dev/null +++ b/srcpkgs/openjdk9-bootstrap/INSTALL.msg @@ -0,0 +1,4 @@ +This is a bootstrap compiler, which means it's not intended for ordinary usage +but rather only to compile the toolchain. In this case, it's the OpenJDK 10 +toolchain, which needs OpenJDK 9 or newer to build itself. Please do not use +this package as your Java implementation. diff --git a/srcpkgs/openjdk9-bootstrap/files/musl_001_build.patch b/srcpkgs/openjdk9-bootstrap/files/musl_001_build.patch new file mode 100644 index 00000000000..a67d7167ebf --- /dev/null +++ b/srcpkgs/openjdk9-bootstrap/files/musl_001_build.patch @@ -0,0 +1,540 @@ +--- old/common/autoconf/build-aux/config.guess ++++ new/common/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/hotspot/make/lib/CompileJvm.gmk ++++ new/hotspot/make/lib/CompileJvm.gmk +@@ -135,6 +135,7 @@ + -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \ + -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \ + -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \ ++ -DLIBC='"musl"' \ + # + + # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. +--- old/hotspot/src/os/linux/vm/os_linux.cpp ++++ new/hotspot/src/os/linux/vm/os_linux.cpp +@@ -98,7 +98,6 @@ + # include + # include + # include +-# include + # include + # include + # include +@@ -496,6 +495,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) +@@ -513,6 +517,7 @@ + str = (char *)malloc(n, mtInternal); + confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n); + os::Linux::set_libpthread_version(str); ++#endif + } + + ///////////////////////////////////////////////////////////////////////////// +@@ -2803,17 +2808,32 @@ + 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); ++} ++ + // If we are running with libnuma version > 2, then we should + // be trying to use symbols with versions 1.1 + // If we are running with earlier version, which did not have symbol versions, + // we should use the base version. + 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"); + } + + bool os::Linux::libnuma_init() { +--- old/hotspot/src/os/linux/vm/os_linux.inline.hpp ++++ new/hotspot/src/os/linux/vm/os_linux.inline.hpp +@@ -31,7 +31,7 @@ + + #include + #include +-#include ++#include + #include + + // File names are case-sensitive on windows only +--- old/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp ++++ new/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +@@ -73,7 +73,6 @@ + # include + # include + # include +-# include + + #ifdef AMD64 + #define REG_SP REG_RSP +--- old/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp ++++ new/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp +@@ -1017,7 +1017,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/hotspot/src/share/vm/runtime/vm_version.cpp ++++ new/hotspot/src/share/vm/runtime/vm_version.cpp +@@ -263,7 +263,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/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp ++++ new/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp +@@ -216,7 +216,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/hotspot/test/runtime/StackGuardPages/exeinvoke.c ++++ new/hotspot/test/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; +@@ -254,13 +269,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"); +@@ -273,7 +294,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"); +--- old/jdk/make/lib/CoreLibraries.gmk ++++ new/jdk/make/lib/CoreLibraries.gmk +@@ -339,6 +339,7 @@ + endif + + LIBJLI_CFLAGS += $(addprefix -I, $(LIBJLI_SRC_DIRS)) ++LIBJLI_CFLAGS += -DLIBC=\"musl\" + + ifneq ($(USE_EXTERNAL_LIBZ), true) + LIBJLI_CFLAGS += $(ZLIB_CPPFLAGS) +--- old/jdk/src/java.base/linux/native/libnet/linux_close.c ++++ new/jdk/src/java.base/linux/native/libnet/linux_close.c +@@ -58,7 +58,7 @@ + /* + * Signal to unblock thread + */ +-static int sigWakeup = (__SIGRTMAX - 2); ++static int sigWakeup; + + /* + * fdTable holds one entry per file descriptor, up to a certain +@@ -147,6 +147,7 @@ + /* + * Setup the signal handler + */ ++ sigWakeup = SIGRTMAX - 2; + sa.sa_handler = sig_wakeup; + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); +--- old/jdk/src/java.base/unix/native/include/jvm_md.h ++++ new/jdk/src/java.base/unix/native/include/jvm_md.h +@@ -65,7 +65,7 @@ + #include + #include + #include +-#include ++#include + + /* O Flags */ + +--- old/jdk/src/java.base/unix/native/libjava/childproc.c ++++ new/jdk/src/java.base/unix/native/libjava/childproc.c +@@ -237,7 +237,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/jdk/src/java.base/unix/native/libjava/jdk_util_md.h ++++ new/jdk/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/jdk/src/java.base/unix/native/libjli/java_md_solinux.c ++++ new/jdk/src/java.base/unix/native/libjli/java_md_solinux.c +@@ -241,6 +241,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/jdk/src/java.base/unix/native/libnet/net_util_md.h ++++ new/jdk/src/java.base/unix/native/libnet/net_util_md.h +@@ -27,7 +27,7 @@ + #define NET_UTILS_MD_H + + #include +-#include ++#include + #include + + /************************************************************************ +--- old/jdk/src/java.base/unix/native/libnio/ch/NativeThread.c ++++ new/jdk/src/java.base/unix/native/libnio/ch/NativeThread.c +@@ -36,7 +36,7 @@ + #include + #include + /* Also defined in net/linux_close.c */ +- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2) ++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2) + #elif _AIX + #include + #include +--- old/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c ++++ new/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c +@@ -27,9 +27,6 @@ + #include + #include + #include +-#ifdef __linux__ +-#include +-#endif + + #include + #include +@@ -786,26 +783,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/jdk/test/java/lang/ProcessBuilder/Basic.java ++++ new/jdk/test/java/lang/ProcessBuilder/Basic.java +@@ -391,8 +391,8 @@ + if (failed != 0) throw new Error("null PATH"); + } else if (action.equals("PATH search algorithm")) { + equal(System.getenv("PATH"), "dir1:dir2:"); +- check(new File("/bin/true").exists()); +- check(new File("/bin/false").exists()); ++ check(new File(TrueExe.path()).exists()); ++ check(new File(FalseExe.path()).exists()); + String[] cmd = {"prog"}; + ProcessBuilder pb1 = new ProcessBuilder(cmd); + ProcessBuilder pb2 = new ProcessBuilder(cmd); +@@ -433,13 +433,13 @@ + checkPermissionDenied(pb); + + // continue searching if EACCES +- copy("/bin/true", "dir2/prog"); ++ copy(TrueExe.path(), "dir2/prog"); + equal(run(pb).exitValue(), True.exitValue()); + new File("dir1/prog").delete(); + new File("dir2/prog").delete(); + + new File("dir2/prog").mkdirs(); +- copy("/bin/true", "dir1/prog"); ++ copy(TrueExe.path(), "dir1/prog"); + equal(run(pb).exitValue(), True.exitValue()); + + // Check empty PATH component means current directory. +@@ -455,10 +455,10 @@ + pb.command(command); + File prog = new File("./prog"); + // "Normal" binaries +- copy("/bin/true", "./prog"); ++ copy(TrueExe.path(), "./prog"); + equal(run(pb).exitValue(), + True.exitValue()); +- copy("/bin/false", "./prog"); ++ copy(FalseExe.path(), "./prog"); + equal(run(pb).exitValue(), + False.exitValue()); + prog.delete(); +@@ -513,12 +513,12 @@ + new File("dir2/prog").delete(); + new File("prog").delete(); + new File("dir3").mkdirs(); +- copy("/bin/true", "dir1/prog"); +- copy("/bin/false", "dir3/prog"); ++ copy(TrueExe.path(), "dir1/prog"); ++ copy(FalseExe.path(), "dir3/prog"); + pb.environment().put("PATH","dir3"); + equal(run(pb).exitValue(), True.exitValue()); +- copy("/bin/true", "dir3/prog"); +- copy("/bin/false", "dir1/prog"); ++ copy(TrueExe.path(), "dir3/prog"); ++ copy(FalseExe.path(), "dir1/prog"); + equal(run(pb).exitValue(), False.exitValue()); + + } finally { +@@ -615,6 +615,13 @@ + new File("/bin/false").exists()); + } + ++ static class BusyBox { ++ public static boolean is() { return is; } ++ private static final boolean is = ++ (! Windows.is() && ++ new File("/bin/busybox").exists()); ++ } ++ + static class UnicodeOS { + public static boolean is() { return is; } + private static final String osName = System.getProperty("os.name"); +@@ -653,6 +660,45 @@ + } + } + ++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox. ++ // Some tests copy /bin/true and /bin/false to files with a different filename. ++ // However, copying the busbox executable into a file with a different name ++ // won't result in the expected return codes. As workaround, we create ++ // executable files that can be copied and produce the exepected return ++ // values. We use this workaround, if we find the busybox executable. ++ ++ private static class TrueExe { ++ public static String path() { return path; } ++ private static final String path = path0(); ++ private static String path0(){ ++ if (!BusyBox.is()) { ++ return "/bin/true"; ++ } ++ else { ++ File trueExe = new File("true"); ++ setFileContents(trueExe, "#!/bin/true\n"); ++ trueExe.setExecutable(true); ++ return trueExe.getAbsolutePath(); ++ } ++ } ++ } ++ ++ private static class FalseExe { ++ public static String path() { return path; } ++ private static final String path = path0(); ++ private static String path0(){ ++ if (!BusyBox.is()) { ++ return "/bin/false"; ++ } ++ else { ++ File falseExe = new File("false"); ++ setFileContents(falseExe, "#!/bin/false\n"); ++ falseExe.setExecutable(true); ++ return falseExe.getAbsolutePath(); ++ } ++ } ++ } ++ + static class EnglishUnix { + private static final Boolean is = + (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL")); +@@ -1956,7 +2002,7 @@ + //---------------------------------------------------------------- + try { + new File("suBdiR").mkdirs(); +- copy("/bin/true", "suBdiR/unliKely"); ++ copy(TrueExe.path(), "suBdiR/unliKely"); + final ProcessBuilder pb = + new ProcessBuilder(new String[]{"unliKely"}); + pb.environment().put("PATH", "suBdiR"); +--- old/jdk/test/java/lang/ProcessHandle/InfoTest.java ++++ new/jdk/test/java/lang/ProcessHandle/InfoTest.java +@@ -293,7 +293,14 @@ + } + if (info.command().isPresent()) { + String command = info.command().get(); +- String expected = Platform.isWindows() ? "sleep.exe" : "sleep"; ++ String expected = "sleep"; ++ if (Platform.isWindows()) { ++ expected = "sleep.exe"; ++ } else if (new File("/bin/busybox").exists()) { ++ // With busybox sleep is just a sym link to busybox. ++ // The busbox executable is seen as ProcessHandle.Info command. ++ expected = "busybox"; ++ } + Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" + + expected + "\', actual: " + command); + +--- old/make/ReleaseFile.gmk ++++ new/make/ReleaseFile.gmk +@@ -50,6 +50,7 @@ + $(call info-file-item, "IMPLEMENTOR", "$(COMPANY_NAME)") + $(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 diff --git a/srcpkgs/openjdk9-bootstrap/files/musl_002_aarch64.patch b/srcpkgs/openjdk9-bootstrap/files/musl_002_aarch64.patch new file mode 100644 index 00000000000..d5b794d7713 --- /dev/null +++ b/srcpkgs/openjdk9-bootstrap/files/musl_002_aarch64.patch @@ -0,0 +1,10 @@ +--- old/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp ++++ new/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp +@@ -77,7 +77,6 @@ + # include + # include + # include +-# include + + #ifdef BUILTIN_SIM + #define REG_SP REG_RSP diff --git a/srcpkgs/openjdk9-bootstrap/files/musl_003_arm.patch b/srcpkgs/openjdk9-bootstrap/files/musl_003_arm.patch new file mode 100644 index 00000000000..157168a5017 --- /dev/null +++ b/srcpkgs/openjdk9-bootstrap/files/musl_003_arm.patch @@ -0,0 +1,29 @@ +--- old/hotspot/src/os_cpu/linux_arm/vm/os_linux_arm.cpp ++++ new/hotspot/src/os_cpu/linux_arm/vm/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/openjdk9-bootstrap/files/musl_004_ppc.patch b/srcpkgs/openjdk9-bootstrap/files/musl_004_ppc.patch new file mode 100644 index 00000000000..d9a10ab694a --- /dev/null +++ b/srcpkgs/openjdk9-bootstrap/files/musl_004_ppc.patch @@ -0,0 +1,22 @@ +--- openjdk.orig/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp ++++ openjdk/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp +@@ -80,7 +80,7 @@ + # include + # include + # include +- ++# include + + address os::current_stack_pointer() { + intptr_t* csp; +--- openjdk.orig/hotspot.orig/src/cpu/ppc/vm/macroAssembler_ppc.cpp ++++ openjdk/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp +@@ -46,6 +46,8 @@ + #include "gc_implementation/g1/heapRegion.hpp" + #endif + ++#include ++ + #ifdef PRODUCT + #define BLOCK_COMMENT(str) // nothing + #else diff --git a/srcpkgs/openjdk9-bootstrap/files/musl_005_x86.patch b/srcpkgs/openjdk9-bootstrap/files/musl_005_x86.patch new file mode 100644 index 00000000000..2ee42325df8 --- /dev/null +++ b/srcpkgs/openjdk9-bootstrap/files/musl_005_x86.patch @@ -0,0 +1,130 @@ +Only in old: build.patch +--- old/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp ++++ new/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +@@ -88,6 +88,126 @@ + #define SPELL_REG_FP "ebp" + #endif // AMD64 + ++// ============================================================================== ++// Taken from glibc 2.28 ++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b ++// ============================================================================== ++#ifndef AMD64 ++/* FPU control word bits. x86 version. ++ Copyright (C) 1993-2018 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ Contributed by Olaf Flebbe. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#ifndef _FPU_CONTROL_H ++#define _FPU_CONTROL_H 1 ++ ++/* Note that this file sets on x86-64 only the x87 FPU, it does not ++ touch the SSE unit. */ ++ ++/* Here is the dirty part. Set up your 387 through the control word ++ * (cw) register. ++ * ++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0 ++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM ++ * ++ * IM: Invalid operation mask ++ * DM: Denormalized operand mask ++ * ZM: Zero-divide mask ++ * OM: Overflow mask ++ * UM: Underflow mask ++ * PM: Precision (inexact result) mask ++ * ++ * Mask bit is 1 means no interrupt. ++ * ++ * PC: Precision control ++ * 11 - round to extended precision ++ * 10 - round to double precision ++ * 00 - round to single precision ++ * ++ * RC: Rounding control ++ * 00 - rounding to nearest ++ * 01 - rounding down (toward - infinity) ++ * 10 - rounding up (toward + infinity) ++ * 11 - rounding toward zero ++ * ++ * IC: Infinity control ++ * That is for 8087 and 80287 only. ++ * ++ * The hardware default is 0x037f which we use. ++ */ ++ ++#include ++ ++/* masking of interrupts */ ++#define _FPU_MASK_IM 0x01 ++#define _FPU_MASK_DM 0x02 ++#define _FPU_MASK_ZM 0x04 ++#define _FPU_MASK_OM 0x08 ++#define _FPU_MASK_UM 0x10 ++#define _FPU_MASK_PM 0x20 ++ ++/* precision control */ ++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */ ++#define _FPU_DOUBLE 0x200 ++#define _FPU_SINGLE 0x0 ++ ++/* rounding control */ ++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */ ++#define _FPU_RC_DOWN 0x400 ++#define _FPU_RC_UP 0x800 ++#define _FPU_RC_ZERO 0xC00 ++ ++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */ ++ ++ ++/* The fdlibm code requires strict IEEE double precision arithmetic, ++ and no interrupts for exceptions, rounding to nearest. */ ++ ++#define _FPU_DEFAULT 0x037f ++ ++/* IEEE: same as above. */ ++#define _FPU_IEEE 0x037f ++ ++/* Type of the control word. */ ++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); ++ ++/* Macros for accessing the hardware control word. "*&" is used to ++ work around a bug in older versions of GCC. __volatile__ is used ++ to support combination of writing the control register and reading ++ it back. Without __volatile__, the old value may be used for reading ++ back under compiler optimization. ++ ++ Note that the use of these macros is not sufficient anymore with ++ recent hardware nor on x86-64. Some floating point operations are ++ executed in the SSE/SSE2 engines which have their own control and ++ status register. */ ++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw)) ++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw)) ++ ++/* Default control word set at startup. */ ++extern fpu_control_t __fpu_control; ++ ++#endif /* fpu_control.h */ ++ ++#endif // AMD64 ++// ============================================================================== ++// ============================================================================== ++// ============================================================================== ++ + address os::current_stack_pointer() { + #ifdef SPARC_WORKS + register void *esp; diff --git a/srcpkgs/openjdk9-bootstrap/patches/zero-ppc32.patch b/srcpkgs/openjdk9-bootstrap/patches/zero-ppc32.patch new file mode 100644 index 00000000000..fe484c96f68 --- /dev/null +++ b/srcpkgs/openjdk9-bootstrap/patches/zero-ppc32.patch @@ -0,0 +1,20 @@ +This allows zero to build on ppc32 in release mode. +Upstream in jdk8/10/etc, but it never made it into 9. + +--- a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.hpp ++++ b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.hpp +@@ -38,10 +38,10 @@ + static void atomic_copy64(volatile void *src, volatile void *dst) { + #if defined(PPC32) + double tmp; +- asm volatile ("lfd %0, 0(%1)\n" +- "stfd %0, 0(%2)\n" +- : "=f"(tmp) +- : "b"(src), "b"(dst)); ++ asm volatile ("lfd %0, %2\n" ++ "stfd %0, %1\n" ++ : "=&f"(tmp), "=Q"(*(volatile double*)dst) ++ : "Q"(*(volatile double*)src)); + #elif defined(S390) && !defined(_LP64) + double tmp; + asm volatile ("ld %0, 0(%1)\n" diff --git a/srcpkgs/openjdk9-bootstrap/template b/srcpkgs/openjdk9-bootstrap/template new file mode 100644 index 00000000000..142b50f0dad --- /dev/null +++ b/srcpkgs/openjdk9-bootstrap/template @@ -0,0 +1,146 @@ +# Template file for 'openjdk9-bootstrap' +_jdk_build=12 +_final_jdk_home="usr/lib/jvm/java-9-openjdk" +pkgname=openjdk9-bootstrap +version="9.0.4p${_jdk_build}" +revision=1 +_repo_ver=${version/p/+} +wrksrc="jdk9u-jdk-${_repo_ver}" +build_style=gnu-configure +configure_args=" + --prefix=${XBPS_DESTDIR}/${pkgname}-${version}/usr/lib + --disable-warnings-as-errors + --with-zlib=system + --with-giflib=system + --with-libjpeg=system + --with-libpng=system + --with-lcms=system + --with-jtreg=no + --with-jobs=${XBPS_MAKEJOBS} + --enable-dtrace=no + --with-debug-level=release + --with-version-pre= + --with-version-build=${_jdk_build} + --with-boot-jdk=/usr/lib/jvm/java-1.8-openjdk" +make_build_args="images" +hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates + zlib-devel openjdk8" +makedepends="libXrender-devel libXtst-devel libXt-devel libXrandr-devel + giflib-devel libpng-devel libjpeg-turbo-devel lcms2-devel cups-devel + freetype-devel alsa-lib-devel fontconfig-devel zlib-devel" +short_desc="OpenJDK Java Development Kit (bootstrap version 9)" +maintainer="q66 " +license="GPL-2.0-or-later" +homepage="http://openjdk.java.net/" +distfiles=" + http://hg.openjdk.java.net/jdk-updates/jdk9u/archive/jdk-${_repo_ver}.tar.bz2>jdk-${_repo_ver}-root.tar.bz2 + http://hg.openjdk.java.net/jdk-updates/jdk9u/corba/archive/jdk-${_repo_ver}.tar.bz2>jdk-${_repo_ver}-corba.tar.bz2 + http://hg.openjdk.java.net/jdk-updates/jdk9u/hotspot/archive/jdk-${_repo_ver}.tar.bz2>jdk-${_repo_ver}-hotspot.tar.bz2 + http://hg.openjdk.java.net/jdk-updates/jdk9u/jaxp/archive/jdk-${_repo_ver}.tar.bz2>jdk-${_repo_ver}-jaxp.tar.bz2 + http://hg.openjdk.java.net/jdk-updates/jdk9u/jaxws/archive/jdk-${_repo_ver}.tar.bz2>jdk-${_repo_ver}-jaxws.tar.bz2 + http://hg.openjdk.java.net/jdk-updates/jdk9u/jdk/archive/jdk-${_repo_ver}.tar.bz2>jdk-${_repo_ver}-jdk.tar.bz2 + http://hg.openjdk.java.net/jdk-updates/jdk9u/langtools/archive/jdk-${_repo_ver}.tar.bz2>jdk-${_repo_ver}-langtools.tar.bz2 + http://hg.openjdk.java.net/jdk-updates/jdk9u/nashorn/archive/jdk-${_repo_ver}.tar.bz2>jdk-${_repo_ver}-nashorn.tar.bz2" + +checksum="914183a7eac6a1dfdfa70a98ceb4262244c77ab904c4570bb34c609ecb5f0986 + 3807400280a3b92e9dd23fcdd76482162ce54af6fbbaa0777cb6235ad6a66fea + e1da0455cb546666494d6a07f263f9af5dd2772c37d89db552dcae48339b9e2f + 0021cc00f8ebc35e5a2cc9e8ceffcaf1620499a6eb922937bf7bc0d44a49bab6 + d71476426c346cfc819f03521f3d3dc60cae9d5dd09e7e3d1d0f4990107d42a7 + b7e42590a81f0e3a681f663efe89cad4c1d7041700832d90b421bb2bbe7f2d1a + 9cba7f03ebeda4d3cfaffb015f9bf967fcca2c3c113604836073556df6a7b9aa + c939de46f903ecb283c02155e1415cee98ab66803e17eae0403c399c1a475647" + +# no hotspot JIT for arm32 and ppc32 +case "$XBPS_TARGET_MACHINE" in + ppc64*) ;; + arm*|ppc*) _use_zero=yes ;; +esac + +if [ -n "$_use_zero" ]; then + makedepends+=" libffi-devel" + configure_args+=" --with-jvm-variants=zero" + case "$XBPS_TARGET_MACHINE" in + ppc*) configure_args+=" --with-boot-jdk-jvmargs=-XX:ThreadStackSize=2560";; + esac +fi + +lib32disabled=yes +shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so" +patch_args="-Np1" +nocross=yes + +if [ -n "$XBPS_DEBUG_PKGS" ]; then + configure_args+=" --with-native-debug-symbols=internal" +fi + +# enabling ccache segfaults gcc +export CCACHE_DISABLE=1 + +post_extract() { + chmod +x configure + for subrepo in corba hotspot jdk jaxws jaxp langtools nashorn; do + mv ../${subrepo}-jdk-${_repo_ver} ${subrepo} + done + + if [ "$XBPS_TARGET_LIBC" = "musl" ]; then + rm -r hotspot/src/jdk.hotspot.agent + fi +} + +post_patch() { + [ "$XBPS_TARGET_LIBC" != "musl" ] && return 0 + + for f in ${FILESDIR}/musl_*.patch; do + echo "Applying $f" + patch -sNp1 -i "$f" + done +} + +do_configure() { + CFLAGS=${CFLAGS/-D_FORTIFY_SOURCE=2/} + CXXFLAGS=${CXXFLAGS/-D_FORTIFY_SOURCE=2/} + + # force ELFv2 for ppc64 just in case + case "$XBPS_TARGET_MACHINE" in + ppc64*) + CFLAGS+=" -DABI_ELFv2" + CXXFLAGS+=" -DABI_ELFv2" + ;; + esac + + configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/} + + # build system newly checks for ccache and dies if it finds it + # explicitly need full path as otherwise it will still resolve to ccache + export CC=/usr/bin/gcc + export CXX=/usr/bin/g++ + + ./configure ${configure_args} --with-extra-cflags="$CFLAGS" \ + --with-extra-cxxflags="$CXXFLAGS" --with-extra-ldflags="$LDFLAGS" +} + +pre_build() { + # only use modified flags as specified in configure + unset CFLAGS CXXFLAGS LDFLAGS +} + +do_build() { + # do not set disable_parallel_build in order to be able to read makejobs + make -j1 ${make_build_args} ${make_build_target} +} + +post_install() { + # we manage this ourselves + rm -rf ${DESTDIR}/usr/lib/bin + + # unify the install prefix + mv ${DESTDIR}/usr/lib/jvm/openjdk-${version%p*} ${DESTDIR}/${_final_jdk_home} + + # big and unnecessary + rm -f ${DESTDIR}/${_final_jdk_home}/lib/src.zip + + vlicense ASSEMBLY_EXCEPTION + vlicense LICENSE + vlicense ADDITIONAL_LICENSE_INFO +}