.symver

Tom Kacvinsky tkacvins@gmail.com
Tue Jan 19 15:26:37 GMT 2021


I cloned the git repo for binutils-gdb, but don't see a tag for 2.36.
The last commit I see when running git log is

ccbe4c82d5219502806dc62aa1cf51e5b1a4b479

on December 23rd 2020

Tom

On Tue, Jan 19, 2021 at 9:51 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> 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