2010/4/27 Timo Teräs <[email protected]>:
> Andreas Schultz wrote:
>>
>> 2010/4/27 Timo Teräs <[email protected]>:
>>>
>>> Andreas Schultz wrote:
>>
>> [...]
>>
>>> Uh. Is the application linked against libc before libpthread?
>>
>> The application is not directly linked against libpthread, but one of
>> the other libraries pulls it in.
>
> This has never worked on MIPS. Someone needs to implement the
> protected symbol support for mips ld.so.
>
>>> Check with ldd the order of how libraries are pulled in.
>>>
>>>> Looking at init.c my best guess would be that
>>>> .ptr__pthread_cleanup_push_defer should be initialized with
>>>> __pthread_cleanup_push_defer and not with _pthread_cleanup_push_defer
>>>> (two undelines instead of one).
>>>
>>> It's because MIPS ld.so is not supporting protected symbols yet.
>>> Mmm... Using the two underscore variant might help for immediate
>>> problems, but other things will broken unless protected symbols
>>> are implemented.
>>
>> The two underscore change alone is not sufficient, i have now managed
>> to get it working with the attached patch. Everything seems to fine so
>> far.
>
> Forgot to attach the patch?

ups, yes...

> I learned the hard way that it's not easily doable without the
> protected symbols. Otherwise you easily mess up one of the weird
> linking scenarios or how libc-libpthread interacts.

mhh, there seem to be lots of protected symbols.... :-(

>
>>> Changing linking order of application to pull in libpthread first
>>> should fix it too.
>>
>> I'll try that...
>
> Hacky solution for you is to add -lpthread for your main application.
> Proper solution is protected symbol support in ld.so.

Andreas
diff -up uClibc-00891d9cf07efd992023f255164bba93d657ece4/libpthread/nptl/cleanup_defer_compat.c.orig uClibc-00891d9cf07efd992023f255164bba93d657ece4/libpthread/nptl/cleanup_defer_compat.c
--- uClibc-00891d9cf07efd992023f255164bba93d657ece4/libpthread/nptl/cleanup_defer_compat.c.orig	2010-04-27 12:08:51.394947028 +0200
+++ uClibc-00891d9cf07efd992023f255164bba93d657ece4/libpthread/nptl/cleanup_defer_compat.c	2010-04-27 12:10:57.283527465 +0200
@@ -22,7 +22,7 @@
 
 void
 attribute_protected
-_pthread_cleanup_push_defer (
+__pthread_cleanup_push_defer (
      struct _pthread_cleanup_buffer *buffer,
      void (*routine) (void *),
      void *arg)
@@ -57,12 +57,12 @@ _pthread_cleanup_push_defer (
 
   THREAD_SETMEM (self, cleanup, buffer);
 }
-strong_alias (_pthread_cleanup_push_defer, __pthread_cleanup_push_defer)
+strong_alias (__pthread_cleanup_push_defer, _pthread_cleanup_push_defer)
 
 
 void
 attribute_protected
-_pthread_cleanup_pop_restore (
+__pthread_cleanup_pop_restore (
      struct _pthread_cleanup_buffer *buffer,
      int execute)
 {
@@ -97,4 +97,4 @@ _pthread_cleanup_pop_restore (
   if (execute)
     buffer->__routine (buffer->__arg);
 }
-strong_alias (_pthread_cleanup_pop_restore, __pthread_cleanup_pop_restore)
+strong_alias (__pthread_cleanup_pop_restore, _pthread_cleanup_pop_restore);
diff -up uClibc-00891d9cf07efd992023f255164bba93d657ece4/libpthread/nptl/init.c.orig uClibc-00891d9cf07efd992023f255164bba93d657ece4/libpthread/nptl/init.c
--- uClibc-00891d9cf07efd992023f255164bba93d657ece4/libpthread/nptl/init.c.orig	2010-04-27 11:41:24.412501635 +0200
+++ uClibc-00891d9cf07efd992023f255164bba93d657ece4/libpthread/nptl/init.c	2010-04-27 11:42:32.518662841 +0200
@@ -112,8 +112,8 @@ static const struct pthread_functions pt
     .ptr___pthread_key_create = __pthread_key_create_internal,
     .ptr___pthread_getspecific = __pthread_getspecific_internal,
     .ptr___pthread_setspecific = __pthread_setspecific_internal,
-    .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,
     .ptr_nthreads = &__nptl_nthreads,
     .ptr___pthread_unwind = &__pthread_unwind,
     .ptr__nptl_deallocate_tsd = __nptl_deallocate_tsd,
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to