This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [BUG] ld behavior varies for C++ static initializer depending on .a or .o input


Hal Black <black at ieee dot org> writes:

> > No Unix linker has ever worked that way.
> 
> Well, for most of the lifetime of Unix, there were no static
> initializers, since there was no C++, so this is not surprising.

C++ has had static initializers at least since 1985, so it's not all
that new.

> If .a is meant only for what it has been used for decades without
> changing to accomodate the full C++ specification, you're right, I
> misunderstood the usage for it.  That is definately not what I
> want. Based on the other replies, I guess that .so can be used to
> acheive the desired behavior even though it includes too much.

I'm not sure in what sense a .so file includes too much.  A .so file
is a very rough replacement for a .a file, so the fact that it
includes everything which is in the .a file is a feature.  It's true
that a .so file will always run all the static initializers which are
found in the .a file, but that's the very feature you want to
implement.  There are various differences in the implementation of
common symbols, but C++ disallows common symbols so that shouldn't
matter too much.  Warning symbols no longer work correctly, but that
is a GNU extension anyhow.  A .so is admittedly slightly slower, but
that rarely matters these days.

So what are your concerns with using a .so?

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]