0001-fix-gcc-10-support.patch 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. From 58911e9de888aece29f491995a8b8a31f7d6b424 Mon Sep 17 00:00:00 2001
  2. From: Patrick Zhang <patrick.zhang@amperecomputing.com>
  3. Date: Wed, 05 Feb 2020 17:14:15 -0700
  4. Subject: [PATCH] fix gcc 10 support
  5. This patch fixes the "multiple definition" link errors with GCC10 due to
  6. GCC10 setting -fno-common by default.
  7. This is a combination of the following upstream commits:
  8. - https://hg.openjdk.java.net/jdk/jdk/rev/8e6fa89397ca
  9. - https://hg.openjdk.java.net/jdk/jdk/rev/6925fca95959
  10. - https://hg.openjdk.java.net/jdk/jdk/rev/9e54ea7d9cd9
  11. Signed-off-by: Patrick Zhang <patrick.zhang@amperecomputing.com>
  12. Signed-off-by: Adam Duskett <Aduskett@gmail.com>
  13. ---
  14. src/java.base/unix/native/libjava/childproc.c | 1 +
  15. src/java.base/unix/native/libjava/childproc.h | 2 +-
  16. .../share/native/libj2gss/NativeFunc.c | 3 +++
  17. .../share/native/libj2gss/NativeFunc.h | 2 +-
  18. src/jdk.sctp/unix/native/libsctp/Sctp.h | 12 ++++++------
  19. src/jdk.sctp/unix/native/libsctp/SctpNet.c | 7 +++++++
  20. 6 files changed, 19 insertions(+), 8 deletions(-)
  21. diff --git a/src/java.base/unix/native/libjava/childproc.c b/src/java.base/unix/native/libjava/childproc.c
  22. index 811aaeac5..16480bfbf 100644
  23. --- a/src/java.base/unix/native/libjava/childproc.c
  24. +++ b/src/java.base/unix/native/libjava/childproc.c
  25. @@ -34,6 +34,7 @@
  26. #include "childproc.h"
  27. +const char * const *parentPathv;
  28. ssize_t
  29. restartableWrite(int fd, const void *buf, size_t count)
  30. diff --git a/src/java.base/unix/native/libjava/childproc.h b/src/java.base/unix/native/libjava/childproc.h
  31. index 091150930..d57e44b6e 100644
  32. --- a/src/java.base/unix/native/libjava/childproc.h
  33. +++ b/src/java.base/unix/native/libjava/childproc.h
  34. @@ -126,7 +126,7 @@ typedef struct _SpawnInfo {
  35. * The cached and split version of the JDK's effective PATH.
  36. * (We don't support putenv("PATH=...") in native code)
  37. */
  38. -const char * const *parentPathv;
  39. +extern const char * const *parentPathv;
  40. ssize_t restartableWrite(int fd, const void *buf, size_t count);
  41. int restartableDup2(int fd_from, int fd_to);
  42. diff --git a/src/java.security.jgss/share/native/libj2gss/NativeFunc.c b/src/java.security.jgss/share/native/libj2gss/NativeFunc.c
  43. index da7bc0445..5941f7b5a 100644
  44. --- a/src/java.security.jgss/share/native/libj2gss/NativeFunc.c
  45. +++ b/src/java.security.jgss/share/native/libj2gss/NativeFunc.c
  46. @@ -27,6 +27,9 @@
  47. #include <stdlib.h>
  48. #include "NativeFunc.h"
  49. +/* global GSS function table */
  50. +GSS_FUNCTION_TABLE_PTR ftab;
  51. +
  52. /* standard GSS method names (ordering is from mapfile) */
  53. static const char RELEASE_NAME[] = "gss_release_name";
  54. static const char IMPORT_NAME[] = "gss_import_name";
  55. diff --git a/src/java.security.jgss/share/native/libj2gss/NativeFunc.h b/src/java.security.jgss/share/native/libj2gss/NativeFunc.h
  56. index 82914387c..e4a4981a3 100644
  57. --- a/src/java.security.jgss/share/native/libj2gss/NativeFunc.h
  58. +++ b/src/java.security.jgss/share/native/libj2gss/NativeFunc.h
  59. @@ -277,6 +277,6 @@ typedef struct GSS_FUNCTION_TABLE {
  60. typedef GSS_FUNCTION_TABLE *GSS_FUNCTION_TABLE_PTR;
  61. /* global GSS function table */
  62. -GSS_FUNCTION_TABLE_PTR ftab;
  63. +extern GSS_FUNCTION_TABLE_PTR ftab;
  64. #endif
  65. diff --git a/src/jdk.sctp/unix/native/libsctp/Sctp.h b/src/jdk.sctp/unix/native/libsctp/Sctp.h
  66. index cc1367f78..46b07db0a 100644
  67. --- a/src/jdk.sctp/unix/native/libsctp/Sctp.h
  68. +++ b/src/jdk.sctp/unix/native/libsctp/Sctp.h
  69. @@ -322,12 +322,12 @@ typedef int sctp_peeloff_func(int sock, sctp_assoc_t id);
  70. #endif /* __linux__ */
  71. -sctp_getladdrs_func* nio_sctp_getladdrs;
  72. -sctp_freeladdrs_func* nio_sctp_freeladdrs;
  73. -sctp_getpaddrs_func* nio_sctp_getpaddrs;
  74. -sctp_freepaddrs_func* nio_sctp_freepaddrs;
  75. -sctp_bindx_func* nio_sctp_bindx;
  76. -sctp_peeloff_func* nio_sctp_peeloff;
  77. +extern sctp_getladdrs_func* nio_sctp_getladdrs;
  78. +extern sctp_freeladdrs_func* nio_sctp_freeladdrs;
  79. +extern sctp_getpaddrs_func* nio_sctp_getpaddrs;
  80. +extern sctp_freepaddrs_func* nio_sctp_freepaddrs;
  81. +extern sctp_bindx_func* nio_sctp_bindx;
  82. +extern sctp_peeloff_func* nio_sctp_peeloff;
  83. jboolean loadSocketExtensionFuncs(JNIEnv* env);
  84. diff --git a/src/jdk.sctp/unix/native/libsctp/SctpNet.c b/src/jdk.sctp/unix/native/libsctp/SctpNet.c
  85. index d40c15aa3..ab9b6e093 100644
  86. --- a/src/jdk.sctp/unix/native/libsctp/SctpNet.c
  87. +++ b/src/jdk.sctp/unix/native/libsctp/SctpNet.c
  88. @@ -43,6 +43,13 @@ static jmethodID isaCtrID = 0;
  89. static const char* nativeSctpLib = "libsctp.so.1";
  90. static jboolean funcsLoaded = JNI_FALSE;
  91. +sctp_getladdrs_func* nio_sctp_getladdrs;
  92. +sctp_freeladdrs_func* nio_sctp_freeladdrs;
  93. +sctp_getpaddrs_func* nio_sctp_getpaddrs;
  94. +sctp_freepaddrs_func* nio_sctp_freepaddrs;
  95. +sctp_bindx_func* nio_sctp_bindx;
  96. +sctp_peeloff_func* nio_sctp_peeloff;
  97. +
  98. JNIEXPORT jint JNICALL DEF_JNI_OnLoad
  99. (JavaVM *vm, void *reserved) {
  100. return JNI_VERSION_1_2;
  101. --
  102. 2.26.2