From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25763 invoked by alias); 15 Jan 2013 05:23:42 -0000 Received: (qmail 25755 invoked by uid 22791); 15 Jan 2013 05:23:41 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-pb0-f43.google.com (HELO mail-pb0-f43.google.com) (209.85.160.43) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 Jan 2013 05:23:35 +0000 Received: by mail-pb0-f43.google.com with SMTP id um15so2631414pbc.16 for ; Mon, 14 Jan 2013 21:23:35 -0800 (PST) X-Received: by 10.66.52.102 with SMTP id s6mr238722339pao.6.1358227415425; Mon, 14 Jan 2013 21:23:35 -0800 (PST) Received: from bubble.grove.modra.org ([101.166.26.37]) by mx.google.com with ESMTPS id rs7sm9527632pbc.2.2013.01.14.21.23.32 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Jan 2013 21:23:34 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 77121EA1D76; Tue, 15 Jan 2013 15:53:28 +1030 (CST) Date: Tue, 15 Jan 2013 05:23:00 -0000 From: Alan Modra To: "H.J. Lu" Cc: Binutils , Pierre Ossman Subject: Re: --as-needed change wrt undefined weak symbols Message-ID: <20130115052328.GQ3244@bubble.grove.modra.org> Mail-Followup-To: "H.J. Lu" , Binutils , Pierre Ossman References: <20130114035805.GF3244@bubble.grove.modra.org> <20130115022340.GO3244@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2013-01/txt/msg00215.txt.bz2 On Mon, Jan 14, 2013 at 07:30:24PM -0800, H.J. Lu wrote: > On Mon, Jan 14, 2013 at 6:23 PM, Alan Modra wrote: > > On Mon, Jan 14, 2013 at 07:30:54AM -0800, H.J. Lu wrote: > >> Given then the behavior of pr14862 is changed, > >> I don't think it is a good idea. > > > > You added a testcase in November last year that (possibly > > accidentally) depends on the current --as-needed behaviour for weak > > references. Now you claim that testcase as a reason to not change > > --as-needed. How is that a reasonable objection? > > > > It shows that this patch will change the behavior of some > programs. Adding DT_NEEDED is one thing. Change > program behavior is another. I don't think we should do it > by default. Of course this patch potentially changes program behaviour. I'd argue that people using undefined weak symbols are prepared for and indeed expect such changes in behaviour. The PR12549 reporter and another commenter quite reasonably call ld --as-needed buggy in that we get a library added to DT_NEEDED only to satify an undefined weak symbol. If the same program were linked against archive libraries supplying the same functionality you'd find the undefined weak symbols would stay undefined. -- Alan Modra Australia Development Lab, IBM