This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: RFC: Add dynamic list to version script
- From: Michael Matz <matz at suse dot de>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 26 Jul 2006 18:42:03 +0200 (CEST)
- Subject: Re: RFC: Add dynamic list to version script
- References: <20060724221020.GA22024@lucon.org>
Hi H.J.,
On Mon, 24 Jul 2006, H. J. Lu wrote:
> Here is a prototype, which added dynamic list to version script. I used
>
> {
> dynamic:
> extern "C++"
> {
> *typeinfo*;
> };
> };
>
> It seems to work correctly with execptions between shared C++ libraries.
Yep. Though it slightly changes the output even without using a version
script but using -Bsymbolic. For instance a very simple library defining
just one class 'A' with a ctor has this set of interesting relocs without
the patch, without any flag:
000017a0 00001201 R_386_32 00000730 _ZTS1A
00001884 00001506 R_386_GLOB_DAT 0000179c _ZTI1A
0000189c 00001407 R_386_JUMP_SLOT 000006ca _ZN1AC1Ei
With -Bsymbolic (still not applied the patch) this changes as expected to:
000018a0 00000008 R_386_RELATIVE
000018a4 00000008 R_386_RELATIVE
(and no JUMP_SLOT entry for the ctor), i.e. all three references are bound
locally. When the patch is applied, no version script is used, but
-Bsymbolic I have this set of relocs:
000018a4 00000008 R_386_RELATIVE
00001790 00001201 R_386_32 00000720 _ZTS1A
So, no reference to the typeinfo node or the ctor anymore, locally bound.
But still a reference to the typeinfo name symbol. As said, with
-Bsymbolic and no version script. I think some of the (info->dynamic &&
!h->dynamic) conditions are wrong. With a version script I get this set
of relocs:
00001790 00001201 R_386_32 00000720 _ZTS1A
00001874 00001506 R_386_GLOB_DAT 0000178c _ZTI1A
(no JUMP_SLOT, as expected that's now bound locally). With -Bsymbolic the
_ZTI1A reloc goes away, but the _ZTS1A remains.
I find the overloading of semantics a bit confusing. I mean that using a
version script with the "dynamic" tag implicitely has the effect of
-Bsymbolic without actually mentioning that flag. This means that an
empty version script using the "dynamic" tag is the opposite of using no
version script. Perhaps such version script should only have an effect if
the user also specifies -Bsymbolic (i.e. creating exceptions to the
-Bsymbolic symbol set). OTOH it's documented so it's not that important.
Oh, and yes, throwing exceptions does work, while without the version
script it does not :-) Nice.
Ciao,
Michael.