From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26834 invoked by alias); 13 Apr 2003 23:07:01 -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 26827 invoked from network); 13 Apr 2003 23:07:01 -0000 Received: from unknown (HELO egil.codesourcery.com) (66.92.14.122) by sources.redhat.com with SMTP; 13 Apr 2003 23:07:01 -0000 Received: from zack by egil.codesourcery.com with local (Exim 3.36 #1 (Debian)) id 194qYu-0001wi-00; Sun, 13 Apr 2003 16:07:00 -0700 To: binutils@sources.redhat.com Cc: black@ieee.org Subject: Re: [BUG] ld behavior varies for C++ static initializer depending on .a or .o input From: Zack Weinberg Date: Sun, 13 Apr 2003 23:07:00 -0000 In-Reply-To: (Ian Lance Taylor's message of "13 Apr 2003 15:55:23 -0700") Message-ID: <87he92ngiz.fsf@egil.codesourcery.com> User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.2 (gnu/linux) References: <3E9639F9.9050503@vt.edu> <3E978F84.4050603@vt.edu> <3E98219D.7010506@ieee.org> <3E98546A.9060507@ieee.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-04/txt/msg00297.txt.bz2 Ian Lance Taylor writes: > Hal Black writes: >> 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. > > Basically, you misunderstand how ld and ar work. If you feel that you > have been misled by existing documentation, please let us know so that > we can fix it. I'd like to point out that while this is true for static (.a) libraries, it is not true for shared (.so) libraries -- the linker generates DT_NEEDED entries for every shared library on the command line, whether or not they satisfy undefined symbols. Personally I consider this a bug. zw