.symver
H.J. Lu
hjl.tools@gmail.com
Tue Jan 19 14:51:03 GMT 2021
On Tue, Jan 19, 2021 at 6:28 AM Tom Kacvinsky via Binutils
<binutils@sourceware.org> wrote:
>
> I have made more progress on this and it looks to me, for the code I
> am working with,
> that .symver overrides a symbol being marked as weak. So
>
> .weak pthread_key_create
> .symver pthread_key_create, pthread_key_create@GLIBC_2.2.5
>
> Removes the symbol as being marked weak and wants to resolve against
> pthread_key_create@GLIBC_2.2.5.
> That's what I've observed anyway. Sample code is
>
> #include <stdio.h>
> #include <pthread.h>
>
> extern int pthread_key_create (pthread_key_t *, void (*) (void *))
> __attribute__ ((weak));
> __asm__(".symver pthread_key_create,pthread_key_create@GLIBC_2.2.5");
>
> void destructor(void* arg) { return; }
>
> void thread_func() {
> pthread_key_t key;
>
> pthread_key_create(&key, destructor);
> }
>
> gcc -fPIC -o thread.so -save-temps -shared thread.c
> ld: error: symbol pthread_key_create has undefined version GLIBC_2.2.5
> collect2: error: ld returned 1 exit status
>
> Using binutils 2.34, but also happens with binutils 2.35.1
>
I made some improvements to .symver in binutils 2.36. They may help you.
--
H.J.
More information about the Binutils
mailing list