From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5086 Path: news.gmane.org!not-for-mail From: Timo Teras Newsgroups: gmane.linux.lib.musl.general Subject: Re: Linking musl with ld.gold Date: Thu, 8 May 2014 08:11:26 +0300 Message-ID: <20140508081126.140b0064@vostro> References: <20140506101410.GP12324@port70.net> <20140506231807.GQ12324@port70.net> <20140507130443.72c74f47@vostro> <20140508010605.GE26358@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1399525897 29353 80.91.229.3 (8 May 2014 05:11:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 May 2014 05:11:37 +0000 (UTC) Cc: dalias@libc.org, scjthm@live.com To: musl@lists.openwall.com Original-X-From: musl-return-5092-gllmg-musl=m.gmane.org@lists.openwall.com Thu May 08 07:11:30 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WiGcC-0000a3-TQ for gllmg-musl@plane.gmane.org; Thu, 08 May 2014 07:11:28 +0200 Original-Received: (qmail 28126 invoked by uid 550); 8 May 2014 05:11:28 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 28117 invoked from network); 8 May 2014 05:11:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=WwOgDwJiscP9SVZTLyiL1bsrxN3v25vFSVPT90cx4KI=; b=PaZTzsGDZI0gzkp0m3JopJk0NzDk91BovWZEH/BorXoyMqYhEYrjDjwSz5WDYg+7TF BDviVWqmrB+zNU9/7AQEDPthuKH4+taLs2uM+sCIqSC0O9Gz4uW8ykXYfTWHCTzdorfZ Hu6o0q2+QzNJIw8Dpyufw0eEd2yXxu71I4HJ8QlgNRQqS1y9U+8RlKUfySm/H21KQj5V 0rgThuWvRG38UGo0h2SGWZUcpnZQ8lw5AKPUuLliMH+F3lrSDEof3O3PMWO6GQ5Taa0G yKMSs5DbZ8OIAcxoIFk7g2lReiKn6BvbWY7JuNMYozkR6Jes2/qKNC2s6LDwLRRbh7w5 B8wg== X-Received: by 10.112.106.40 with SMTP id gr8mr2012302lbb.0.1399525876684; Wed, 07 May 2014 22:11:16 -0700 (PDT) Original-Sender: =?UTF-8?Q?Timo_Ter=C3=A4s?= In-Reply-To: <20140508010605.GE26358@brightrain.aerifal.cx> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; i486-alpine-linux-musl) Xref: news.gmane.org gmane.linux.lib.musl.general:5086 Archived-At: On Wed, 7 May 2014 21:06:05 -0400 Rich Felker wrote: > On Wed, May 07, 2014 at 01:04:43PM +0300, Timo Teras wrote: > > Is perhaps -ffunction-sections and/or -fdata-sections added > > automatically? Those would break musl like experienced. > > They should not break musl; if they do, it's a compiler bug. The > strong symbol that overrides the weak symbol elsewhere is not unused > and available for garbage collection because it's referenced. > > I suspect your claim is just wrong, since IIRC people have > successfully used these options with musl. -fdata-sections breaks things to my understanding. stdin.c (and others), have: FILE *const stdin = &f; FILE *const __stdin_used = &f; And __stdin_used is only ever referenced via weak alias. -fdata-section makes each symbol go to different section, and if linker has gc-sections, it'll remove any unreferenced section. This means __stdin_used will never get pulled in causing problems like described in the original mail. With -ffunction-sections/-fdata-sections/-Wl,--gc-sections it is no longer valid assumption that if compilation unit gets pulled in, all of the symbols defined in it will get pulled in. Of course this does not affect .so as visible exported symbols are reachable and not GCd. But static build would be effected. - Timo