Skip to content

Commit

Permalink
Added Debian patches and hotspot target build
Browse files Browse the repository at this point in the history
  • Loading branch information
arnebjarne committed Feb 19, 2023
1 parent 0d7d78a commit 79c239d
Show file tree
Hide file tree
Showing 32 changed files with 1,997 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cross/java-17-openjdk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ CONFIGURE_ARGS += --with-libjpeg=system
CONFIGURE_ARGS += --with-giflib=system
CONFIGURE_ARGS += --with-libpng=system
CONFIGURE_ARGS += --with-lcms=system
CONFIGURE_ARGS += --with-alsa=$(INSTALL_DIR)/$(INSTALL_PREFIX)
CONFIGURE_ARGS += --with-stdc++lib=dynamic
CONFIGURE_ARGS += --disable-javac-server
CONFIGURE_ARGS += --disable-warnings-as-errors
Expand All @@ -73,6 +74,7 @@ CONFIGURE_ARGS += --with-cacerts-file=/etc/ssl/certs/ca-certificates.crt
CONFIGURE_ARGS += --with-cacerts-src=/etc/ssl/certs
# Disable all GUI related
CONFIGURE_ARGS += --enable-headless-only
CONFIGURE_ARGS += --with-jvm-variants=server

# arguments not taken from environment
CONFIGURE_ARGS += READELF=$(READELF)
Expand All @@ -82,15 +84,16 @@ CONFIGURE_ARGS += NM=$(NM)
CONFIGURE_ARGS += OBJCOPY=$(OBJCOPY)
CONFIGURE_ARGS += OBJDUMP=$(OBJDUMP)

# Build images twice, second time with newly built JDK
COMPILE_MAKE_OPTIONS += product-images
# Just build the hotspot version
COMPILE_MAKE_OPTIONS += hotspot-server

ADDITIONAL_CFLAGS = -O2

# Filter out any -jN since java's configure will autodetect number of CPU's
# Use make JOBS=N to set number of CPU's in this package
DISABLE_PARALLEL_MAKE = 1
COMPILE_MAKE_OPTIONS += JOBS=$(NCPUS)
PATCHES_LEVEL = 1

include ../../mk/spksrc.cross-cc.mk

Expand Down
11 changes: 11 additions & 0 deletions cross/java-17-openjdk/patches/002.hotspot-mips-align.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/src/hotspot/cpu/zero/zeroInterpreter_zero.cpp
+++ b/src/hotspot/cpu/zero/zeroInterpreter_zero.cpp
@@ -418,7 +418,7 @@ int ZeroInterpreter::native_entry(Method
ThreadStateTransition::transition_from_java(thread, _thread_in_native);

// Make the call
- intptr_t result[4 - LogBytesPerWord];
+ intptr_t result[4 - LogBytesPerWord] __attribute__((__aligned__(__alignof__(double))));
ffi_call(handler->cif(), (void (*)()) function, result, arguments);

// Change the thread state back to _thread_in_Java and ensure it
12 changes: 12 additions & 0 deletions cross/java-17-openjdk/patches/003.icc_loading_with_symlink.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java
+++ b/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java
@@ -1327,9 +1327,6 @@ public class ICC_Profile implements Seri
dir = st.nextToken();
fullPath = dir + File.separatorChar + fileName;
f = new File(fullPath);
- if (!isChildOf(f, dir)) {
- f = null;
- }
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Index: b/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java
===================================================================
--- a/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java
@@ -1260,6 +1260,7 @@ class XWindowPeer extends XPanelPeer imp

boolean isOverrideRedirect() {
return XWM.getWMID() == XWM.OPENLOOK_WM ||
+ XWM.getWMID() == XWM.COMPIZ_WM ||
Window.Type.POPUP.equals(getWindowType());
}

54 changes: 54 additions & 0 deletions cross/java-17-openjdk/patches/005.libpcsclite-dlopen.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
--- a/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java
+++ b/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java
@@ -46,6 +46,7 @@ class PlatformPCSC {

private final static String PROP_NAME = "sun.security.smartcardio.library";

+ private final static String LIB0 = "libpcsclite.so.1";
private final static String LIB1 = "/usr/$LIBISA/libpcsclite.so";
private final static String LIB2 = "/usr/local/$LIBISA/libpcsclite.so";
private final static String PCSC_FRAMEWORK = "/System/Library/Frameworks/PCSC.framework/Versions/Current/PCSC";
@@ -98,40 +99,9 @@ class PlatformPCSC {
if (lib.length() != 0) {
return lib;
}
- lib = expand(LIB1);
- if (new File(lib).isFile()) {
- // if LIB1 exists, use that
- return lib;
- }
- lib = expand(LIB2);
- if (new File(lib).isFile()) {
- // if LIB2 exists, use that
- return lib;
- }
-
- // As of macos 11, framework libraries have been removed from the file
- // system, but in such a way that they can still be dlopen()ed, even
- // though they can no longer be open()ed.
- //
- // https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_0_1-release-notes
- //
- // """New in macOS Big Sur 11.0.1, the system ships with a built-in
- // dynamic linker cache of all system-provided libraries. As part of
- // this change, copies of dynamic libraries are no longer present on
- // the filesystem. Code that attempts to check for dynamic library
- // presence by looking for a file at a path or enumerating a directory
- // will fail. Instead, check for library presence by attempting to
- // dlopen() the path, which will correctly check for the library in the
- // cache."""
- //
- // The directory structure remains otherwise intact, so check for
- // existence of the containing directory instead of the file.
- lib = PCSC_FRAMEWORK;
- if (new File(lib).getParentFile().isDirectory()) {
- // if PCSC.framework exists, use that
- return lib;
- }
- throw new IOException("No PC/SC library found on this system");
+ // let dlopen do the work
+ lib = LIB0;
+ return lib;
}

private static native void initialize(String libraryName);
23 changes: 23 additions & 0 deletions cross/java-17-openjdk/patches/006.default-jvm-cfg.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- a/src/java.base/share/native/libjli/java.c
+++ b/src/java.base/share/native/libjli/java.c
@@ -1997,7 +1997,7 @@
ReadKnownVMs(const char *jvmCfgName, jboolean speculative)
{
FILE *jvmCfg;
- char line[MAXPATHLEN+20];
+ char line[MAXPATHLEN+30];
int cnt = 0;
int lineno = 0;
jlong start = 0, end = 0;
@@ -2012,6 +2012,11 @@

jvmCfg = fopen(jvmCfgName, "r");
if (jvmCfg == NULL) {
+ char cfgName[strlen(jvmCfgName)+10];
+ sprintf(cfgName, "%s-default", jvmCfgName);
+ jvmCfg = fopen(cfgName, "r");
+ }
+ if (jvmCfg == NULL) {
if (!speculative) {
JLI_ReportErrorMessage(CFG_ERROR6, jvmCfgName);
exit(1);
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
@@ -651,7 +651,7 @@
* updates (JDK-8023956).
*/
void os::workaround_expand_exec_shield_cs_limit() {
-#if defined(IA32)
+#if defined(IA32) && !defined(ZERO)
assert(Linux::initial_thread_stack_bottom() != NULL, "sanity");
size_t page_size = os::vm_page_size();

22 changes: 22 additions & 0 deletions cross/java-17-openjdk/patches/008.adlc-parser.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# DP: fixes an uninitialized memory issue in adlc
--- a/src/hotspot/share/adlc/formsopt.cpp
+++ b/src/hotspot/share/adlc/formsopt.cpp
@@ -436,6 +436,10 @@
//==============================Frame Handling=================================
//------------------------------FrameForm--------------------------------------
FrameForm::FrameForm() {
+ _sync_stack_slots = NULL;
+ _inline_cache_reg = NULL;
+ _interpreter_frame_pointer_reg = NULL;
+ _cisc_spilling_operand_name = NULL;
_frame_pointer = NULL;
_c_frame_pointer = NULL;
_alignment = NULL;
@@ -444,7 +448,6 @@
_varargs_C_out_slots_killed = NULL;
_return_value = NULL;
_c_return_value = NULL;
- _interpreter_frame_pointer_reg = NULL;
}

FrameForm::~FrameForm() {
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# HG changeset patch
# User andrew
# Date 1352129932 0
# Node ID e9c857dcb964dbfa5eef3a3590244cb4d999cf7a
# Parent 1406789608b76d0906881979335d685855f44190
Allow multiple PKCS11 library initialisation to be a non-critical error.

--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java
@@ -52,6 +52,7 @@
static final int ERR_HALT = 1;
static final int ERR_IGNORE_ALL = 2;
static final int ERR_IGNORE_LIB = 3;
+ static final int ERR_IGNORE_MULTI_INIT = 4;

// same as allowSingleThreadedModules but controlled via a system property
// and applied to all providers. if set to false, no SunPKCS11 instances
@@ -1023,6 +1024,8 @@
handleStartupErrors = ERR_IGNORE_LIB;
} else if (val.equals("halt")) {
handleStartupErrors = ERR_HALT;
+ } else if (val.equals("ignoreMultipleInitialisation")) {
+ handleStartupErrors = ERR_IGNORE_MULTI_INIT;
} else {
throw excToken("Invalid value for handleStartupErrors:");
}
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java
@@ -179,26 +179,37 @@
String nssLibraryDirectory = config.getNssLibraryDirectory();
String nssSecmodDirectory = config.getNssSecmodDirectory();
boolean nssOptimizeSpace = config.getNssOptimizeSpace();
+ int errorHandling = config.getHandleStartupErrors();

if (secmod.isInitialized()) {
if (nssSecmodDirectory != null) {
String s = secmod.getConfigDir();
if ((s != null) &&
(s.equals(nssSecmodDirectory) == false)) {
- throw new ProviderException("Secmod directory "
- + nssSecmodDirectory
- + " invalid, NSS already initialized with "
- + s);
+ String msg = "Secmod directory " + nssSecmodDirectory
+ + " invalid, NSS already initialized with " + s;
+ if (errorHandling == Config.ERR_IGNORE_MULTI_INIT ||
+ errorHandling == Config.ERR_IGNORE_ALL) {
+ throw new UnsupportedOperationException(msg);
+ } else {
+ throw new ProviderException(msg);
+ }
}
}
if (nssLibraryDirectory != null) {
String s = secmod.getLibDir();
if ((s != null) &&
(s.equals(nssLibraryDirectory) == false)) {
- throw new ProviderException("NSS library directory "
+ String msg = "NSS library directory "
+ nssLibraryDirectory
+ " invalid, NSS already initialized with "
- + s);
+ + s;
+ if (errorHandling == Config.ERR_IGNORE_MULTI_INIT ||
+ errorHandling == Config.ERR_IGNORE_ALL) {
+ throw new UnsupportedOperationException(msg);
+ } else {
+ throw new ProviderException(msg);
+ }
}
}
} else {
12 changes: 12 additions & 0 deletions cross/java-17-openjdk/patches/010.s390x-opt.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/make/autoconf/flags-cflags.m4
+++ b/make/autoconf/flags-cflags.m4
@@ -735,6 +735,9 @@
fi
elif test "x$FLAGS_CPU" = xs390x; then
$1_CFLAGS_CPU="-mbackchain -march=z10"
+ if test "x$VENDOR_FLAGS_CPU" != x; then
+ $1_CFLAGS_CPU="-mbackchain $VENDOR_FLAGS_CPU"
+ fi
fi

if test "x$FLAGS_CPU_ARCH" != xarm && test "x$FLAGS_CPU_ARCH" != xppc; then
Loading

0 comments on commit 79c239d

Please sign in to comment.