From d5d8a06bb43d1d8c382b630ab9b681ca1f7f13df Mon Sep 17 00:00:00 2001
From: Pavel Chupin <pavel.v.chupin@intel.com>
Date: Tue, 2 Apr 2013 12:11:56 +0400
Subject: [PATCH] Redesign pthread in LIB_SPEC for systems without libpthread

Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
---
 gcc/config/gnu-user.h      | 5 ++---
 gcc/config/linux-android.h | 3 ++-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index bcdf0e6..cad6760 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -74,11 +74,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
 
 #define GNU_USER_TARGET_LIB_SPEC \
-  "%{pthread:-lpthread} \
-   %{shared:-lc} \
+   "%{shared:-lc} \
    %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}"
 #undef  LIB_SPEC
-#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
+#define LIB_SPEC "%{pthread:-lpthread} " GNU_USER_TARGET_LIB_SPEC
 
 #if defined(HAVE_LD_EH_FRAME_HDR)
 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
index 831a19c..aaf1d34 100644
--- a/gcc/config/linux-android.h
+++ b/gcc/config/linux-android.h
@@ -49,7 +49,8 @@
   "%{!frtti:%{!fno-rtti: -fno-rtti}}"
 
 #define ANDROID_LIB_SPEC \
-  "%{!static: -ldl}"
+  "%{!static: -ldl}" \
+  "%{pthread: -lc}"
 
 #define ANDROID_STARTFILE_SPEC						\
   "%{shared: crtbegin_so%O%s;:"						\
-- 
1.7.11.4

