Versioning headaches
Kaz Kylheku
kaz@ashi.footprints.net
Tue Apr 25 22:44:00 GMT 2000
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
More information about the Libc-alpha
mailing list