diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4ae341895a4a1232ce7cd3408d616373d446ef54..157286db47266ae7f9eeb2468640a8f1cdb25eb1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2010-09-06  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+	PR libobjc/19850
+	* gthr-posix.h (__gthread_objc_thread_detach): Use
+	_objc_thread_attribs when detaching a thread.
+	* gthr-posix95.h (__gthread_objc_thread_detach): Same change.
+
 2010-09-06  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR target/45524
diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h
index bda43cd33c3dd78594d3e6db44e8c9952deae0c0..47b881707696bbb0f340b55eee96336e3b064c1f 100644
--- a/gcc/gthr-posix.h
+++ b/gcc/gthr-posix.h
@@ -370,7 +370,8 @@ __gthread_objc_thread_detach (void (*func)(void *), void *arg)
   if (!__gthread_active_p ())
     return NULL;
 
-  if (!(__gthrw_(pthread_create) (&new_thread_handle, NULL, (void *) func, arg)))
+  if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
+				  (void *) func, arg)))
     thread_id = (objc_thread_t) new_thread_handle;
   else
     thread_id = NULL;
diff --git a/gcc/gthr-posix95.h b/gcc/gthr-posix95.h
index 2b26f2da59dc44492ee0add652c3f31e49451a0a..69596d3a21904fec44709795318573cb49faf99a 100644
--- a/gcc/gthr-posix95.h
+++ b/gcc/gthr-posix95.h
@@ -294,7 +294,8 @@ __gthread_objc_thread_detach (void (*func)(void *), void *arg)
   if (!__gthread_active_p ())
     return NULL;
 
-  if (!(__gthrw_(pthread_create) (&new_thread_handle, NULL, (void *) func, arg)))
+  if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
+				  (void *) func, arg)))
     thread_id = (objc_thread_t) new_thread_handle;
   else
     thread_id = NULL;