Patrick,

> On 7 Feb 2020, at 08:44, Patrick Zhang OS <patr...@os.amperecomputing.com> 
> wrote:
> 
> Ping..

Pong ;-)

> Regards
> Patrick
> 
> -----Original Message-----
> From: net-dev <net-dev-boun...@openjdk.java.net> On Behalf Of Patrick Zhang OS
> Sent: Wednesday, February 5, 2020 8:19 PM
> To: Chris Hegarty <chris.hega...@oracle.com>; net-dev 
> <net-dev@openjdk.java.net>
> Subject: RE: RFR: JDK-8238386: (sctp) jdk.sctp/unix/native/libsctp/SctpNet.c 
> "multiple definition" link errors with GCC10
> 
> Thanks Chris
> 
> I extracted the SCTP code change from the original patch, for net-dev review 
> only. Could you please sponsor this? (I do not have push permission), thanks 
> in advance.
> 
> JBS: https://bugs.openjdk.java.net/browse/JDK-8238386
> Webrev: http://cr.openjdk.java.net/~qpzhang/8238386/webrev.01/

I was able to duplicate the "multiple definition of ..." warnings/errors
on my Ubuntu Linux with gcc 8.3 by explicitly specifying -fno-common,
temporarily locally patching Lib-jdk.sctp.gmk [*].

Looking at this again, maybe we can avoid the creation of a new Sctp.c
file to "house" these few definitions. How about we just move them to
SctpNet.?

$ hg diff src/jdk.sctp
diff --git a/src/jdk.sctp/unix/native/libsctp/Sctp.h 
b/src/jdk.sctp/unix/native/libsctp/Sctp.h
--- a/src/jdk.sctp/unix/native/libsctp/Sctp.h
+++ b/src/jdk.sctp/unix/native/libsctp/Sctp.h
@@ -322,13 +322,6 @@

 #endif /* __linux__ */

-sctp_getladdrs_func* nio_sctp_getladdrs;
-sctp_freeladdrs_func* nio_sctp_freeladdrs;
-sctp_getpaddrs_func* nio_sctp_getpaddrs;
-sctp_freepaddrs_func* nio_sctp_freepaddrs;
-sctp_bindx_func* nio_sctp_bindx;
-sctp_peeloff_func* nio_sctp_peeloff;
-
 jboolean loadSocketExtensionFuncs(JNIEnv* env);

 #endif /* !SUN_NIO_CH_SCTP_H */
diff --git a/src/jdk.sctp/unix/native/libsctp/SctpNet.c 
b/src/jdk.sctp/unix/native/libsctp/SctpNet.c
--- a/src/jdk.sctp/unix/native/libsctp/SctpNet.c
+++ b/src/jdk.sctp/unix/native/libsctp/SctpNet.c
@@ -43,6 +43,13 @@
 static const char* nativeSctpLib = "libsctp.so.1";
 static jboolean funcsLoaded = JNI_FALSE;

+sctp_getladdrs_func* nio_sctp_getladdrs;
+sctp_freeladdrs_func* nio_sctp_freeladdrs;
+sctp_getpaddrs_func* nio_sctp_getpaddrs;
+sctp_freepaddrs_func* nio_sctp_freepaddrs;
+sctp_bindx_func* nio_sctp_bindx;
+sctp_peeloff_func* nio_sctp_peeloff;
+
 JNIEXPORT jint JNICALL DEF_JNI_OnLoad
   (JavaVM *vm, void *reserved) {
     return JNI_VERSION_1_2;


-Chris.


[*] diff --git a/make/lib/Lib-jdk.sctp.gmk b/make/lib/Lib-jdk.sctp.gmk
    --- a/make/lib/Lib-jdk.sctp.gmk
    +++ b/make/lib/Lib-jdk.sctp.gmk
    @@ -33,7 +33,7 @@
         $(eval $(call SetupJdkLibrary, BUILD_LIBSCTP, \
             NAME := sctp, \
             OPTIMIZATION := LOW, \
    -        CFLAGS := $(CFLAGS_JDKLIB), \
    +        CFLAGS := -fno-common $(CFLAGS_JDKLIB), \
             DISABLED_WARNINGS_gcc := undef, \
             DISABLED_WARNINGS_clang := undef, \
             EXTRA_HEADER_DIRS := \


Reply via email to