This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: RFC: Add dynamic list to version script
On Wed, Jul 26, 2006 at 06:42:03PM +0200, Michael Matz wrote:
> 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.
Can you show me your example?
>
> 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.
>
The dynamic verion script doesn't imply -Bsymbolic and shouldn't be used
together with -Bsymbolic since -Bsymbolic will set DF_SYMBOLIC and
dynamic linker will treat the DSO differently. What it does is to bind
all symbols locally except for which are undefined or on the dynamic
list.
BTW, I'd like to have a new option name and I am thinking to add an
option to make C++ symbols dynamic automatically. Does anyone have
any suggestions for new option name?
H.J.