--- icedtea-3.1.0/Makefile.in.orig	2016-10-31 14:34:29.618210649 -0400
+++ icedtea-3.1.0/Makefile.in	2016-10-31 15:22:58.523418113 -0400
@@ -769,7 +769,7 @@ ECC_CHECK_SRCS = $(top_srcdir)/test/stan
 
 # Patch list
 ICEDTEA_PATCHES = patches/override-redirect-metacity.patch \
-	patches/no-recommended-gcc.patch \
+	patches/no-recommended-gcc.patch patches/uclibc.patch \
 	$(am__append_2) $(am__append_3) $(am__append_4) \
 	$(am__append_5) $(am__append_6) $(am__append_7) \
 	$(am__append_8) $(am__append_9) $(am__append_10) \
--- /dev/null	2016-10-28 23:10:22.902977197 -0400
+++ icedtea-3.1.0/patches/uclibc.patch	2016-11-01 10:39:14.325366032 -0400
@@ -0,0 +1,94 @@
+Largely based on:
+https://lists.openwrt.org/pipermail/openwrt-devel/2011-August/012129.html
+
+--- openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	2016-11-01 10:25:40.393307982 -0400
++++ openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	2016-11-01 10:25:29.571307210 -0400
+@@ -235,7 +235,7 @@ inline int g_isnan(double f) { return is
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float  f) { return isnanf(f); }
++inline int g_isnan(float  f) { return __isnanf(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+@@ -249,8 +249,8 @@ inline int g_isnan(double f) { return is
+ 
+ // Checking for finiteness
+ 
+-inline int g_isfinite(jfloat  f)                 { return finite(f); }
+-inline int g_isfinite(jdouble f)                 { return finite(f); }
++inline int g_isfinite(jfloat  f)                 { return isfinite(f); }
++inline int g_isfinite(jdouble f)                 { return isfinite(f); }
+ 
+ 
+ // Wide characters
+--- openjdk/hotspot/src/os/linux/vm/os_linux.cpp.orig	2016-07-25 01:38:24.000000000 -0400
++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp	2016-11-01 10:38:54.729364635 -0400
+@@ -94,7 +94,9 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
++# ifndef __UCLIBC__
++#  include <gnu/libc-version.h>
++# endif
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -541,8 +543,14 @@ void os::Linux::libpthread_init() {
+   } else {
+      // _CS_GNU_LIBC_VERSION is not supported, try gnu_get_libc_version()
+      static char _gnu_libc_version[32];
++#ifdef __UCLIBC__
++     jio_snprintf(_gnu_libc_version, sizeof(_gnu_libc_version),
++              "uClibc %d.%d.%d", __UCLIBC_MAJOR__, __UCLIBC_MINOR__,
++                                 __UCLIBC_SUBLEVEL__);
++#else
+      jio_snprintf(_gnu_libc_version, sizeof(_gnu_libc_version),
+               "glibc %s %s", gnu_get_libc_version(), gnu_get_libc_release());
++#endif
+      os::Linux::set_glibc_version(_gnu_libc_version);
+   }
+ 
+@@ -2800,8 +2808,12 @@ extern "C" JNIEXPORT int fork1() { retur
+ // If we are running with earlier version, which did not have symbol versions,
+ // we should use the base version.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+-  void *f = dlvsym(handle, name, "libnuma_1.1");
+-  if (f == NULL) {
++  void *f;
++#ifndef __UCLIBC__
++  f = dlvsym(handle, name, "libnuma_1.1");
++  if (f == NULL)
++#endif
++  {
+     f = dlsym(handle, name);
+   }
+   return f;
+@@ -5445,7 +5461,25 @@ bool os::is_thread_cpu_time_supported()
+ // Linux doesn't yet have a (official) notion of processor sets,
+ // so just return the system wide load average.
+ int os::loadavg(double loadavg[], int nelem) {
++#ifdef __UCLIBC__
++  FILE *LOADAVG;
++  double avg[3] = { 0.0, 0.0, 0.0 };
++  int i, res = -1;;
++
++  if ((LOADAVG = fopen("/proc/loadavg", "r"))) {
++    fscanf(LOADAVG, "%lf %lf %lf", &avg[0], &avg[1], &avg[2]);
++    res = 0;
++    fclose(LOADAVG);
++  }
++
++  for (i = 0; (i < nelem) && (i < 3); i++) {
++    loadavg[i] = avg[i];
++  }
++
++  return res;
++#else
+   return ::getloadavg(loadavg, nelem);
++#endif
+ }
+ 
+ void os::pause() {
