svn commit: branches/uClibc-nptl/libpthread/linuxthreads.old: sysdeps/i386 sysdeps/pthread/bits sysde etc...

carmelo at uclibc.org carmelo at uclibc.org
Wed Jun 18 14:37:28 UTC 2008


Author: carmelo
Date: 2008-06-18 07:37:26 -0700 (Wed, 18 Jun 2008)
New Revision: 22416

Log:
Synch linuxthreads.old with trunk

Modified:
   branches/uClibc-nptl/libpthread/linuxthreads.old/Makefile.in
   branches/uClibc-nptl/libpthread/linuxthreads.old/forward.c
   branches/uClibc-nptl/libpthread/linuxthreads.old/libc_pthread_init.c
   branches/uClibc-nptl/libpthread/linuxthreads.old/pthread.c
   branches/uClibc-nptl/libpthread/linuxthreads.old/semaphore.h
   branches/uClibc-nptl/libpthread/linuxthreads.old/specific.c
   branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h
   branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h
   branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h


Changeset:
Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/Makefile.in
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/Makefile.in	2008-06-18 14:36:55 UTC (rev 22415)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/Makefile.in	2008-06-18 14:37:26 UTC (rev 22416)
@@ -76,49 +76,47 @@
 headers_clean-y += linuxthreads_headers_clean
 
 #ifeq ($(DOMULTI),n)
-$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc)
+$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend)
 	$(call link.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
 #else
-#$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread.oS | $(libc)
+#$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread.oS | $(libc.depend)
 #	$(call linkm.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
 #endif
 
-$(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y)
-	$(Q)$(RM) $@
 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
-	$(do_strip:-x=-X --strip-debug)
-else
-	$(do_strip)
+$(libpthread_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
 endif
+$(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y)
+	$(Q)$(RM) $@
 	$(do_ar)
 
+ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
+$(libpthread_OUT)/libpthread.oS: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
+endif
 $(libpthread_OUT)/libpthread.oS: $(libpthread_SRC) $(libpthread_SPEC_SRC)
 	$(Q)$(RM) $@
 	$(compile-m)
+
 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
-	$(do_t_strip:-x=-X --strip-debug)
-else
-	$(do_t_strip)
+$(top_builddir)lib/libpthread.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
 endif
-
 $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
 	$(Q)$(INSTALL) -d $(dir $@)
 	$(Q)$(RM) $@
-ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
-	$(do_strip:-x=-X --strip-debug)
-else
-	$(do_strip)
-endif
 	$(do_ar)
 
-linuxthreads_headers:
-	$(Q)$(LN) -sf ../$(PTDIR)/sysdeps/pthread/pthread.h $(top_builddir)include/
-	$(Q)$(LN) -sf ../$(PTDIR)/semaphore.h $(top_builddir)include/
-	$(Q)$(INSTALL) -d $(top_builddir)include/bits
-	$(Q)$(LN) -sf ../../$(PTDIR)/sysdeps/pthread/bits/pthreadtypes.h $(top_builddir)include/bits/
+include/pthread.h:
+	$(do_ln) ../$(PTDIR)/sysdeps/pthread/$(@F) $(top_builddir)$@
+include/semaphore.h:
+	$(do_ln) ../$(PTDIR)/$(@F) $(top_builddir)$@
+include/bits/pthreadtypes.h: | include/bits
+	$(do_ln) ../../$(PTDIR)/sysdeps/pthread/bits/$(@F) $(top_builddir)$@
+linuxthreads_headers: include/pthread.h include/semaphore.h \
+			include/bits/pthreadtypes.h
 
 linuxthreads_headers_clean:
-	$(RM) $(top_builddir)include/pthread.h $(top_builddir)include/semaphore.h \
+	$(RM) $(top_builddir)include/pthread.h \
+		$(top_builddir)include/semaphore.h \
 		$(top_builddir)include/bits/pthreadtypes.h
 
 libpthread_clean:

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/forward.c
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/forward.c	2008-06-18 14:36:55 UTC (rev 22415)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/forward.c	2008-06-18 14:37:26 UTC (rev 22416)
@@ -23,6 +23,27 @@
 
 /* psm: keep this before internals.h */
 libc_hidden_proto(exit)
+/* vda: here's why:
+In libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h
+adding libc_hidden_proto(foo) just before weak_extern (__pthread_initialize)
+will not warn:
+    //libc_hidden_proto(foo)
+    weak_extern (__pthread_initialize)
+    //libc_hidden_proto(foo)
+but adding after will! Which is extremely strange -
+weak_extern expands into just "#pragma weak __pthread_initialize".
+TODO: determine whether it is a gcc bug or what
+(see gcc.gnu.org/bugzilla/show_bug.cgi?id=36282).
+For now, just include all headers before internals.h
+(they are again included in internals.h - maybe remove them there later)
+*/
+#include <string.h>
+#include <limits.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
 
 #include "internals.h"
 

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/libc_pthread_init.c
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/libc_pthread_init.c	2008-06-18 14:36:55 UTC (rev 22415)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/libc_pthread_init.c	2008-06-18 14:37:26 UTC (rev 22416)
@@ -24,7 +24,7 @@
 #include "internals.h"
 #include "sysdeps/pthread/pthread-functions.h"
 
-libc_hidden_proto(memcpy)
+/* Experimentally off - libc_hidden_proto(memcpy) */
 
 #if !(USE_TLS && HAVE___THREAD) && defined __UCLIBC_HAS_XLOCALE__
 libc_hidden_proto(uselocale)
@@ -32,9 +32,7 @@
 
 int __libc_multiple_threads attribute_hidden __attribute__((nocommon));
 
-int *
-__libc_pthread_init (functions)
-     const struct pthread_functions *functions;
+int * __libc_pthread_init (const struct pthread_functions *functions)
 {
 #ifdef SHARED
   /* We copy the content of the variable pointed to by the FUNCTIONS

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/pthread.c
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/pthread.c	2008-06-18 14:36:55 UTC (rev 22415)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/pthread.c	2008-06-18 14:37:26 UTC (rev 22416)
@@ -371,8 +371,8 @@
     .ptr__pthread_cleanup_push = _pthread_cleanup_push,
     .ptr__pthread_cleanup_pop = _pthread_cleanup_pop
 */
-    .ptr__pthread_cleanup_push_defer = _pthread_cleanup_push_defer,
-    .ptr__pthread_cleanup_pop_restore = _pthread_cleanup_pop_restore,
+    .ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer,
+    .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore,
   };
 #ifdef SHARED
 # define ptr_pthread_functions &__pthread_functions
@@ -685,7 +685,7 @@
 
 #ifndef THREAD_SELF
 
-pthread_descr __pthread_find_self()
+pthread_descr __pthread_find_self(void)
 {
   char * sp = CURRENT_STACK_FRAME;
   pthread_handle h;
@@ -890,7 +890,7 @@
    Notice that we can't free the stack segments, as the forked thread
    may hold pointers into them. */
 
-void __pthread_reset_main_thread()
+void __pthread_reset_main_thread(void)
 {
   pthread_descr self = thread_self();
 

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/semaphore.h
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/semaphore.h	2008-06-18 14:36:55 UTC (rev 22415)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/semaphore.h	2008-06-18 14:37:26 UTC (rev 22416)
@@ -13,7 +13,7 @@
 /* GNU Library General Public License for more details.                 */
 
 #ifndef _SEMAPHORE_H
-#define _SEMAPHORE_H    1
+#define _SEMAPHORE_H	1
 
 #include <features.h>
 #include <sys/types.h>
@@ -54,7 +54,7 @@
 /* Free resources associated with semaphore object SEM.  */
 extern int sem_destroy (sem_t *__sem) __THROW;
 
-/* Open a named semaphore NAME with open flaot OFLAG.  */
+/* Open a named semaphore NAME with open flags OFLAG.  */
 extern sem_t *sem_open (__const char *__name, int __oflag, ...) __THROW;
 
 /* Close descriptor for named semaphore SEM.  */
@@ -63,11 +63,17 @@
 /* Remove named semaphore NAME.  */
 extern int sem_unlink (__const char *__name) __THROW;
 
-/* Wait for SEM being posted.  */
+/* Wait for SEM being posted.
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
 extern int sem_wait (sem_t *__sem);
 
 #ifdef __USE_XOPEN2K
-/* Similar to `sem_wait' but wait only until ABSTIME.  */
+/* Similar to `sem_wait' but wait only until ABSTIME.
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
 extern int sem_timedwait (sem_t *__restrict __sem,
 			  __const struct timespec *__restrict __abstime);
 #endif
@@ -82,6 +88,7 @@
 extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval)
      __THROW;
 
+
 __END_DECLS
 
-#endif  /* semaphore.h */
+#endif	/* semaphore.h */

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/specific.c
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/specific.c	2008-06-18 14:36:55 UTC (rev 22415)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/specific.c	2008-06-18 14:37:26 UTC (rev 22416)
@@ -134,7 +134,7 @@
 
 /* Call the destruction routines on all keys */
 
-void __pthread_destroy_specifics()
+void __pthread_destroy_specifics(void)
 {
     pthread_descr self = thread_self();
     int i, j, round, found_nonzero;

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h	2008-06-18 14:36:55 UTC (rev 22415)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h	2008-06-18 14:37:26 UTC (rev 22416)
@@ -26,13 +26,11 @@
 
 #ifndef __ASSEMBLER__
 #ifndef PT_EI
-# define PT_EI __extern_always_inline
+# define PT_EI __extern_always_inline __attribute__((visibility("hidden")))
 #endif
 
-/*
 extern long int testandset (int *spinlock);
 extern int __compare_and_swap (long int *p, long int oldval, long int newval);
-*/
 
 /* Get some notion of the current stack.  Need not be exactly the top
    of the stack, just something somewhere in the current frame.  */
@@ -75,8 +73,8 @@
   return ret;
 }
 
-#if __ASSUME_LDT_WORKS > 0
-#include "../useldt.h"
+#if defined(__ASSUME_LDT_WORKS) && __ASSUME_LDT_WORKS > 0
+#include "useldt.h"
 #endif
 
 /* The P4 and above really want some help to prevent overheating.  */
@@ -85,8 +83,8 @@
 
 #else /* Generic i386 implementation */
 
+extern int compare_and_swap_is_available (void);
 
-
 /* Spinlock implementation; required.  */
 PT_EI long int
 testandset (int *spinlock)
@@ -123,34 +121,21 @@
   return ret;
 }
 
-
 PT_EI int
-get_eflags (void)
-{
-  int res;
-  __asm__ __volatile__ ("pushfl; popl %0" : "=r" (res) : );
-  return res;
-}
-
-
-PT_EI void
-set_eflags (int newflags)
-{
-  __asm__ __volatile__ ("pushl %0; popfl" : : "r" (newflags) : "cc");
-}
-
-
-PT_EI int
 compare_and_swap_is_available (void)
 {
-  int oldflags = get_eflags ();
   int changed;
+  int oldflags;
+  /* get EFLAGS */
+  __asm__ __volatile__ ("pushfl; popl %0" : "=r" (oldflags) : );
   /* Flip AC bit in EFLAGS.  */
-  set_eflags (oldflags ^ 0x40000);
+  __asm__ __volatile__ ("pushl %0; popfl" : : "r" (oldflags ^ 0x40000) : "cc");
+  /* reread EFLAGS */
+  __asm__ __volatile__ ("pushfl; popl %0" : "=r" (changed) : );
   /* See if bit changed.  */
-  changed = (get_eflags () ^ oldflags) & 0x40000;
+  changed = (changed ^ oldflags) & 0x40000;
   /* Restore EFLAGS.  */
-  set_eflags (oldflags);
+  __asm__ __volatile__ ("pushl %0; popfl" : : "r" (oldflags) : "cc");
   /* If the AC flag did not change, it's a 386 and it lacks cmpxchg.
      Otherwise, it's a 486 or above and it has cmpxchg.  */
   return changed != 0;

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h	2008-06-18 14:36:55 UTC (rev 22415)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h	2008-06-18 14:37:26 UTC (rev 22416)
@@ -37,7 +37,7 @@
 
 #include <linuxthreads.old/internals.h>
 
-#if USE_TLS && HAVE___THREAD
+#if defined(USE_TLS) && USE_TLS && HAVE___THREAD
 
 /* When __thread works, the generic definition is what we want.  */
 # include <sysdeps/generic/bits/libc-tsd.h>

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h	2008-06-18 14:36:55 UTC (rev 22415)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h	2008-06-18 14:37:26 UTC (rev 22416)
@@ -29,6 +29,8 @@
 # define PT_EI __extern_always_inline
 #endif
 
+extern long int testandset (int *spinlock);
+
 /* Spinlock implementation; required.  */
 PT_EI long int
 testandset (int *spinlock)




More information about the uClibc-cvs mailing list