Version script help needed

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Sat Aug 3 08:57:00 GMT 2002


On Samstag, 3. August 2002 16:22, H. J. Lu wrote:
> On Sat, Aug 03, 2002 at 02:45:36PM +0200, Franz Sirl wrote:
> > Hi,
> >
> > I'm at a loss with the handling of version scripts. If you look at the
> > appended testcase, you'll see that it generates 2 small shared libs with
> > versioned symbols:
> >
> > [fsirl@enzo:~/test-versioning]$ readelf -a mylibgcc1.so|grep divdi3
> >     25: 0000068c    36 FUNC    GLOBAL DEFAULT    9 divdi3@VEROLD
> > [fsirl@enzo:~/test-versioning]$ readelf -a mylibgcc2.so|grep divdi3
> >     27: 000006b0    36 FUNC    GLOBAL DEFAULT    9 divdi3@@VERNEW
> >
> > But what I want is both versions in _one_ shared lib like that:
> >     25: 0000068c    36 FUNC    GLOBAL DEFAULT    9 divdi3@VEROLD
> >     27: 000006b0    36 FUNC    GLOBAL DEFAULT    9 divdi3@@VERNEW
> >
> > What am I doing wrong?
>
> Read the glibc source :-). Change divdi3-new.c to
>
> ---
>
> int divdi3_new (void)
> {
>   return 0;
> }
>
> asm (".symver divdi3_new,divdi3@@VERNEW");

Or not rename it use

	asm (".symver divdi3,divdi3@@@VERNEW");

instead.

One thing makes me wonder though, if I use .symver and a version script, why 
are versioned symbols matched? E. if I use .symver and the following version 
script

VEROLD {
     local:
     *;
};

VERNEW {
     local:
     *;
} VEROLD;

divdi3@VEROLD and divdi3@@VERNEW will be changed from GLOBAL scope to LOCAL 
scope. On the other side version scripts prevent me from from using versioned 
symbols in there? Is this the right behaviour?

Franz.



More information about the Binutils mailing list