This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Versioning headaches


>>>>> Kaz Kylheku writes:

 > On the main trunk, I'm trying to add a second interface change to a
 > function that already exists in two versions: one for 2.0 and one for 2.1.

 > The function in question is pthread_attr_init.

 > The problem is that I get a linker error:

 > gcc   -shared -Wl,-O1 -o libpthread.so  -Wl,-dynamic-linker=/usr/local/lib/ld-linux.so.2 -B../csu/ -Wl,--version-script=../libpthread.map -Wl,-soname=libpthread.so.0   -L.. -L../math -L../elf -L../dlfcn -L../nss -L../nis -L../rt -L../resolv -L../crypt -L.
 > -Wl,-rpath-link=..:../math:../elf:../dlfcn:../nss:../nis:../rt:../resolv:../crypt:. -Wl,--whole-archive libpthread_pic.a ../elf/interp.os ../libc.so -Wl,--no-whole-archive
 > ../libc.so(*IND*+0x0): multiple definition of `pthread_attr_init@GLIBC_2.1'
 > libpthread_pic.a(attr.os):/home/kaz/libc/linuxthreads-NEW/attr.c:47: first defined here

 > My qustion is, what is the correct way to do this?

 > I simply added the new version of the function as show below, with the
 > bodies of the functions trimmed for brevity and clarity of from:

 > int __pthread_attr_init_2_2(pthread_attr_t *attr)
 > {
 >     /* SNIP */
 > }

 > versioned_symbol (libpthread, __pthread_attr_init_2_2, pthread_attr_init,
 >                   GLIBC_2_2);

 > #if SHLIB_COMPAT(libpthread, GLIBC_2_1, GLIBC_2_2)
 > int __pthread_attr_init_2_1(pthread_attr_t *attr)
 > {
 >     /* SNIP */
 > }
 > compat_symbol (libpthread, __pthread_attr_init_2_1, pthread_attr_init,
 >                GLIBC_2_1);
 > #endif

 > #if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1)
 > int __pthread_attr_init_2_0(pthread_attr_t *attr)
 > {
 >     /* SNIP */
 > }
 > compat_symbol (libpthread, __pthread_attr_init_2_0, pthread_attr_init,
 >                GLIBC_2_0);
 > #endif

That looks fine at first.  Did you also add pthread_attr_init to
linuxthreads/Versions?

Please send a complete patch [1] and I'll try to compile this myself.

Andreas

Footnotes: 
[1]  I know the patch might have problems - I just want to help with
     this one.

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]