From 7aa44b2465899165cf81874a60a0fdcd858a041c Mon Sep 17 00:00:00 2001
From: Dharanendiran <dharanendiran@timesys.com>
Date: Tue, 30 Oct 2018 11:44:44 +0530
Subject: [PATCH] glibc: Fix the undefined reference to `__glibc_unlikely'

/factory-20181011/build_armv7l-timesys-linux-gnueabi/glibc-2.12.1/glibc-2.12.1-build/libc_nonshared.a /factory-20181011/build_armv7l-timesys-linux-gnueabi/glibc-2.12.1/glibc-2.12.1-build/nptl/libpthread_nonshared.a /factory-20181011/build_armv7l-timesys-linux-gnueabi/glibc-2.12.1/glibc-2.12.1-build/nptl/libpthread.so
/factory-20181011/build_armv7l-timesys-linux-gnueabi/glibc-2.12.1/glibc-2.12.1-build/resolv/libresolv_pic.a(res_send.os): In function `send_dg':
/factory-20181011/build_armv7l-timesys-linux-gnueabi/glibc-2.12.1/glibc-2.12.1/resolv/res_send.c:1308: undefined reference to `__glibc_unlikely'
/factory-20181011/build_armv7l-timesys-linux-gnueabi/glibc-2.12.1/glibc-2.12.1/resolv/res_send.c:1308: undefined reference to `__glibc_unlikely'
collect2: error: ld returned 1 exit status
make[3]: *** [/factory-20181011/build_armv7l-timesys-linux-gnueabi/glibc-2.12.1/glibc-2.12.1-build/resolv/libresolv.so] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory `/factory-20181011/build_armv7l-timesys-linux-gnueabi/glibc-2.12.1/glibc-2.12.1/resolv'
make[2]: *** [resolv/others] Error 2
make[2]: Leaving directory `/factory-20181011/build_armv7l-timesys-linux-gnueabi/glibc-2.12.1/glibc-2.12.1'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/factory-20181011/build_armv7l-timesys-linux-gnueabi/glibc-2.12.1/glibc-2.12.1-build'
make: *** [/factory-20181011/build_armv7l-timesys-linux-gnueabi/glibc-2.12.1/.stamp_stage2_built] Error 2
---
 misc/sys/cdefs.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index c9495a4..c204c95 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -350,6 +350,14 @@
 # endif
 #endif
 
+#if __GNUC__ >= 3
+# define __glibc_unlikely(cond)	__builtin_expect ((cond), 0)
+# define __glibc_likely(cond)	__builtin_expect ((cond), 1)
+#else
+# define __glibc_unlikely(cond)	(cond)
+# define __glibc_likely(cond)	(cond)
+#endif
+
 #include <bits/wordsize.h>
 
 #if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
-- 
2.17.1

