summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré Draszik <andre.draszik@jci.com>2018-03-06 11:01:53 +0200
committerMaxin B. John <maxin.john@intel.com>2018-03-06 11:03:09 +0200
commit3668ba76f44bc778ba4446236088c22948a644d0 (patch)
treecc3291774f0e41350f22a1e5e0196e08f14500a3
parentf8be3065f7c5dbd73516394c0bcd2c7ba1777abf (diff)
downloadmeta-java-3668ba76f44bc778ba4446236088c22948a644d0.tar.gz
openjdk-8: fix musl build
Add various patches to make it work in musl. Some of them are generic enough to be applied for all builds, some need to be specific to musl. Signed-off-by: André Draszik <andre.draszik@jci.com> Signed-off-by: Maxin B. John <maxin.john@intel.com>
-rw-r--r--recipes-core/openjdk/openjdk-8-release-162b12.inc16
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/0001-jdk-comparison-between-pointer-and-integer.patch2
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/0002-hotspot-fix-compilation-with-security-flags-enabled.patch2
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/0003-jdk-Allow-using-a-system-installed-libjpeg.patch2
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/0004-jdk-Allow-using-a-system-installed-libpng.patch2
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/0005-hotspot-use-correct-include-for-poll.patch85
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/0006-hotspot-don-t-rely-on-old-SysV-SIGCLD.patch41
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/0007-jdk-use-correct-include-for-poll.patch172
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/0008-jdk-use-correct-include-for-signal.patch89
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/0009-jdk-disable-backtrace-musl-build-fix.patch45
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/musl-0001-hotspot-stop-using-obsolete-isnanf.patch42
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/musl-0002-jdk-give-a-much-bigger-buffer-to-getmntent_r.patch103
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/musl-0003-jdk-fix-libjvm-load-on-musl-set-LD_LIBRARY_PATH.patch37
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/musl-0004-jdk-remove-sysctl.h-include-musl-build-fix.patch90
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build.patch88
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies.patch75
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/musl-0007-hotspot-os_linux_x86-remove-glibc-dependencies-fpu_c.patch46
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/musl-0008-jdk-musl-build-fix-use-SIGRTMAX-rather-than-__SIGRTM.patch69
-rw-r--r--recipes-core/openjdk/patches-openjdk-8/musl-0009-jdk-musl-has-gethostby_r.patch35
19 files changed, 1037 insertions, 4 deletions
diff --git a/recipes-core/openjdk/openjdk-8-release-162b12.inc b/recipes-core/openjdk/openjdk-8-release-162b12.inc
index d672148..dc1e023 100644
--- a/recipes-core/openjdk/openjdk-8-release-162b12.inc
+++ b/recipes-core/openjdk/openjdk-8-release-162b12.inc
@@ -10,6 +10,11 @@ PATCHES_URI = "\
10 file://0002-hotspot-fix-compilation-with-security-flags-enabled.patch \ 10 file://0002-hotspot-fix-compilation-with-security-flags-enabled.patch \
11 file://0003-jdk-Allow-using-a-system-installed-libjpeg.patch \ 11 file://0003-jdk-Allow-using-a-system-installed-libjpeg.patch \
12 file://0004-jdk-Allow-using-a-system-installed-libpng.patch \ 12 file://0004-jdk-Allow-using-a-system-installed-libpng.patch \
13 file://0005-hotspot-use-correct-include-for-poll.patch \
14 file://0006-hotspot-don-t-rely-on-old-SysV-SIGCLD.patch \
15 file://0007-jdk-use-correct-include-for-poll.patch \
16 file://0008-jdk-use-correct-include-for-signal.patch \
17 file://0009-jdk-disable-backtrace-musl-build-fix.patch \
13" 18"
14# some patches extracted from http://cr.openjdk.java.net/~rkennke/shark-build-hotspot/webrev.01/hotspot.patch 19# some patches extracted from http://cr.openjdk.java.net/~rkennke/shark-build-hotspot/webrev.01/hotspot.patch
15# reported via http://mail.openjdk.java.net/pipermail/build-dev/2015-January/013972.html 20# reported via http://mail.openjdk.java.net/pipermail/build-dev/2015-January/013972.html
@@ -23,6 +28,17 @@ PATCHES_URI_append_class-target = "\
23 file://openjdk8-add-missing-linker-flags.patch;striplevel=0 \ 28 file://openjdk8-add-missing-linker-flags.patch;striplevel=0 \
24 file://openjdk8-fix-libpng-neon-build.patch;striplevel=0 \ 29 file://openjdk8-fix-libpng-neon-build.patch;striplevel=0 \
25" 30"
31PATCHES_URI_append_libc-musl = "\
32 file://musl-0001-hotspot-stop-using-obsolete-isnanf.patch \
33 file://musl-0002-jdk-give-a-much-bigger-buffer-to-getmntent_r.patch \
34 file://musl-0003-jdk-fix-libjvm-load-on-musl-set-LD_LIBRARY_PATH.patch \
35 file://musl-0004-jdk-remove-sysctl.h-include-musl-build-fix.patch \
36 file://musl-0005-hotspot-disable-agent-build.patch \
37 file://musl-0006-hotspot-os_linux-remove-glibc-dependencies.patch \
38 file://musl-0007-hotspot-os_linux_x86-remove-glibc-dependencies-fpu_c.patch \
39 file://musl-0008-jdk-musl-build-fix-use-SIGRTMAX-rather-than-__SIGRTM.patch \
40 file://musl-0009-jdk-musl-has-gethostby_r.patch \
41"
26 42
27# Name of the directory containing the compiled output 43# Name of the directory containing the compiled output
28BUILD_DIR = "openjdk.build" 44BUILD_DIR = "openjdk.build"
diff --git a/recipes-core/openjdk/patches-openjdk-8/0001-jdk-comparison-between-pointer-and-integer.patch b/recipes-core/openjdk/patches-openjdk-8/0001-jdk-comparison-between-pointer-and-integer.patch
index 29a30d6..b310598 100644
--- a/recipes-core/openjdk/patches-openjdk-8/0001-jdk-comparison-between-pointer-and-integer.patch
+++ b/recipes-core/openjdk/patches-openjdk-8/0001-jdk-comparison-between-pointer-and-integer.patch
@@ -1,7 +1,7 @@
1From 97d6911fb581f9e44785db29abbf97ce77713f50 Mon Sep 17 00:00:00 2001 1From 97d6911fb581f9e44785db29abbf97ce77713f50 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com> 2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com>
3Date: Fri, 2 Mar 2018 11:13:08 +0000 3Date: Fri, 2 Mar 2018 11:13:08 +0000
4Subject: [PATCH 1/8] jdk: comparison between pointer and integer 4Subject: [PATCH 1/9] jdk: comparison between pointer and integer
5MIME-Version: 1.0 5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8 6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit 7Content-Transfer-Encoding: 8bit
diff --git a/recipes-core/openjdk/patches-openjdk-8/0002-hotspot-fix-compilation-with-security-flags-enabled.patch b/recipes-core/openjdk/patches-openjdk-8/0002-hotspot-fix-compilation-with-security-flags-enabled.patch
index 075a638..dcadea1 100644
--- a/recipes-core/openjdk/patches-openjdk-8/0002-hotspot-fix-compilation-with-security-flags-enabled.patch
+++ b/recipes-core/openjdk/patches-openjdk-8/0002-hotspot-fix-compilation-with-security-flags-enabled.patch
@@ -1,7 +1,7 @@
1From bdea8cf299313388ec41ea20281deca6dc4f764d Mon Sep 17 00:00:00 2001 1From bdea8cf299313388ec41ea20281deca6dc4f764d Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>> 2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Tue, 27 Feb 2018 14:41:06 +0000 3Date: Tue, 27 Feb 2018 14:41:06 +0000
4Subject: [PATCH 2/8] hotspot: fix compilation with security flags enabled 4Subject: [PATCH 2/9] hotspot: fix compilation with security flags enabled
5MIME-Version: 1.0 5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8 6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit 7Content-Transfer-Encoding: 8bit
diff --git a/recipes-core/openjdk/patches-openjdk-8/0003-jdk-Allow-using-a-system-installed-libjpeg.patch b/recipes-core/openjdk/patches-openjdk-8/0003-jdk-Allow-using-a-system-installed-libjpeg.patch
index a40e11f..e189278 100644
--- a/recipes-core/openjdk/patches-openjdk-8/0003-jdk-Allow-using-a-system-installed-libjpeg.patch
+++ b/recipes-core/openjdk/patches-openjdk-8/0003-jdk-Allow-using-a-system-installed-libjpeg.patch
@@ -1,7 +1,7 @@
1From a6746c1ee43a63e79b5405e40c463d00160bc02e Mon Sep 17 00:00:00 2001 1From a6746c1ee43a63e79b5405e40c463d00160bc02e Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com> 2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com>
3Date: Tue, 27 Feb 2018 13:36:53 +0000 3Date: Tue, 27 Feb 2018 13:36:53 +0000
4Subject: [PATCH 3/8] jdk: Allow using a system-installed libjpeg 4Subject: [PATCH 3/9] jdk: Allow using a system-installed libjpeg
5MIME-Version: 1.0 5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8 6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit 7Content-Transfer-Encoding: 8bit
diff --git a/recipes-core/openjdk/patches-openjdk-8/0004-jdk-Allow-using-a-system-installed-libpng.patch b/recipes-core/openjdk/patches-openjdk-8/0004-jdk-Allow-using-a-system-installed-libpng.patch
index af00bef..658ba32 100644
--- a/recipes-core/openjdk/patches-openjdk-8/0004-jdk-Allow-using-a-system-installed-libpng.patch
+++ b/recipes-core/openjdk/patches-openjdk-8/0004-jdk-Allow-using-a-system-installed-libpng.patch
@@ -1,7 +1,7 @@
1From 549100e3e687d2c844eeebe22a7dcbf7ed50406e Mon Sep 17 00:00:00 2001 1From 549100e3e687d2c844eeebe22a7dcbf7ed50406e Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com> 2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com>
3Date: Tue, 27 Feb 2018 13:43:04 +0000 3Date: Tue, 27 Feb 2018 13:43:04 +0000
4Subject: [PATCH 4/8] jdk: Allow using a system-installed libpng 4Subject: [PATCH 4/9] jdk: Allow using a system-installed libpng
5MIME-Version: 1.0 5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8 6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit 7Content-Transfer-Encoding: 8bit
diff --git a/recipes-core/openjdk/patches-openjdk-8/0005-hotspot-use-correct-include-for-poll.patch b/recipes-core/openjdk/patches-openjdk-8/0005-hotspot-use-correct-include-for-poll.patch
new file mode 100644
index 0000000..8b3420e
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/0005-hotspot-use-correct-include-for-poll.patch
@@ -0,0 +1,85 @@
1From 79e35bd203b40979e1d241a04d6d9df373327bef Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Tue, 27 Feb 2018 09:28:06 +0000
4Subject: [PATCH 5/9] hotspot: use correct include for poll
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Compiling against musl-libc gives the following warning (which is
10treated as error due to -Werror):
11.../recipe-sysroot/usr/include/sys/poll.h:1:2: error: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Werror=cpp]
12 #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
13 ^~~~~~~
14etc.
15
16To use poll(), poll.h needs to be included, even on glibc - do so using
17the following command:
18 for i in $(git grep sys/poll\.h hotspot | cut -f 1 -d : | sort -u) ; do
19 sed -e 's,sys/poll\.h,poll.h,g' -i ${i}
20 done
21
22Upstream-Status: Pending
23Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
24---
25 hotspot/src/os/aix/vm/os_aix.inline.hpp | 2 +-
26 hotspot/src/os/bsd/vm/os_bsd.inline.hpp | 2 +-
27 hotspot/src/os/linux/vm/os_linux.inline.hpp | 2 +-
28 hotspot/src/os/solaris/vm/os_solaris.inline.hpp | 2 +-
29 4 files changed, 4 insertions(+), 4 deletions(-)
30
31diff --git a/hotspot/src/os/aix/vm/os_aix.inline.hpp b/hotspot/src/os/aix/vm/os_aix.inline.hpp
32index a97c94c0..e2974ee1 100644
33--- a/hotspot/src/os/aix/vm/os_aix.inline.hpp
34+++ b/hotspot/src/os/aix/vm/os_aix.inline.hpp
35@@ -34,7 +34,7 @@
36
37 #include <unistd.h>
38 #include <sys/socket.h>
39-#include <sys/poll.h>
40+#include <poll.h>
41 #include <sys/ioctl.h>
42 #include <netdb.h>
43
44diff --git a/hotspot/src/os/bsd/vm/os_bsd.inline.hpp b/hotspot/src/os/bsd/vm/os_bsd.inline.hpp
45index 10b39941..3144a29c 100644
46--- a/hotspot/src/os/bsd/vm/os_bsd.inline.hpp
47+++ b/hotspot/src/os/bsd/vm/os_bsd.inline.hpp
48@@ -33,7 +33,7 @@
49
50 #include <unistd.h>
51 #include <sys/socket.h>
52-#include <sys/poll.h>
53+#include <poll.h>
54 #include <netdb.h>
55
56 inline void* os::thread_local_storage_at(int index) {
57diff --git a/hotspot/src/os/linux/vm/os_linux.inline.hpp b/hotspot/src/os/linux/vm/os_linux.inline.hpp
58index 10d56d89..b9b2b775 100644
59--- a/hotspot/src/os/linux/vm/os_linux.inline.hpp
60+++ b/hotspot/src/os/linux/vm/os_linux.inline.hpp
61@@ -33,7 +33,7 @@
62
63 #include <unistd.h>
64 #include <sys/socket.h>
65-#include <sys/poll.h>
66+#include <poll.h>
67 #include <netdb.h>
68
69 inline void* os::thread_local_storage_at(int index) {
70diff --git a/hotspot/src/os/solaris/vm/os_solaris.inline.hpp b/hotspot/src/os/solaris/vm/os_solaris.inline.hpp
71index 921fcf7c..5d80a7d0 100644
72--- a/hotspot/src/os/solaris/vm/os_solaris.inline.hpp
73+++ b/hotspot/src/os/solaris/vm/os_solaris.inline.hpp
74@@ -33,7 +33,7 @@
75 #include <sys/param.h>
76 #include <dlfcn.h>
77 #include <sys/socket.h>
78-#include <sys/poll.h>
79+#include <poll.h>
80 #include <sys/filio.h>
81 #include <unistd.h>
82 #include <netdb.h>
83--
842.16.2
85
diff --git a/recipes-core/openjdk/patches-openjdk-8/0006-hotspot-don-t-rely-on-old-SysV-SIGCLD.patch b/recipes-core/openjdk/patches-openjdk-8/0006-hotspot-don-t-rely-on-old-SysV-SIGCLD.patch
new file mode 100644
index 0000000..81dbebd
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/0006-hotspot-don-t-rely-on-old-SysV-SIGCLD.patch
@@ -0,0 +1,41 @@
1From 4ed4b58270dcd3d897adef605893c104944c4f3a Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Tue, 27 Feb 2018 15:00:55 +0000
4Subject: [PATCH 6/9] hotspot: don't rely on old SysV SIGCLD
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9SIGCLD is the old System V name for SIGCHLD, and not
10all c libraries implement it, e.g. musl-libc, which
11leads to the following compilation error:
12
13| hotspot/src/os/linux/vm/jvm_linux.cpp:157:17: error: 'SIGCLD' was not declared in this scope
14| "CLD", SIGCLD, /* Same as SIGCHLD (System V). */
15| ^~~~~~
16
17Just make it conditional, so the code compiles everywhere.
18
19Upstream-Status: Pending
20Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
21---
22 hotspot/src/os/linux/vm/jvm_linux.cpp | 2 ++
23 1 file changed, 2 insertions(+)
24
25diff --git a/hotspot/src/os/linux/vm/jvm_linux.cpp b/hotspot/src/os/linux/vm/jvm_linux.cpp
26index ba84788a..c22281f7 100644
27--- a/hotspot/src/os/linux/vm/jvm_linux.cpp
28+++ b/hotspot/src/os/linux/vm/jvm_linux.cpp
29@@ -154,7 +154,9 @@ struct siglabel siglabels[] = {
30 #ifdef SIGSTKFLT
31 "STKFLT", SIGSTKFLT, /* Stack fault. */
32 #endif
33+#ifdef SIGCLD
34 "CLD", SIGCLD, /* Same as SIGCHLD (System V). */
35+#endif
36 "CHLD", SIGCHLD, /* Child status has changed (POSIX). */
37 "CONT", SIGCONT, /* Continue (POSIX). */
38 "STOP", SIGSTOP, /* Stop, unblockable (POSIX). */
39--
402.16.2
41
diff --git a/recipes-core/openjdk/patches-openjdk-8/0007-jdk-use-correct-include-for-poll.patch b/recipes-core/openjdk/patches-openjdk-8/0007-jdk-use-correct-include-for-poll.patch
new file mode 100644
index 0000000..af4dde9
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/0007-jdk-use-correct-include-for-poll.patch
@@ -0,0 +1,172 @@
1From df9c5738c4a8a00ba65948503ff0c0cfa2f17e95 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Tue, 27 Feb 2018 09:28:06 +0000
4Subject: [PATCH 7/9] jdk: use correct include for poll
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Compiling against musl-libc gives the following warning (which is
10treated as error due to -Werror:
11| In file included from jdk/src/solaris/native/java/net/net_util_md.h:36:0,
12| from jdk/src/share/native/java/net/net_util.h:31,
13| from jdk/src/solaris/native/java/net/InetAddressImplFactory.c:28:
14| usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
15| #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
16| ^~~~~~~
17etc.
18
19To use poll(), poll.h needs to be included, even on glibc - do so using
20the following command:
21 for i in $(git grep sys/poll\.h jdk | cut -f 1 -d : | sort -u) ; do
22 sed -e 's,sys/poll\.h,poll.h,g' -i ${i}
23 done
24
25Upstream-Status: Pending
26Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
27---
28 jdk/src/aix/native/java/net/aix_close.c | 2 +-
29 jdk/src/aix/native/sun/nio/ch/AixPollPort.c | 2 +-
30 jdk/src/solaris/native/java/net/PlainSocketImpl.c | 2 +-
31 jdk/src/solaris/native/java/net/bsd_close.c | 2 +-
32 jdk/src/solaris/native/java/net/linux_close.c | 2 +-
33 jdk/src/solaris/native/java/net/net_util_md.h | 2 +-
34 jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c | 2 +-
35 jdk/src/solaris/native/sun/nio/ch/Net.c | 2 +-
36 jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c | 2 +-
37 jdk/src/solaris/transport/socket/socket_md.c | 2 +-
38 10 files changed, 10 insertions(+), 10 deletions(-)
39
40diff --git a/jdk/src/aix/native/java/net/aix_close.c b/jdk/src/aix/native/java/net/aix_close.c
41index 8c070e4b..126f4d7d 100644
42--- a/jdk/src/aix/native/java/net/aix_close.c
43+++ b/jdk/src/aix/native/java/net/aix_close.c
44@@ -51,7 +51,7 @@
45 #include <unistd.h>
46 #include <errno.h>
47
48-#include <sys/poll.h>
49+#include <poll.h>
50
51 /*
52 * Stack allocated by thread when doing blocking operation
53diff --git a/jdk/src/aix/native/sun/nio/ch/AixPollPort.c b/jdk/src/aix/native/sun/nio/ch/AixPollPort.c
54index 70064b89..c10c602b 100644
55--- a/jdk/src/aix/native/sun/nio/ch/AixPollPort.c
56+++ b/jdk/src/aix/native/sun/nio/ch/AixPollPort.c
57@@ -34,7 +34,7 @@
58 #include <unistd.h>
59 #include <sys/types.h>
60 #include <sys/socket.h>
61-#include <sys/poll.h>
62+#include <poll.h>
63 #include <sys/pollset.h>
64 #include <fcntl.h>
65 #include <stddef.h>
66diff --git a/jdk/src/solaris/native/java/net/PlainSocketImpl.c b/jdk/src/solaris/native/java/net/PlainSocketImpl.c
67index 71cbdf8c..170957e7 100644
68--- a/jdk/src/solaris/native/java/net/PlainSocketImpl.c
69+++ b/jdk/src/solaris/native/java/net/PlainSocketImpl.c
70@@ -28,7 +28,7 @@
71 #include <sys/types.h>
72 #include <sys/socket.h>
73 #if defined(__linux__) && !defined(USE_SELECT)
74-#include <sys/poll.h>
75+#include <poll.h>
76 #endif
77 #include <netinet/tcp.h> /* Defines TCP_NODELAY, needed for 2.6 */
78 #include <netinet/in.h>
79diff --git a/jdk/src/solaris/native/java/net/bsd_close.c b/jdk/src/solaris/native/java/net/bsd_close.c
80index af57cef3..64d04088 100644
81--- a/jdk/src/solaris/native/java/net/bsd_close.c
82+++ b/jdk/src/solaris/native/java/net/bsd_close.c
83@@ -36,7 +36,7 @@
84 #include <sys/uio.h>
85 #include <unistd.h>
86 #include <errno.h>
87-#include <sys/poll.h>
88+#include <poll.h>
89
90 /*
91 * Stack allocated by thread when doing blocking operation
92diff --git a/jdk/src/solaris/native/java/net/linux_close.c b/jdk/src/solaris/native/java/net/linux_close.c
93index 98e1ce09..85fba135 100644
94--- a/jdk/src/solaris/native/java/net/linux_close.c
95+++ b/jdk/src/solaris/native/java/net/linux_close.c
96@@ -34,7 +34,7 @@
97 #include <sys/uio.h>
98 #include <unistd.h>
99 #include <errno.h>
100-#include <sys/poll.h>
101+#include <poll.h>
102
103 /*
104 * Stack allocated by thread when doing blocking operation
105diff --git a/jdk/src/solaris/native/java/net/net_util_md.h b/jdk/src/solaris/native/java/net/net_util_md.h
106index a48446de..8915b68a 100644
107--- a/jdk/src/solaris/native/java/net/net_util_md.h
108+++ b/jdk/src/solaris/native/java/net/net_util_md.h
109@@ -33,7 +33,7 @@
110 #include <unistd.h>
111
112 #ifndef USE_SELECT
113-#include <sys/poll.h>
114+#include <poll.h>
115 #endif
116
117
118diff --git a/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c b/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c
119index 6860a167..20849dab 100644
120--- a/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c
121+++ b/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c
122@@ -28,7 +28,7 @@
123 #include "jvm.h"
124 #include "jlong.h"
125 #include "sun_nio_ch_DevPollArrayWrapper.h"
126-#include <sys/poll.h>
127+#include <poll.h>
128 #include <unistd.h>
129 #include <sys/time.h>
130
131diff --git a/jdk/src/solaris/native/sun/nio/ch/Net.c b/jdk/src/solaris/native/sun/nio/ch/Net.c
132index 73560ad6..a3720055 100644
133--- a/jdk/src/solaris/native/sun/nio/ch/Net.c
134+++ b/jdk/src/solaris/native/sun/nio/ch/Net.c
135@@ -23,7 +23,7 @@
136 * questions.
137 */
138
139-#include <sys/poll.h>
140+#include <poll.h>
141 #include <sys/types.h>
142 #include <sys/socket.h>
143 #include <string.h>
144diff --git a/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c b/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c
145index 375aaa48..7606e9ba 100644
146--- a/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c
147+++ b/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c
148@@ -32,7 +32,7 @@
149 #include <dlfcn.h>
150 #include <sys/types.h>
151 #include <sys/socket.h>
152-#include <sys/poll.h>
153+#include <poll.h>
154 #include <sys/inotify.h>
155
156 #include "sun_nio_fs_LinuxWatchService.h"
157diff --git a/jdk/src/solaris/transport/socket/socket_md.c b/jdk/src/solaris/transport/socket/socket_md.c
158index 33e062e0..819fcabd 100644
159--- a/jdk/src/solaris/transport/socket/socket_md.c
160+++ b/jdk/src/solaris/transport/socket/socket_md.c
161@@ -37,7 +37,7 @@
162 #include <thread.h>
163 #else
164 #include <pthread.h>
165-#include <sys/poll.h>
166+#include <poll.h>
167 #endif
168
169 #include "socket_md.h"
170--
1712.16.2
172
diff --git a/recipes-core/openjdk/patches-openjdk-8/0008-jdk-use-correct-include-for-signal.patch b/recipes-core/openjdk/patches-openjdk-8/0008-jdk-use-correct-include-for-signal.patch
new file mode 100644
index 0000000..406de52
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/0008-jdk-use-correct-include-for-signal.patch
@@ -0,0 +1,89 @@
1From a063ee68bc0dd7dbf9737df4ee191e98796f2f6a Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Tue, 27 Feb 2018 09:28:06 +0000
4Subject: [PATCH 8/9] jdk: use correct include for signal
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Compiling against musl-libc gives the following warning (which is
10treated as error due to -Werror:
11| In file included from jdk/src/solaris/javavm/export/jvm_md.h:68:0,
12| from jdk/src/share/javavm/export/jvm.h:32,
13| from jdk/src/share/native/java/net/net_util.h:29,
14| from jdk/src/solaris/native/java/net/InetAddressImplFactory.c:28:
15| usr/include/sys/signal.h:1:2: warning: #warning redirecting incorrect #include <sys/signal.h> to <signal.h> [-Wcpp]
16| #warning redirecting incorrect #include <sys/signal.h> to <signal.h>
17| ^~~~~~~
18etc.
19
20As per the message, signal.h needs to be included instead - do so using
21the following command:
22 for i in $(git grep sys/signal\.h jdk | cut -f 1 -d : | sort -u) ; do
23 sed -e 's,sys/signal\.h,signal.h,g' -i ${i}
24 done
25
26Upstream-Status: Pending
27Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
28---
29 jdk/src/aix/native/sun/nio/ch/AixNativeThread.c | 2 +-
30 jdk/src/macosx/javavm/export/jvm_md.h | 2 +-
31 jdk/src/solaris/javavm/export/jvm_md.h | 2 +-
32 jdk/src/solaris/native/sun/nio/ch/NativeThread.c | 2 +-
33 4 files changed, 4 insertions(+), 4 deletions(-)
34
35diff --git a/jdk/src/aix/native/sun/nio/ch/AixNativeThread.c b/jdk/src/aix/native/sun/nio/ch/AixNativeThread.c
36index c0d58579..c4abb7ae 100644
37--- a/jdk/src/aix/native/sun/nio/ch/AixNativeThread.c
38+++ b/jdk/src/aix/native/sun/nio/ch/AixNativeThread.c
39@@ -32,7 +32,7 @@
40 #include "sun_nio_ch_NativeThread.h"
41
42 #include <pthread.h>
43-#include <sys/signal.h>
44+#include <signal.h>
45
46 /* Also defined in src/aix/native/java/net/aix_close.c */
47 #define INTERRUPT_SIGNAL (SIGRTMAX - 1)
48diff --git a/jdk/src/macosx/javavm/export/jvm_md.h b/jdk/src/macosx/javavm/export/jvm_md.h
49index 012bb1ba..0b575768 100644
50--- a/jdk/src/macosx/javavm/export/jvm_md.h
51+++ b/jdk/src/macosx/javavm/export/jvm_md.h
52@@ -60,7 +60,7 @@
53 #include <sys/stat.h>
54 #include <fcntl.h>
55 #include <errno.h>
56-#include <sys/signal.h>
57+#include <signal.h>
58
59 /* O Flags */
60
61diff --git a/jdk/src/solaris/javavm/export/jvm_md.h b/jdk/src/solaris/javavm/export/jvm_md.h
62index 5c681914..62415ee2 100644
63--- a/jdk/src/solaris/javavm/export/jvm_md.h
64+++ b/jdk/src/solaris/javavm/export/jvm_md.h
65@@ -65,7 +65,7 @@
66 #include <sys/stat.h>
67 #include <fcntl.h>
68 #include <errno.h>
69-#include <sys/signal.h>
70+#include <signal.h>
71
72 /* O Flags */
73
74diff --git a/jdk/src/solaris/native/sun/nio/ch/NativeThread.c b/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
75index 5e2a78b7..204f0441 100644
76--- a/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
77+++ b/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
78@@ -34,7 +34,7 @@
79
80 #ifdef __linux__
81 #include <pthread.h>
82- #include <sys/signal.h>
83+ #include <signal.h>
84 /* Also defined in net/linux_close.c */
85 #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
86 #elif __solaris__
87--
882.16.2
89
diff --git a/recipes-core/openjdk/patches-openjdk-8/0009-jdk-disable-backtrace-musl-build-fix.patch b/recipes-core/openjdk/patches-openjdk-8/0009-jdk-disable-backtrace-musl-build-fix.patch
new file mode 100644
index 0000000..68f3d7a
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/0009-jdk-disable-backtrace-musl-build-fix.patch
@@ -0,0 +1,45 @@
1From 8ef989f82b29655e8d4532f14d5aa12a2999d850 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Fri, 2 Mar 2018 13:58:07 +0000
4Subject: [PATCH 10/10] jdk: disable backtrace() (musl build fix)
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9musl doesn't implement / provide backtrace() and friends or
10the corresponding header files. This is all glibc specific.
11
12Use appropriate #ifdef to disable their use on musl and thus
13to fix the build on musl.
14
15Upstream-Status: Pending
16Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
17---
18 jdk/src/solaris/native/sun/xawt/XToolkit.c | 4 ++--
19 1 file changed, 2 insertions(+), 2 deletions(-)
20
21diff --git a/jdk/src/solaris/native/sun/xawt/XToolkit.c b/jdk/src/solaris/native/sun/xawt/XToolkit.c
22index 71d41f37..d3dc47cb 100644
23--- a/jdk/src/solaris/native/sun/xawt/XToolkit.c
24+++ b/jdk/src/solaris/native/sun/xawt/XToolkit.c
25@@ -27,7 +27,7 @@
26 #include <X11/Xutil.h>
27 #include <X11/Xos.h>
28 #include <X11/Xatom.h>
29-#ifdef __linux__
30+#if defined(__linux__) && defined(__GLIBC__)
31 #include <execinfo.h>
32 #endif
33
34@@ -799,7 +799,7 @@ JNIEXPORT jstring JNICALL Java_sun_awt_X11_XToolkit_getEnv
35 return ret;
36 }
37
38-#ifdef __linux__
39+#if defined(__linux__) && defined(__GLIBC__)
40 void print_stack(void)
41 {
42 void *array[10];
43--
442.16.2
45
diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0001-hotspot-stop-using-obsolete-isnanf.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0001-hotspot-stop-using-obsolete-isnanf.patch
new file mode 100644
index 0000000..e165170
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/musl-0001-hotspot-stop-using-obsolete-isnanf.patch
@@ -0,0 +1,42 @@
1From 1624e2dd3739fe208efa13b31abf4bc53ae2e5c1 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Tue, 27 Feb 2018 11:24:44 +0000
4Subject: [PATCH 1/9] hotspot: stop using obsolete isnanf()
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Compiling against musl-libc gives the following error:
10| hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp: In function 'int g_isnan(float)':
11| hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp:238:39: error: 'isnanf' was not declared in this scope
12| inline int g_isnan(float f) { return isnanf(f); }
13| ^~~~~~
14
15isnanf() is obsolete, and musl doesn't implement it. isnan()
16is the right thing to use for all types (float and double),
17replacing isnanf(), even on glibc.
18
19Do so.
20
21Upstream-Status: Pending
22Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
23---
24 hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp | 2 +-
25 1 file changed, 1 insertion(+), 1 deletion(-)
26
27diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
28index efa0b4e1..6df2302e 100644
29--- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
30+++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
31@@ -235,7 +235,7 @@ inline int g_isnan(double f) { return isnand(f); }
32 #elif defined(__APPLE__)
33 inline int g_isnan(double f) { return isnan(f); }
34 #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
35-inline int g_isnan(float f) { return isnanf(f); }
36+inline int g_isnan(float f) { return isnan(f); }
37 inline int g_isnan(double f) { return isnan(f); }
38 #else
39 #error "missing platform-specific definition here"
40--
412.16.2
42
diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0002-jdk-give-a-much-bigger-buffer-to-getmntent_r.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0002-jdk-give-a-much-bigger-buffer-to-getmntent_r.patch
new file mode 100644
index 0000000..1874f87
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/musl-0002-jdk-give-a-much-bigger-buffer-to-getmntent_r.patch
@@ -0,0 +1,103 @@
1From 2ba0f3fae90f2d2c310663e4b39e90f969116241 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Tue, 27 Feb 2018 15:59:09 +0000
4Subject: [PATCH 2/9] jdk: give a much bigger buffer to getmntent_r()
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9https://bugs.alpinelinux.org/issues/7093
10
11Upstream-Status: Inappropriate [musl specific]
12Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
13---
14 .../native/sun/nio/fs/LinuxNativeDispatcher.c | 29 +++++++++++++++-------
15 1 file changed, 20 insertions(+), 9 deletions(-)
16
17diff --git a/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c b/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c
18index c8500db5..d0b85d67 100644
19--- a/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c
20+++ b/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c
21@@ -33,6 +33,7 @@
22 #include <dlfcn.h>
23 #include <errno.h>
24 #include <mntent.h>
25+#include <limits.h>
26
27 #include "sun_nio_fs_LinuxNativeDispatcher.h"
28
29@@ -173,8 +174,8 @@ Java_sun_nio_fs_LinuxNativeDispatcher_getmntent(JNIEnv* env, jclass this,
30 jlong value, jobject entry)
31 {
32 struct mntent ent;
33- char buf[1024];
34- int buflen = sizeof(buf);
35+ char *buf = NULL;
36+ const size_t buflen = PATH_MAX * 4;
37 struct mntent* m;
38 FILE* fp = jlong_to_ptr(value);
39 jsize len;
40@@ -183,10 +184,17 @@ Java_sun_nio_fs_LinuxNativeDispatcher_getmntent(JNIEnv* env, jclass this,
41 char* dir;
42 char* fstype;
43 char* options;
44+ jint res = -1;
45
46- m = getmntent_r(fp, &ent, (char*)&buf, buflen);
47- if (m == NULL)
48+ buf = malloc(buflen);
49+ if (buf == NULL) {
50+ JNU_ThrowOutOfMemoryError(env, "native heap");
51 return -1;
52+ }
53+ m = getmntent_r(fp, &ent, buf, buflen);
54+ if (m == NULL)
55+ goto out;
56+
57 name = m->mnt_fsname;
58 dir = m->mnt_dir;
59 fstype = m->mnt_type;
60@@ -195,32 +203,35 @@ Java_sun_nio_fs_LinuxNativeDispatcher_getmntent(JNIEnv* env, jclass this,
61 len = strlen(name);
62 bytes = (*env)->NewByteArray(env, len);
63 if (bytes == NULL)
64- return -1;
65+ goto out;
66 (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)name);
67 (*env)->SetObjectField(env, entry, entry_name, bytes);
68
69 len = strlen(dir);
70 bytes = (*env)->NewByteArray(env, len);
71 if (bytes == NULL)
72- return -1;
73+ goto out;
74 (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)dir);
75 (*env)->SetObjectField(env, entry, entry_dir, bytes);
76
77 len = strlen(fstype);
78 bytes = (*env)->NewByteArray(env, len);
79 if (bytes == NULL)
80- return -1;
81+ goto out;
82 (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)fstype);
83 (*env)->SetObjectField(env, entry, entry_fstype, bytes);
84
85 len = strlen(options);
86 bytes = (*env)->NewByteArray(env, len);
87 if (bytes == NULL)
88- return -1;
89+ goto out;
90 (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)options);
91 (*env)->SetObjectField(env, entry, entry_options, bytes);
92
93- return 0;
94+ res = 0;
95+out:
96+ free(buf);
97+ return res;
98 }
99
100 JNIEXPORT void JNICALL
101--
1022.16.2
103
diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0003-jdk-fix-libjvm-load-on-musl-set-LD_LIBRARY_PATH.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0003-jdk-fix-libjvm-load-on-musl-set-LD_LIBRARY_PATH.patch
new file mode 100644
index 0000000..8ad000d
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/musl-0003-jdk-fix-libjvm-load-on-musl-set-LD_LIBRARY_PATH.patch
@@ -0,0 +1,37 @@
1From 4429d73853b3938a53a6058cc0dcaac08d191995 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Tue, 27 Feb 2018 16:01:54 +0000
4Subject: [PATCH 3/9] jdk: fix libjvm load on musl (set LD_LIBRARY_PATH)
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9musl needs LD_LIBRARY_PATH set because when .so is opened
10with dlopen(/abs/path) it does not qualify for providing
11symbols for NEEDED dependency.
12
13Patch taken from Alpine Linux:
14 https://git.alpinelinux.org/cgit/aports/tree/community/openjdk8/icedtea-jdk-fix-libjvm-load.patch?id=4d34f29dddd3934358df7a9607706d09ae0433c3
15
16Upstream-Status: Inappropriate [musl specific]
17Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
18---
19 jdk/src/solaris/bin/java_md_solinux.c | 2 ++
20 1 file changed, 2 insertions(+)
21
22diff --git a/jdk/src/solaris/bin/java_md_solinux.c b/jdk/src/solaris/bin/java_md_solinux.c
23index 6d977109..e9a0a1eb 100644
24--- a/jdk/src/solaris/bin/java_md_solinux.c
25+++ b/jdk/src/solaris/bin/java_md_solinux.c
26@@ -291,6 +291,8 @@ RequiresSetenv(int wanted, const char *jvmpath) {
27 char *dmllp = NULL;
28 char *p; /* a utility pointer */
29
30+ return JNI_TRUE;
31+
32 #ifdef AIX
33 /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
34 return JNI_TRUE;
35--
362.16.2
37
diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0004-jdk-remove-sysctl.h-include-musl-build-fix.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0004-jdk-remove-sysctl.h-include-musl-build-fix.patch
new file mode 100644
index 0000000..086f669
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/musl-0004-jdk-remove-sysctl.h-include-musl-build-fix.patch
@@ -0,0 +1,90 @@
1From 86945e6df4dc15d5c2402a656d1d9d1b25945fb2 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Tue, 27 Feb 2018 09:28:06 +0000
4Subject: [PATCH 4/9] jdk: remove sysctl.h include (musl build fix)
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Compiling against musl-libc gives the following warning (which is
10treated as error due to -Werror:
11| jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c:44:10: fatal error: sys/sysctl.h: No such file or directory
12| #include <sys/sysctl.h>
13| ^~~~~~~~~~~~~~
14etc.
15
16Remove it, at things seem to work without as well.
17
18Upstream-Status: Inappropriate [musl specific]
19Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
20---
21 jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c | 1 -
22 jdk/src/solaris/native/java/net/PlainSocketImpl.c | 1 -
23 jdk/src/solaris/native/java/net/net_util_md.c | 1 -
24 jdk/src/solaris/native/sun/management/OperatingSystemImpl.c | 1 -
25 jdk/src/solaris/native/sun/net/portconfig.c | 1 -
26 5 files changed, 5 deletions(-)
27
28diff --git a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
29index c48d1153..e3519774 100644
30--- a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
31+++ b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
32@@ -41,7 +41,6 @@
33 #endif
34 #ifdef __linux__
35 #include <unistd.h>
36-#include <sys/sysctl.h>
37 #include <sys/utsname.h>
38 #include <netinet/ip.h>
39
40diff --git a/jdk/src/solaris/native/java/net/PlainSocketImpl.c b/jdk/src/solaris/native/java/net/PlainSocketImpl.c
41index 170957e7..9aafbc09 100644
42--- a/jdk/src/solaris/native/java/net/PlainSocketImpl.c
43+++ b/jdk/src/solaris/native/java/net/PlainSocketImpl.c
44@@ -43,7 +43,6 @@
45 #endif
46 #ifdef __linux__
47 #include <unistd.h>
48-#include <sys/sysctl.h>
49 #endif
50
51 #include "jvm.h"
52diff --git a/jdk/src/solaris/native/java/net/net_util_md.c b/jdk/src/solaris/native/java/net/net_util_md.c
53index eae347cf..a0ba6be0 100644
54--- a/jdk/src/solaris/native/java/net/net_util_md.c
55+++ b/jdk/src/solaris/native/java/net/net_util_md.c
56@@ -40,7 +40,6 @@
57 #else
58 #include <limits.h>
59 #include <sys/param.h>
60-#include <sys/sysctl.h>
61 #ifndef MAXINT
62 #define MAXINT INT_MAX
63 #endif
64diff --git a/jdk/src/solaris/native/sun/management/OperatingSystemImpl.c b/jdk/src/solaris/native/sun/management/OperatingSystemImpl.c
65index aa21f019..0b895569 100644
66--- a/jdk/src/solaris/native/sun/management/OperatingSystemImpl.c
67+++ b/jdk/src/solaris/native/sun/management/OperatingSystemImpl.c
68@@ -33,7 +33,6 @@
69 #include <sys/types.h>
70 #include <sys/stat.h>
71 #if defined(_ALLBSD_SOURCE)
72-#include <sys/sysctl.h>
73 #ifdef __APPLE__
74 #include <sys/param.h>
75 #include <sys/mount.h>
76diff --git a/jdk/src/solaris/native/sun/net/portconfig.c b/jdk/src/solaris/native/sun/net/portconfig.c
77index 56730f0f..5209c828 100644
78--- a/jdk/src/solaris/native/sun/net/portconfig.c
79+++ b/jdk/src/solaris/native/sun/net/portconfig.c
80@@ -29,7 +29,6 @@
81 #include <errno.h>
82
83 #if defined(_ALLBSD_SOURCE)
84-#include <sys/sysctl.h>
85 #endif
86
87 #include "jni.h"
88--
892.16.2
90
diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build.patch
new file mode 100644
index 0000000..913b318
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/musl-0005-hotspot-disable-agent-build.patch
@@ -0,0 +1,88 @@
1From 19b1d6b4dc64a1c44a8f90776a489eee5c76463d Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Tue, 27 Feb 2018 15:12:08 +0000
4Subject: [PATCH 5/9] hotspot: disable agent build
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9the agent needs thread_db, which doesn't exist in musl
10
11Upstream-Status: Inappropriate [musl specific]
12Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
13---
14 common/autoconf/jdk-options.m4 | 2 +-
15 hotspot/make/linux/makefiles/defs.make | 4 ++++
16 hotspot/make/linux/makefiles/sa.make | 2 +-
17 hotspot/make/linux/makefiles/saproc.make | 2 ++
18 4 files changed, 8 insertions(+), 2 deletions(-)
19
20diff --git a/common/autoconf/jdk-options.m4 b/common/autoconf/jdk-options.m4
21index a8f71705..036963ac 100644
22--- a/common/autoconf/jdk-options.m4
23+++ b/common/autoconf/jdk-options.m4
24@@ -151,7 +151,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS],
25 AC_SUBST(JVM_VARIANT_ZEROSHARK)
26 AC_SUBST(JVM_VARIANT_CORE)
27
28- INCLUDE_SA=true
29+ INCLUDE_SA=false
30 if test "x$JVM_VARIANT_ZERO" = xtrue ; then
31 INCLUDE_SA=false
32 fi
33diff --git a/hotspot/make/linux/makefiles/defs.make b/hotspot/make/linux/makefiles/defs.make
34index 3af5878a..d10bab95 100644
35--- a/hotspot/make/linux/makefiles/defs.make
36+++ b/hotspot/make/linux/makefiles/defs.make
37@@ -286,6 +286,7 @@ ifeq ($(JVM_VARIANT_MINIMAL1),true)
38 endif
39 endif
40
41+ifeq (0,1)
42 # Serviceability Binaries
43 # No SA Support for PPC, IA64, ARM or zero
44 ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
45@@ -305,6 +306,9 @@ ADD_SA_BINARIES/ppc =
46 ADD_SA_BINARIES/ia64 =
47 ADD_SA_BINARIES/arm =
48 ADD_SA_BINARIES/zero =
49+else
50+ADD_SA_BINARIES/$(HS_ARCH) =
51+endif
52
53 -include $(HS_ALT_MAKE)/linux/makefiles/defs.make
54
55diff --git a/hotspot/make/linux/makefiles/sa.make b/hotspot/make/linux/makefiles/sa.make
56index 66a7b945..61cc7244 100644
57--- a/hotspot/make/linux/makefiles/sa.make
58+++ b/hotspot/make/linux/makefiles/sa.make
59@@ -62,7 +62,7 @@ SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties
60
61 all:
62 if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \
63- -a "$(SRCARCH)" != "zero" ] ; then \
64+ -a "$(SRCARCH)" != "zero" ] && [ 0 -eq 1 ] ; then \
65 $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \
66 fi
67
68diff --git a/hotspot/make/linux/makefiles/saproc.make b/hotspot/make/linux/makefiles/saproc.make
69index 6579c8e1..8f29004c 100644
70--- a/hotspot/make/linux/makefiles/saproc.make
71+++ b/hotspot/make/linux/makefiles/saproc.make
72@@ -62,11 +62,13 @@ endif
73 # if $(AGENT_DIR) does not exist, we don't build SA
74 # also, we don't build SA on Itanium or zero.
75
76+ifeq (0,1)
77 ifneq ($(wildcard $(AGENT_DIR)),)
78 ifneq ($(filter-out ia64 zero,$(SRCARCH)),)
79 BUILDLIBSAPROC = $(LIBSAPROC)
80 endif
81 endif
82+endif
83
84 ifneq ($(ALT_SASRCDIR),)
85 ALT_SAINCDIR=-I$(ALT_SASRCDIR) -DALT_SASRCDIR
86--
872.16.2
88
diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies.patch
new file mode 100644
index 0000000..f0696fc
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/musl-0006-hotspot-os_linux-remove-glibc-dependencies.patch
@@ -0,0 +1,75 @@
1From a02a9fbc3f1fed181504bdb5b0a16863247f92fc Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Fri, 2 Mar 2018 10:11:51 +0000
4Subject: [PATCH 6/9] hotspot: os_linux: remove glibc dependencies
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9* gnu/libc-version.h doesn't exist in musl
10 | hotspot/src/os/linux/vm/os_linux.cpp:97:11: fatal error: gnu/libc-version.h: No such file or directory
11 | # include <gnu/libc-version.h>
12 | ^~~~~~~~~~~~~~~~~~~~
13
14* dlvsym() is a GNU extension and doesn't exist in musl
15 | hotspot/src/os/linux/vm/os_linux.cpp:2846:13: error: 'dlvsym' was not declared in this scope
16 | void *f = dlvsym(handle, name, "libnuma_1.1");
17 | ^~~~~~
18 | hotspot/src/os/linux/vm/os_linux.cpp:2846:13: note: suggested alternative: 'dlsym'
19 | void *f = dlvsym(handle, name, "libnuma_1.1");
20 | ^~~~~~
21 | dlsym
22
23Upstream-Status: Inappropriate [musl specific]
24Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
25---
26 hotspot/src/os/linux/vm/os_linux.cpp | 12 +++++++++++-
27 1 file changed, 11 insertions(+), 1 deletion(-)
28
29diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
30index 044a70a6..3137796a 100644
31--- a/hotspot/src/os/linux/vm/os_linux.cpp
32+++ b/hotspot/src/os/linux/vm/os_linux.cpp
33@@ -94,7 +94,6 @@
34 # include <string.h>
35 # include <syscall.h>
36 # include <sys/sysinfo.h>
37-# include <gnu/libc-version.h>
38 # include <sys/ipc.h>
39 # include <sys/shm.h>
40 # include <link.h>
41@@ -530,6 +529,13 @@ void os::Linux::hotspot_sigmask(Thread* thread) {
42 // detecting pthread library
43
44 void os::Linux::libpthread_init() {
45+#if 1
46+ // Hard code supported musl compatible settings (taken from alpine linux)
47+ os::Linux::set_glibc_version("glibc 2.9");
48+ os::Linux::set_libpthread_version("NPTL");
49+ os::Linux::set_is_NPTL();
50+ os::Linux::set_is_floating_stack();
51+#else
52 // Save glibc and pthread version strings. Note that _CS_GNU_LIBC_VERSION
53 // and _CS_GNU_LIBPTHREAD_VERSION are supported in glibc >= 2.3.2. Use a
54 // generic name for earlier versions.
55@@ -588,6 +594,7 @@ void os::Linux::libpthread_init() {
56 if (os::Linux::is_NPTL() || os::Linux::supports_variable_stack_size()) {
57 os::Linux::set_is_floating_stack();
58 }
59+#endif
60 }
61
62 /////////////////////////////////////////////////////////////////////////////
63@@ -2814,6 +2821,9 @@ int os::Linux::sched_getcpu_syscall(void) {
64 return (retval == -1) ? retval : cpu;
65 }
66
67+// musl doesn't have dlvsym()
68+#define dlvsym(h,s,v) dlsym(h,s)
69+
70 // Something to do with the numa-aware allocator needs these symbols
71 extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
72 extern "C" JNIEXPORT void numa_error(char *where) { }
73--
742.16.2
75
diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0007-hotspot-os_linux_x86-remove-glibc-dependencies-fpu_c.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0007-hotspot-os_linux_x86-remove-glibc-dependencies-fpu_c.patch
new file mode 100644
index 0000000..fcad102
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/musl-0007-hotspot-os_linux_x86-remove-glibc-dependencies-fpu_c.patch
@@ -0,0 +1,46 @@
1From dc0217d20e3c96203c81acda1c02652755bfcefb Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Fri, 2 Mar 2018 10:24:11 +0000
4Subject: [PATCH 7/9] hotspot: os_linux_x86: remove glibc dependencies
5 (fpu_control.h)
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10musl doesn't provide fpu_control.h, open-code the relevant
11bits instead.
12
13Patch adopted from Alpine linux:
14 https://git.alpinelinux.org/cgit/aports/tree/community/openjdk8/icedtea-hotspot-musl.patch?id=4d34f29dddd3934358df7a9607706d09ae0433c3
15
16Upstream-Status: Inappropriate [musl specific]
17Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
18---
19 hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp | 4 +++-
20 1 file changed, 3 insertions(+), 1 deletion(-)
21
22diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
23index fb96738a..982ce84d 100644
24--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
25+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
26@@ -72,7 +72,6 @@
27 # include <pwd.h>
28 # include <poll.h>
29 # include <ucontext.h>
30-# include <fpu_control.h>
31
32 #ifdef AMD64
33 #define REG_SP REG_RSP
34@@ -543,6 +542,9 @@ JVM_handle_linux_signal(int sig,
35 ShouldNotReachHere();
36 }
37
38+#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
39+#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
40+
41 void os::Linux::init_thread_fpu_state(void) {
42 #ifndef AMD64
43 // set fpu to 53 bit precision
44--
452.16.2
46
diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0008-jdk-musl-build-fix-use-SIGRTMAX-rather-than-__SIGRTM.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0008-jdk-musl-build-fix-use-SIGRTMAX-rather-than-__SIGRTM.patch
new file mode 100644
index 0000000..c15895f
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/musl-0008-jdk-musl-build-fix-use-SIGRTMAX-rather-than-__SIGRTM.patch
@@ -0,0 +1,69 @@
1From ec37e9e5663611e49c7c976d34450ea6b90d0f24 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Fri, 2 Mar 2018 13:37:20 +0000
4Subject: [PATCH 8/9] jdk: musl build fix (use SIGRTMAX rather than __SIGRTMAX)
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9__SIGRTMAX is a private glibc symbol, which isn't provided
10by musl, thus failing compilation.
11
12From https://sourceware.org/ml/rda/2005-q4/msg00011.html
13 On a GNU(ish) system, [SIGRTMIN / SIGRTMAX] these macros are defined
14 to call functions which compute the actual minimum and maximum
15 realtime signal numbers. In particular, this computation will exclude
16 any signals used by the C library for its own purposes. These signals
17 could include signals related to thread debugging or, more
18 importantly, for thread cancellation.
19[...]
20 [The __SIGRTMIN and __SIGRTMAX] constants represent a hard minumum
21 and maximum.
22
23Patch taken from Alpine Linux:
24 https://git.alpinelinux.org/cgit/aports/tree/community/openjdk8/icedtea-jdk-musl.patch?id=4d34f29dddd3934358df7a9607706d09ae0433c3
25
26Upstream-Status: Inappropriate [musl specific]
27Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
28---
29 jdk/src/solaris/native/java/net/linux_close.c | 3 ++-
30 jdk/src/solaris/native/sun/nio/ch/NativeThread.c | 2 +-
31 2 files changed, 3 insertions(+), 2 deletions(-)
32
33diff --git a/jdk/src/solaris/native/java/net/linux_close.c b/jdk/src/solaris/native/java/net/linux_close.c
34index 85fba135..e635dafd 100644
35--- a/jdk/src/solaris/native/java/net/linux_close.c
36+++ b/jdk/src/solaris/native/java/net/linux_close.c
37@@ -56,7 +56,7 @@ typedef struct {
38 /*
39 * Signal to unblock thread
40 */
41-static int sigWakeup = (__SIGRTMAX - 2);
42+static int sigWakeup;
43
44 /*
45 * The fd table and the number of file descriptors
46@@ -95,6 +95,7 @@ static void __attribute((constructor)) init() {
47 /*
48 * Setup the signal handler
49 */
50+ sigWakeup = SIGRTMAX - 2;
51 sa.sa_handler = sig_wakeup;
52 sa.sa_flags = 0;
53 sigemptyset(&sa.sa_mask);
54diff --git a/jdk/src/solaris/native/sun/nio/ch/NativeThread.c b/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
55index 204f0441..f5483bbd 100644
56--- a/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
57+++ b/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
58@@ -36,7 +36,7 @@
59 #include <pthread.h>
60 #include <signal.h>
61 /* Also defined in net/linux_close.c */
62- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
63+ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
64 #elif __solaris__
65 #include <thread.h>
66 #include <signal.h>
67--
682.16.2
69
diff --git a/recipes-core/openjdk/patches-openjdk-8/musl-0009-jdk-musl-has-gethostby_r.patch b/recipes-core/openjdk/patches-openjdk-8/musl-0009-jdk-musl-has-gethostby_r.patch
new file mode 100644
index 0000000..c033b77
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/musl-0009-jdk-musl-has-gethostby_r.patch
@@ -0,0 +1,35 @@
1From 276fb5b2d57cf0257dc82e84d80213fe3eec6e34 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
3Date: Fri, 2 Mar 2018 13:57:22 +0000
4Subject: [PATCH 9/9] jdk: musl has gethostby_r()
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Fix the #ifdef to also allow use of it when using musl.
10
11Patch taken from Alpine Linux:
12 https://git.alpinelinux.org/cgit/aports/tree/community/openjdk8/icedtea-jdk-musl.patch?id=4d34f29dddd3934358df7a9607706d09ae0433c3
13
14Upstream-Status: Inappropriate [musl specific]
15Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
16---
17 jdk/src/solaris/native/java/net/Inet4AddressImpl.c | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20diff --git a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
21index ec4f97df..5c1af081 100644
22--- a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
23+++ b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
24@@ -47,7 +47,7 @@
25
26 #include "java_net_Inet4AddressImpl.h"
27
28-#if defined(__GLIBC__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104))
29+#if defined(__linux__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104))
30 #define HAS_GLIBC_GETHOSTBY_R 1
31 #endif
32
33--
342.16.2
35