public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Hal Black <black@ieee.org>
To: binutils <binutils@sources.redhat.com>
Subject: Re: [BUG] ld behavior varies for C++ static initializer depending on .a or .o input
Date: Mon, 14 Apr 2003 05:14:00 -0000	[thread overview]
Message-ID: <3E9A4397.5010309@ieee.org> (raw)
In-Reply-To: <m3r886f1no.fsf@gossamer.airs.com>

Ian Lance Taylor wrote:

> Hal Black <black@ieee.org> writes:
> 
> 
>>>It means that including any class with a static initializer in a .a
>>>file would mean that that class would be included in all programs
>>>linked with that .a file.
>>
>>Yes.  That's the desired behavior.  If a developer were to develop a
>>library with a static initializer with side-effects, it would be
>>something that should be called whenever that library was used.
> 
> 
> 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.

> Also, while this is not the reason for not making the change, it turns
> out that it is not an efficient change to make.  It would require the
> linker to examine every object in every archive, which obviates the
> entire point of having archives in the first place.  Again, this
> inefficiency, while severe, is not the reason for not making the
> change; the reason for not making the change is that ld and ar
> implement behaviour which has not changed for decades, and should not
> be changed now.

For the C code that ld has been linking for decades, I agree with you 100%.

But, C++ has additional requirements.  Either the tool needs to change 
to meet these requirements, or a different tool needs to be used to meet 
them.

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.

Anyway, thank you for responding and for your time, Ian.

  parent reply	other threads:[~2003-04-14  5:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-11  3:43 Hal Black
2003-04-11  4:47 ` Alexandre Oliva
2003-04-12  4:01   ` Hal Black
2003-04-12  5:43     ` Alexandre Oliva
2003-04-12 14:24       ` Hal Black
2003-04-12 16:52         ` Ian Lance Taylor
2003-04-12 18:01           ` Hal Black
2003-04-12 20:45             ` Alexandre Oliva
2003-04-13  2:11               ` Hal Black
2003-04-14 18:41                 ` Alexandre Oliva
2003-04-13 22:55             ` Ian Lance Taylor
2003-04-13 23:07               ` Zack Weinberg
2003-04-13 23:15                 ` Ian Lance Taylor
2003-04-13 23:26                 ` Ulrich Drepper
2003-04-14  5:14               ` Hal Black [this message]
2003-04-14  5:30                 ` Ian Lance Taylor
2003-04-11  8:16 ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E9A4397.5010309@ieee.org \
    --to=black@ieee.org \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).