logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

icedtea-os_linux-remove-glibc-dependencies.patch (2954B)


  1. From a02a9fbc3f1fed181504bdb5b0a16863247f92fc Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
  3. Date: Fri, 2 Mar 2018 10:11:51 +0000
  4. Subject: [PATCH 6/9] hotspot: os_linux: remove glibc dependencies
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. * gnu/libc-version.h doesn't exist in musl
  9. | hotspot/src/os/linux/vm/os_linux.cpp:97:11: fatal error: gnu/libc-version.h: No such file or directory
  10. | # include <gnu/libc-version.h>
  11. | ^~~~~~~~~~~~~~~~~~~~
  12. * dlvsym() is a GNU extension and doesn't exist in musl
  13. | hotspot/src/os/linux/vm/os_linux.cpp:2846:13: error: 'dlvsym' was not declared in this scope
  14. | void *f = dlvsym(handle, name, "libnuma_1.1");
  15. | ^~~~~~
  16. | hotspot/src/os/linux/vm/os_linux.cpp:2846:13: note: suggested alternative: 'dlsym'
  17. | void *f = dlvsym(handle, name, "libnuma_1.1");
  18. | ^~~~~~
  19. | dlsym
  20. Upstream-Status: Inappropriate [musl specific]
  21. Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>>
  22. ---
  23. hotspot/src/os/linux/vm/os_linux.cpp | 12 +++++++++++-
  24. 1 file changed, 11 insertions(+), 1 deletion(-)
  25. diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
  26. index 044a70a6..3137796a 100644
  27. --- openjdk/hotspot/src/os/linux/vm/os_linux.cpp
  28. +++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp
  29. @@ -94,7 +94,6 @@
  30. # include <string.h>
  31. # include <syscall.h>
  32. # include <sys/sysinfo.h>
  33. -# include <gnu/libc-version.h>
  34. # include <sys/ipc.h>
  35. # include <sys/shm.h>
  36. # include <link.h>
  37. @@ -530,6 +529,13 @@ void os::Linux::hotspot_sigmask(Thread* thread) {
  38. // detecting pthread library
  39. void os::Linux::libpthread_init() {
  40. +#if 1
  41. + // Hard code supported musl compatible settings (taken from alpine linux)
  42. + os::Linux::set_glibc_version("glibc 2.9");
  43. + os::Linux::set_libpthread_version("NPTL");
  44. + os::Linux::set_is_NPTL();
  45. + os::Linux::set_is_floating_stack();
  46. +#else
  47. // Save glibc and pthread version strings. Note that _CS_GNU_LIBC_VERSION
  48. // and _CS_GNU_LIBPTHREAD_VERSION are supported in glibc >= 2.3.2. Use a
  49. // generic name for earlier versions.
  50. @@ -588,6 +594,7 @@ void os::Linux::libpthread_init() {
  51. if (os::Linux::is_NPTL() || os::Linux::supports_variable_stack_size()) {
  52. os::Linux::set_is_floating_stack();
  53. }
  54. +#endif
  55. }
  56. /////////////////////////////////////////////////////////////////////////////
  57. @@ -2814,6 +2821,9 @@ int os::Linux::sched_getcpu_syscall(void) {
  58. return (retval == -1) ? retval : cpu;
  59. }
  60. +// musl doesn't have dlvsym()
  61. +#define dlvsym(h,s,v) dlsym(h,s)
  62. +
  63. // Something to do with the numa-aware allocator needs these symbols
  64. extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
  65. extern "C" JNIEXPORT void numa_error(char *where) { }
  66. --
  67. 2.16.2