From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10920 invoked by alias); 12 Apr 2003 20:45:59 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 10913 invoked from network); 12 Apr 2003 20:45:58 -0000 Received: from unknown (HELO lacrosse.corp.redhat.com) (66.187.233.200) by sources.redhat.com with SMTP; 12 Apr 2003 20:45:58 -0000 Received: from free.redhat.lsd.ic.unicamp.br (aoliva.cipe.redhat.com [10.0.1.10]) by lacrosse.corp.redhat.com (8.11.6/8.9.3) with ESMTP id h3CKjuV18872; Sat, 12 Apr 2003 16:45:56 -0400 Received: from free.redhat.lsd.ic.unicamp.br (free.redhat.lsd.ic.unicamp.br [127.0.0.1]) by free.redhat.lsd.ic.unicamp.br (8.12.8/8.12.8) with ESMTP id h3CKjrAN005938; Sat, 12 Apr 2003 17:45:53 -0300 Received: (from aoliva@localhost) by free.redhat.lsd.ic.unicamp.br (8.12.8/8.12.8/Submit) id h3CKjre7005934; Sat, 12 Apr 2003 17:45:53 -0300 To: Hal Black Cc: binutils Subject: Re: [BUG] ld behavior varies for C++ static initializer depending on .a or .o input References: <3E9639F9.9050503@vt.edu> <3E978F84.4050603@vt.edu> <3E98219D.7010506@ieee.org> <3E98546A.9060507@ieee.org> From: Alexandre Oliva Organization: GCC Team, Red Hat Date: Sat, 12 Apr 2003 20:45:00 -0000 In-Reply-To: <3E98546A.9060507@ieee.org> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-04/txt/msg00287.txt.bz2 On Apr 12, 2003, Hal Black wrote: >> That would mean that every static initializer in a .a file would be >> brought in > Yes, as desired. Maybe in your specific application. But think of the Standard C++ library. It may contain hundreds, if not thousands, of global initializers, that are of no use for most programs that don't happen to use the particular feature that depend on some of these initializers. Bringing them in just because you would like it to be so is not exactly a reasonable proposition. > If you don't think this is the proper usage, what is your > interpretation of the meaning of having a static intializer (or items > with static storage duration in general) in a library? No different from having it in an object file: if the object file is linked in, the static initializer is run. The difference is that object files listed in the command line are always linked in, whereas those in a static library get linked in only if they would resolve some symbol the linker is looking for. > My claim is that if it has a static initializer, it is required. If we implemented this mis-feature, you'll come back tomorrow and complain about the bloat from all these modules being linked in that are not needed for your program to run, and the answer will be that they do contain static initializers so, per your request, they have to be brought in. -- Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/ Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org} CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org} Free Software Evangelist Professional serial bug killer