This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Version script help needed
At 22:00 03.08.2002, H. J. Lu wrote:
On Sat, Aug 03, 2002 at 07:04:18PM +0200, Franz Sirl wrote:
> On Samstag, 3. August 2002 18:33, H. J. Lu wrote:
> > On Sat, Aug 03, 2002 at 05:57:37PM +0200, Franz Sirl wrote:
> > > 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?
> >
> > I don't see there is a problem.
>
> Hmm, I seem to miss the logic then. If you don't strip mylibgcc2.so,
you'll
> see:
>
> [fsirl@enzo:~/test-versioning]$ readelf -a mylibgcc2.so|grep divdi3
> 31: 00000708 36 FUNC GLOBAL DEFAULT 9 divdi3@@VERNEW
> 69: 00000000 0 FILE LOCAL DEFAULT ABS divdi3-old.c
> 70: 00000000 0 FILE LOCAL DEFAULT ABS divdi3-new.c
> 78: 000006e4 36 FUNC LOCAL DEFAULT 9 divdi3@VEROLD
> 190: 000006e4 36 FUNC LOCAL DEFAULT 9 divdi3_old
> 200: 00000708 36 FUNC GLOBAL DEFAULT 9 divdi3
>
> So divdi3 got versioned as VEROLD, but it wasn't globalized. On the
other hand
> if I mention divdi3 under VEROLD too in the script (and you can't directly
> list divdi3@VEROLD in there), I don't get divdi3 at VERNEW, even though
it is
> mentioned there.
>
> I guess what I'm trying to say, why isn't the symbol matching in version
> scripts limited to unversioned symbols and symbols matching the current
> version node for a particular version node?
I can't guess what you really want. Why not tell us what you want in
the resulting DSO?
I still want the same as in my first mail in the DSO:
31: 00000708 36 FUNC GLOBAL DEFAULT 9 divdi3@@VERNEW
78: 000006e4 36 FUNC GLOBAL DEFAULT 9 divdi3@VEROLD
And I wanted to accomplish that without having an explicit .symver for the
VERNEW symbol version.
I think I just don't understand how the symbol matching in a version script
works. With this script:
VEROLD {
global:
divdi3;
};
VERNEW {
global:
divdi3;
local:
*;
} VEROLD;
I would have expected matching pseudo code like that:
for(sym in (all symbols in all objects))
{
if (sym exactmatch divdi3@VEROLD)
{
globalize sym;
continue;
}
if (sym exactmatch divdi3@@VEROLD)
{
globalize sym;
continue;
}
if (sym exactmatch divdi3@@VERNEW)
{
globalize sym;
continue;
}
/* check the youngest version child first */
if (sym exactmatch (divdi3 in global: VERNEW list))
{
attach default version @@VERNEW to sym;
globalize sym;
continue;
}
if (sym exactmatch (divdi3 in global: VEROLD list))
{
attach default version @@VEROLD to sym;
globalize sym;
continue;
}
if (sym exactmatch (local: symbols))
{
localize sym;
continue;
}
else
pass thru sym;
}
Or maybe a bit simplified:
for(sym in (all symbols in all objects))
{
if (sym is already versioned)
{
pass thru sym;
continue;
}
/* check the youngest version child first */
if (sym exactmatch (divdi3 in global: VERNEW list))
{
attach default version @@VERNEW to sym;
globalize sym;
continue;
}
if (sym exactmatch (divdi3 in global: VEROLD list))
{
attach default version @@VEROLD to sym;
globalize sym;
continue;
}
if (sym exactmatch (local: symbols))
{
localize sym;
continue;
}
else
pass thru sym;
}
I guess the behaviour of symbol matching in version scripts is just badly
documented.
Anyway, I found relatively low-inasive solution for my GCC versioning
problem, so I think we'll just wait for the next guy stumbling into
problems :-).
Franz.