From 89c5ed654561fa490013001e7a40a0c78198978b Mon Sep 17 00:00:00 2001 From: Matt Brocklehurst Date: Sun, 11 Jan 2026 17:11:18 +0000 Subject: [PATCH] icedtea7-native: fix build regressions with GCC 14 Modern compilers (GCC 14+) promote several C warnings to errors by default, specifically -Wimplicit-function-declaration and -Wincompatible-pointer-types. This prevents IcedTea 2.1.3 from building on modern host distributions. Backport fixes to add missing includes and explicit casts in Hotspot and JDK native code. Signed-off-by: Matt Brocklehurst --- recipes-core/icedtea/icedtea7-native_2.1.3.bb | 4 + .../0001-fix-gcc14-compatibility.patch | 152 ++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 recipes-core/icedtea/openjdk/patches-openjdk-7/0001-fix-gcc14-compatibility.patch diff --git a/recipes-core/icedtea/icedtea7-native_2.1.3.bb b/recipes-core/icedtea/icedtea7-native_2.1.3.bb index df2b01b6..401eec20 100644 --- a/recipes-core/icedtea/icedtea7-native_2.1.3.bb +++ b/recipes-core/icedtea/icedtea7-native_2.1.3.bb @@ -34,3 +34,7 @@ SRC_URI[langtools.sha256sum] = "10fee41a0cdd1b166ff78e6426430c76af0f2358d026c181 OPENJDK_CHANGESET = "f89009ada191" SRC_URI[openjdk.md5sum] = "2bc941373ca4b033c9a25f972eec7858" SRC_URI[openjdk.sha256sum] = "5efd8e66f18fcbf45527bcc74aa3e6ed11f66bc793c88e3841925c4acb4827ba" + +FILESEXTRAPATHS:prepend := "${THISDIR}/openjdk/patches-openjdk-7:" +OPENJDK_PATCHES += "file://0001-fix-gcc14-compatibility.patch;apply=no;subdir=icedtea-2.1.3;striplevel=0" +DISTRIBUTION_PATCHES += "0001-fix-gcc14-compatibility.patch" diff --git a/recipes-core/icedtea/openjdk/patches-openjdk-7/0001-fix-gcc14-compatibility.patch b/recipes-core/icedtea/openjdk/patches-openjdk-7/0001-fix-gcc14-compatibility.patch new file mode 100644 index 00000000..e9929878 --- /dev/null +++ b/recipes-core/icedtea/openjdk/patches-openjdk-7/0001-fix-gcc14-compatibility.patch @@ -0,0 +1,152 @@ +From e35ea7b43c06ccd5638de1174641ef1320c0be4a Mon Sep 17 00:00:00 2001 +From: Matt Brocklehurst +Date: Sun, 11 Jan 2026 14:13:57 +0000 +Subject: [PATCH] jdk: fix GCC 14 compatibility regressions + +--- + openjdk/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c | 4 +++- + openjdk/hotspot/agent/src/os/linux/ps_proc.c | 1 + + openjdk/hotspot/agent/src/os/linux/salibelf.c | 1 + + openjdk/jdk/src/share/instrument/JarFacade.c | 2 +- + openjdk/jdk/src/share/native/sun/java2d/opengl/OGLContext.c | 1 + + openjdk/jdk/share/native/sun/security/jgss/wrapper/GSSLibStub.c | 11 ++++++----- + openjdk/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c | 2 +- + openjdk/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c | 2 +- + 8 files changed, 15 insertions(+), 9 deletions(-) + +diff --git openjdk/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c openjdk/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c +index 5771fdd5..46a46bac 100644 +--- openjdk/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c ++++ openjdk/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c +@@ -23,6 +23,7 @@ + */ + + #include ++#include + #include "libproc.h" + + #if defined(x86_64) && !defined(amd64) +@@ -73,7 +74,8 @@ JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_in + (JNIEnv *env, jclass cls) { + jclass listClass; + +- if (init_libproc(getenv("LIBSAPROC_DEBUG")) != true) { ++ if (init_libproc(getenv("LIBSAPROC_DEBUG") != NULL) != 1) ++ { + THROW_NEW_DEBUGGER_EXCEPTION("can't initialize libproc"); + } + +diff --git openjdk/hotspot/agent/src/os/linux/ps_proc.c openjdk/hotspot/agent/src/os/linux/ps_proc.c +index 676e88a4..98403724 100644 +--- openjdk/hotspot/agent/src/os/linux/ps_proc.c ++++ openjdk/hotspot/agent/src/os/linux/ps_proc.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + #include "libproc_impl.h" + + #if defined(x86_64) && !defined(amd64) +diff --git openjdk/hotspot/agent/src/os/linux/salibelf.c openjdk/hotspot/agent/src/os/linux/salibelf.c +index 9634da8b..4df53847 100644 +--- openjdk/hotspot/agent/src/os/linux/salibelf.c ++++ openjdk/hotspot/agent/src/os/linux/salibelf.c +@@ -24,6 +24,7 @@ + + #include "salibelf.h" + #include ++#include + #include + + extern void print_debug(const char*,...); +diff --git openjdk/jdk/src/share/instrument/JarFacade.c openjdk/jdk/src/share/instrument/JarFacade.c +index 07ae23c2..1472b8c6 100644 +--- openjdk/jdk/src/share/instrument/JarFacade.c ++++ openjdk/jdk/src/share/instrument/JarFacade.c +@@ -33,7 +33,7 @@ + #endif /* _WIN32 */ + #include + #include +- ++#include + #include "jni.h" + #include "manifest_info.h" + #include "JarFacade.h" +diff --git openjdk/jdk/src/share/native/sun/java2d/opengl/OGLContext.c openjdk/jdk/src/share/native/sun/java2d/opengl/OGLContext.c +index b9c60046..def48611 100644 +--- openjdk/jdk/src/share/native/sun/java2d/opengl/OGLContext.c ++++ openjdk/jdk/src/share/native/sun/java2d/opengl/OGLContext.c +@@ -37,6 +37,7 @@ + #include "OGLSurfaceData.h" + #include "GraphicsPrimitiveMgr.h" + #include "Region.h" ++#include "jvm.h" + + /** + * The following methods are implemented in the windowing system (i.e. GLX +diff --git openjdk/jdk/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c openjdk/jdk/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c +index fa888669..615ad8f0 100644 +--- openjdk/jdk/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c ++++ openjdk/jdk/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c +@@ -26,6 +26,7 @@ + #include "sun_security_jgss_wrapper_GSSLibStub.h" + #include "NativeUtil.h" + #include "NativeFunc.h" ++#include + + /* Constants for indicating what type of info is needed for inqueries */ + const int TYPE_CRED_NAME = 10; +@@ -97,10 +98,10 @@ Java_sun_security_jgss_wrapper_GSSLibStub_getMechPtr(JNIEnv *env, + (*env)->ReleaseByteArrayElements(env, jbytes, bytes, 0); + } + if (found != JNI_TRUE) { +- checkStatus(env, NULL, GSS_S_BAD_MECH, 0, "[GSSLibStub_getMechPtr]"); +- return NULL; +- } else return cOid; +- } else return GSS_C_NO_OID; ++ checkStatus(env, NULL, GSS_S_BAD_MECH, 0, "[GSSLibS/GSStub_getMechPtr]"); ++ return 0; ++ } else return (jlong)(uintptr_t) cOid; ++ } else return (jlong)(uintptr_t) GSS_C_NO_OID; + } + + +@@ -1184,7 +1185,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_deleteContext(JNIEnv *env, + sprintf(debugBuf, "[GSSLibStub_deleteContext] %ld", (long)contextHdl); + debug(env, debugBuf); + +- if (contextHdl == GSS_C_NO_CONTEXT) return GSS_C_NO_CONTEXT; ++ if (contextHdl == GSS_C_NO_CONTEXT) return 0; + + /* gss_delete_sec_context(...) => GSS_S_NO_CONTEXT(!) */ + major = (*ftab->deleteSecContext)(&minor, &contextHdl, GSS_C_NO_BUFFER); +diff --git openjdk/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c openjdk/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c +index fa75aa2d..ed329378 100644 +--- openjdk/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c ++++ openjdk/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c +@@ -216,7 +216,7 @@ Java_sun_awt_motif_XsessionWMcommand_New(JNIEnv *env, jobjectArray jargv) + + + #define REFLECT_VOID_FUNCTION(name, arglist, paramlist) \ +-typedef name##_type arglist; \ ++typedef void name ##_type arglist; \ + void name arglist \ + { \ + static name##_type *name##_ptr = NULL; \ +diff --git openjdk/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c openjdk/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c +index 9b3e7061..dcac18f5 100644 +--- openjdk/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c ++++ openjdk/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c +@@ -519,7 +519,7 @@ Java_sun_java2d_x11_X11SurfaceData_initSurface(JNIEnv *env, jclass xsd, + xsdo->cData = xsdo->configData->color_data; + + XShared_initSurface(env, xsdo, depth, width, height, drawable); +- xsdo->xrPic = NULL; ++ xsdo->xrPic = 0; + #endif /* !HEADLESS */ + } + +-- +2.52.0 +