--- /dev/null
+From 4b9692c93d658015087f19016b2bd0c9dfbccee6 Mon Sep 17 00:00:00 2001
+From: Bernd Kuhls <bernd.kuhls@t-online.de>
+Date: Sun, 28 May 2017 20:21:09 +0200
+Subject: [PATCH] Fix 'missing libc-version.h' build error (uClibc/x86[_64])
+ (fix commit 3d34255)
+
+uClibc defines __GLIBC__ but does not contain libc-version.h file.
+
+* include/private/gcconfig.h [(I386 || X86_64) && LINUX && __GLIBC__]
+(GLIBC_2_19_TSX_BUG): Do not define (and do not include
+gnu/libc-version.h) if __UCLIBC__.
+
+[baruch: cherry pick from upstream bdwgc commit 047230b71d42140]
+Signed-off-by: Baruch Siach <baruch@tkos.co.il>
+---
+Upstream status: patch applied to bdwgc; will propagate to gauche on the next
+synch of its bundled bdwgc
+
+ gc/include/private/gcconfig.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gc/include/private/gcconfig.h b/gc/include/private/gcconfig.h
+index 80920e5af570..f063664c3f52 100644
+--- a/gc/include/private/gcconfig.h
++++ b/gc/include/private/gcconfig.h
+@@ -1420,7 +1420,7 @@
+ # define GC_PREFETCH_FOR_WRITE(x) \
+ __asm__ __volatile__ ("prefetchw %0" : : "m"(*(char *)(x)))
+ # endif
+-# if defined(__GLIBC__)
++# if defined(__GLIBC__) && !defined(__UCLIBC__)
+ /* Workaround lock elision implementation for some glibc. */
+ # define GLIBC_2_19_TSX_BUG
+ # include <gnu/libc-version.h> /* for gnu_get_libc_version() */
+@@ -2431,7 +2431,7 @@
+ /* FIXME: This seems to be fixed in GLibc v2.14. */
+ # define GETCONTEXT_FPU_EXCMASK_BUG
+ # endif
+-# if defined(__GLIBC__)
++# if defined(__GLIBC__) && !defined(__UCLIBC__)
+ /* Workaround lock elision implementation for some glibc. */
+ # define GLIBC_2_19_TSX_BUG
+ # include <gnu/libc-version.h> /* for gnu_get_libc_version() */
+--
+2.11.0
+