From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7549 Path: news.gmane.org!not-for-mail From: Andre McCurdy Newsgroups: gmane.linux.lib.musl.general Subject: Re: building musl libc.so with gcc -flto Date: Tue, 28 Apr 2015 18:42:13 -0700 Message-ID: References: <1429742932-6026-1-git-send-email-armccurdy@gmail.com> <20150423022309.GH6817@brightrain.aerifal.cx> <20150423094520.GA17573@brightrain.aerifal.cx> <20150428002402.GJ17573@brightrain.aerifal.cx> <20150428134453.GM17573@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1430271750 31039 80.91.229.3 (29 Apr 2015 01:42:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Apr 2015 01:42:30 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7562-gllmg-musl=m.gmane.org@lists.openwall.com Wed Apr 29 03:42:30 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YnH1B-00051H-BR for gllmg-musl@m.gmane.org; Wed, 29 Apr 2015 03:42:29 +0200 Original-Received: (qmail 1688 invoked by uid 550); 29 Apr 2015 01:42:27 -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 1651 invoked from network); 29 Apr 2015 01:42:26 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=MfEJtTmhZhr3GSdF/UuOKU7AyoO4fiX8cJ7lA9Rn5w4=; b=u3LmoYTBPFBI9lf9GNh3nAL8FvrPq8DTQ2oKab0ZtvJRPAC7iBwWkSj1JvTTX8qFkh 5HL9EvRokbORJmTTBUmDn4oi1DbzOTixyDo4zGCGqIzMz0h0D1HW9BNmQDXrdcFd6jKb N1+fOQS48zkia4rboSmSPYDVI3RZeyzTsV5ttvhdc+zkVFMrT06jZPD78vdtO+bEQFh9 I48/LbAHDBpI8cm9GbvkRRRSNL0snG2kZNNpbtme7Ul6SX/459dvedNarXSpWVxMSslY +oTQiY2XjA1Q1SxqOKXSKGSBp6fWpOGncNIJKqjIB4Y6dywOPeYIhoaFpGU4zj6zLrbD D9oA== X-Received: by 10.202.94.215 with SMTP id s206mr1099449oib.15.1430271733601; Tue, 28 Apr 2015 18:42:13 -0700 (PDT) In-Reply-To: <20150428134453.GM17573@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:7549 Archived-At: On Tue, Apr 28, 2015 at 6:44 AM, Rich Felker wrote: > On Mon, Apr 27, 2015 at 11:23:40PM -0700, Andre McCurdy wrote: >> On Mon, Apr 27, 2015 at 5:24 PM, Rich Felker wrote: >> > On Mon, Apr 27, 2015 at 05:16:12PM -0700, Andre McCurdy wrote: >> >> > OK, it looks like the _dlstart_c symbol got removed before linking the >> >> > asm. What about selectively compiling this file with -fno-lto via >> >> > something like this in config.mak: >> >> > >> >> > src/ldso/dlstart.lo: CFLAGS += -fno-lto >> >> >> >> That works. Should I send a patch? >> > >> > Yes, but configure would need to detect support for -fno-lto and add >> > it appropriately. See what's done for CFLAGS_NOSSP. I suspect the crt >> > files also need -fno-lto in principle even if they're not currently >> > breaking for lack of it. >> >> Patch sent. >> >> I think the crt files might be OK as they are, since the _start_c >> symbol isn't being hidden? > > I think you'll find the exact same thing happens if you use a crt1.o > produced from crt1.c for static linking with LTO. Note that on i386 > (and x86_64) we still have a crt1.s which overrides crt1.c; I want to > remove it at some point. Temporarily removing/renaming it yourself > will allow you to test what happens with LTO on this file. Yes, you're right. The same workaround is needed for crt1.c, so my original patch is incomplete. The next issue, as Khem mentioned, is that AR and RANLIB need to be changed to: AR = $(CROSS_COMPILE)gcc-ar RANLIB = $(CROSS_COMPILE)gcc-ranlib Is it safe to use these gcc-xx wrappers in all cases (after having configure test that the toolchain provides them)? Or should they only be used with LTO? Beyond that I'm not able to statically link a hello.c test app using LTO yet, since LTO linking with .a archives requires the gold linker and I specifically have that disabled (to avoid issues I had seen previously with musl+gold+dynamic linking). It looks like I need to enable gold again before continuing. Are there any known issues, or known success stories, when using musl with gold? > > Rich