From: Tom Hughes Date: Sun, 15 Aug 2004 14:11:12 +0000 (+0000) Subject: Back out yesterday's change to the symbol versioning in the pthread X-Git-Tag: svn/VALGRIND_2_2_0~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8932f4011b2403f30985fe29472b1d7542c6c1b;p=thirdparty%2Fvalgrind.git Back out yesterday's change to the symbol versioning in the pthread library - it seems that I misunderstood hom the versioning works and a system looking for a GLIBC_PRIVATE version of the clock routines would not find the GLIB_2.2.3 one even with the inheritance. It only seemed to be working on glibc 2.3 systems because of the version overrides in the source code, but it failed on glibc 2.2.5 systems. The new approach is to explicity create two versions of the routines in question, one with a version of GLIBC_2.2.3 and one with a version of GLIBC_PRIVATE instead. This has been tested on six different systems and appears to work everywhere. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2586 --- diff --git a/coregrind/vg_libpthread.vs b/coregrind/vg_libpthread.vs index 4196b9a924..847f07d41a 100644 --- a/coregrind/vg_libpthread.vs +++ b/coregrind/vg_libpthread.vs @@ -155,11 +155,6 @@ GLIBC_2.2.3 { # Extensions. pthread_getattr_np; - # These are in GLIBC_PRIVATE in the real library now but keep them - # here for now for backwards compatibiltiy - they will still be - # visible to programs linked agianst newer libraries because of - # the inheritance into GLIB_PRIVATE in this library. - __pthread_clock_gettime; __pthread_clock_settime; } GLIBC_2.2; GLIBC_2.2.6 { @@ -197,6 +192,10 @@ } GLIBC_2.3.2; GLIBC_PRIVATE { - __pthread_initialize_minimal; __pthread_cleanup_upto; - __pthread_unwind; - } GLIBC_2.3.3; + global: + __pthread_initialize_minimal; __pthread_cleanup_upto; + __pthread_clock_gettime; __pthread_clock_settime; + __pthread_unwind; + local: + __pthread_clock_gettime_*; __pthread_clock_settime_*; + }; diff --git a/coregrind/vg_libpthread_unimp.c b/coregrind/vg_libpthread_unimp.c index 0b1e2425f2..805563063e 100644 --- a/coregrind/vg_libpthread_unimp.c +++ b/coregrind/vg_libpthread_unimp.c @@ -34,7 +34,17 @@ Give a binding for everything the real libpthread.so binds. ------------------------------------------------------------------ */ -#include "vg_include.h" /* For GLIBC_2_3, or not, as the case may be */ +# define strong_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name))); + +# define weak_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); + +# define symbol_version(real, name, version) \ + __asm__(".symver " #real "," #name "@" #version) + +# define default_symbol_version(real, name, version) \ + __asm__(".symver " #real "," #name "@@" #version) extern void vgPlain_unimp ( char* ); #define unimp(str) vgPlain_unimp(str) @@ -163,48 +173,16 @@ void sem_unlink ( void ) { unimp("sem_unlink"); } //void siglongjmp ( void ) { unimp("siglongjmp"); } //void sigwait ( void ) { unimp("sigwait"); } -void __pthread_clock_gettime ( void ) { unimp("__pthread_clock_gettime"); } -void __pthread_clock_settime ( void ) { unimp("__pthread_clock_settime"); } -#ifdef GLIBC_2_3 -/* Needed for Red Hat 8.0 */ -__asm__(".symver __pthread_clock_gettime," - "__pthread_clock_gettime@GLIBC_PRIVATE"); -__asm__(".symver __pthread_clock_settime," - "__pthread_clock_settime@GLIBC_PRIVATE"); -#endif - - -#if 0 -void pthread_create@@GLIBC_2.1 ( void ) { unimp("pthread_create@@GLIBC_2.1"); } -void pthread_create@GLIBC_2.0 ( void ) { unimp("pthread_create@GLIBC_2.0"); } - -void sem_wait@@GLIBC_2.1 ( void ) { unimp("sem_wait@@GLIBC_2.1"); } -void sem_wait@GLIBC_2.0 ( void ) { unimp("sem_wait@GLIBC_2.0"); } +void __pthread_clock_gettime_private ( void ) { unimp("__pthread_clock_gettime"); } +void __pthread_clock_settime_private ( void ) { unimp("__pthread_clock_settime"); } +strong_alias(__pthread_clock_gettime_private, __pthread_clock_gettime_223); +strong_alias(__pthread_clock_settime_private, __pthread_clock_settime_223); +symbol_version(__pthread_clock_gettime_223, __pthread_clock_gettime, GLIBC_2.2.3); +symbol_version(__pthread_clock_settime_223, __pthread_clock_settime, GLIBC_2.2.3); +default_symbol_version(__pthread_clock_gettime_private, __pthread_clock_gettime, GLIBC_PRIVATE); +default_symbol_version(__pthread_clock_settime_private, __pthread_clock_settime, GLIBC_PRIVATE); -void sem_trywait@@GLIBC_2.1 ( void ) { unimp("sem_trywait@@GLIBC_2.1"); } -void sem_trywait@GLIBC_2.0 ( void ) { unimp("sem_trywait@GLIBC_2.0"); } -void sem_post@@GLIBC_2.1 ( void ) { unimp("sem_post@@GLIBC_2.1"); } -void sem_post@GLIBC_2.0 ( void ) { unimp("sem_post@GLIBC_2.0"); } - -void sem_destroy@@GLIBC_2.1 ( void ) { unimp("sem_destroy@@GLIBC_2.1"); } -void sem_destroy@GLIBC_2.0 ( void ) { unimp("sem_destroy@GLIBC_2.0"); } -void sem_getvalue@@GLIBC_2.1 ( void ) { unimp("sem_getvalue@@GLIBC_2.1"); } -void sem_getvalue@GLIBC_2.0 ( void ) { unimp("sem_getvalue@GLIBC_2.0"); } -void sem_init@@GLIBC_2.1 ( void ) { unimp("sem_init@@GLIBC_2.1"); } -void sem_init@GLIBC_2.0 ( void ) { unimp("sem_init@GLIBC_2.0"); } - -void pthread_attr_init@@GLIBC_2.1 ( void ) { unimp("pthread_attr_init@@GLIBC_2.1"); } -void pthread_attr_init@GLIBC_2.0 ( void ) { unimp("pthread_attr_init@GLIBC_2.0"); } -#endif - - - -# define strong_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((alias (#name))); - -# define weak_alias(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); //weak_alias(pthread_rwlock_destroy, __pthread_rwlock_destroy) //weak_alias(pthread_rwlock_init, __pthread_rwlock_init)