RFR: 8244853 - The static build of libextnet is missing the JNI_OnLoad_extnet function

Bob Vandette bob.vandette at oracle.com
Tue May 12 18:46:41 UTC 2020


BUG:

https://bugs.openjdk.java.net/browse/JDK-8244853

Please review this simple fix for JDK 15 which adds the required JNI_OnLoad_extnet function to the libextnet.a
static library when it is built.

the JDK 15 make static-libs-image target currently builds this static library but it is not spec compliant and
causes the GraalVM native-image utility to fail generating executables due to the lack of the OnLoad symbol.


CHANGE:

diff --git a/src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c b/src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c
--- a/src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c
+++ b/src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c
@@ -34,6 +34,11 @@
 #include "jdk_net_LinuxSocketOptions.h"
 
 /*
+ * Declare library specific JNI_Onload entry if static build
+ */
+DEF_STATIC_JNI_OnLoad
+
+/*
  * Class:     jdk_net_LinuxSocketOptions
  * Method:    setQuickAck
  * Signature: (II)V
diff --git a/src/jdk.net/macosx/native/libextnet/MacOSXSocketOptions.c b/src/jdk.net/macosx/native/libextnet/MacOSXSocketOptions.c
--- a/src/jdk.net/macosx/native/libextnet/MacOSXSocketOptions.c
+++ b/src/jdk.net/macosx/native/libextnet/MacOSXSocketOptions.c
@@ -32,6 +32,11 @@
 #include <netinet/in.h>
 #include "jni_util.h"
 
+/*
+ * Declare library specific JNI_Onload entry if static build
+ */
+DEF_STATIC_JNI_OnLoad
+
 static jint socketOptionSupported(jint sockopt) {
     jint one = 1;
     jint rv, s;
diff --git a/src/jdk.net/solaris/native/libextnet/SolarisSocketOptions.c b/src/jdk.net/solaris/native/libextnet/SolarisSocketOptions.c
--- a/src/jdk.net/solaris/native/libextnet/SolarisSocketOptions.c
+++ b/src/jdk.net/solaris/native/libextnet/SolarisSocketOptions.c
@@ -32,6 +32,11 @@
 static int initialized = 0;
 
 /*
+ * Declare library specific JNI_Onload entry if static build
+ */
+DEF_STATIC_JNI_OnLoad
+
+/*
  * Class:     jdk_net_SolarisSocketOptions
  * Method:    init
  * Signature: ()V


More information about the core-libs-dev mailing list