diff options
-rw-r--r-- | libpthread/linuxthreads.old/Makefile.in | 42 | ||||
-rw-r--r-- | libpthread/linuxthreads.old/forward.c | 21 | ||||
-rw-r--r-- | libpthread/linuxthreads.old/libc_pthread_init.c | 6 | ||||
-rw-r--r-- | libpthread/linuxthreads.old/pthread.c | 8 | ||||
-rw-r--r-- | libpthread/linuxthreads.old/semaphore.h | 17 | ||||
-rw-r--r-- | libpthread/linuxthreads.old/specific.c | 2 | ||||
-rw-r--r-- | libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h | 39 | ||||
-rw-r--r-- | libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h | 2 | ||||
-rw-r--r-- | libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h | 2 |
9 files changed, 75 insertions, 64 deletions
diff --git a/libpthread/linuxthreads.old/Makefile.in b/libpthread/linuxthreads.old/Makefile.in index 6b1232c32..fe29f2cd1 100644 --- a/libpthread/linuxthreads.old/Makefile.in +++ b/libpthread/linuxthreads.old/Makefile.in @@ -76,49 +76,47 @@ headers-$(UCLIBC_HAS_THREADS) += linuxthreads_headers 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: diff --git a/libpthread/linuxthreads.old/forward.c b/libpthread/linuxthreads.old/forward.c index 2cd019651..eeaefd7a3 100644 --- a/libpthread/linuxthreads.old/forward.c +++ b/libpthread/linuxthreads.old/forward.c @@ -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" diff --git a/libpthread/linuxthreads.old/libc_pthread_init.c b/libpthread/linuxthreads.old/libc_pthread_init.c index 0ef3b47fc..09606effb 100644 --- a/libpthread/linuxthreads.old/libc_pthread_init.c +++ b/libpthread/linuxthreads.old/libc_pthread_init.c @@ -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 @@ libc_hidden_proto(uselocale) 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 diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c index bdb64fdff..53b531465 100644 --- a/libpthread/linuxthreads.old/pthread.c +++ b/libpthread/linuxthreads.old/pthread.c @@ -371,8 +371,8 @@ struct pthread_functions __pthread_functions = .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 @@ libpthread_hidden_def (pthread_equal) #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 @@ static void pthread_handle_sigdebug(int sig attribute_unused) 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(); diff --git a/libpthread/linuxthreads.old/semaphore.h b/libpthread/linuxthreads.old/semaphore.h index 7b09ea931..fac2e5937 100644 --- a/libpthread/linuxthreads.old/semaphore.h +++ b/libpthread/linuxthreads.old/semaphore.h @@ -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 @@ extern int sem_init (sem_t *__sem, int __pshared, unsigned int __value) __THROW; /* 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 @@ extern int sem_close (sem_t *__sem) __THROW; /* 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_post (sem_t *__sem) __THROW; extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval) __THROW; + __END_DECLS -#endif /* semaphore.h */ +#endif /* semaphore.h */ diff --git a/libpthread/linuxthreads.old/specific.c b/libpthread/linuxthreads.old/specific.c index 72409b30b..dd86148d8 100644 --- a/libpthread/linuxthreads.old/specific.c +++ b/libpthread/linuxthreads.old/specific.c @@ -134,7 +134,7 @@ void * pthread_getspecific(pthread_key_t key) /* 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; diff --git a/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h index 989641439..a6256c58f 100644 --- a/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h +++ b/libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h @@ -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 @@ __compare_and_swap (long int *p, long int oldval, long int newval) 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,7 +83,7 @@ __compare_and_swap (long int *p, long int oldval, long int newval) #else /* Generic i386 implementation */ - +extern int compare_and_swap_is_available (void); /* Spinlock implementation; required. */ PT_EI long int @@ -123,34 +121,21 @@ __compare_and_swap (long int *p, long int oldval, long int newval) 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; diff --git a/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h b/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h index ce56ea30d..2b889e621 100644 --- a/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h +++ b/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h @@ -37,7 +37,7 @@ enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0, #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> diff --git a/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h index 4ec87ad89..793f80b2d 100644 --- a/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h +++ b/libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h @@ -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) |