From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12526 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: ./configure compiler-rt patch Date: Tue, 20 Feb 2018 21:12:56 -0500 Message-ID: <20180221021256.GB1436@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1519179069 29861 195.159.176.226 (21 Feb 2018 02:11:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 21 Feb 2018 02:11:09 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-12542-gllmg-musl=m.gmane.org@lists.openwall.com Wed Feb 21 03:11:05 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1eoJs9-0007Vr-2w for gllmg-musl@m.gmane.org; Wed, 21 Feb 2018 03:11:05 +0100 Original-Received: (qmail 13800 invoked by uid 550); 21 Feb 2018 02:13:08 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 13781 invoked from network); 21 Feb 2018 02:13:08 -0000 Content-Disposition: inline In-Reply-To: Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:12526 Archived-At: On Tue, Feb 13, 2018 at 03:53:39PM +0100, Matúš Olekšák wrote: > Hi, > I have complete LLVM toolchain and I discovered that, detection of > compiler-rt is not working in ./configure. Because it is looking for > dynamic library compiler_rt but it doesn't exist. Instead it should ask > compiler about libgcc-file-name to get correct filename. I attached patch > to fix this issue. > --- a/configure > +++ b/configure > @@ -597,7 +597,8 @@ > > # Find compiler runtime library > test -z "$LIBCC" && tryldflag LIBCC -lgcc && tryldflag LIBCC -lgcc_eh > -test -z "$LIBCC" && tryldflag LIBCC -lcompiler_rt > +test -z "$LIBCC" && try_libcc=`$CC -print-libgcc-file-name 2>/dev/null` \ > + && tryldflag LIBCC "$try_libcc" > test -z "$LIBCC" && try_libcc=`$CC -print-file-name=libpcc.a 2>/dev/null` \ > && tryldflag LIBCC "$try_libcc" > printf "using compiler runtime libraries: %s\n" "$LIBCC" Sorry for the slow response. I think this probably okay, but if I remember right, there has been discussion of this before and might be more subtlety to doing it optimally. The nice property of the -lgcc case (and the -lcompiler_rt case if it worked, but it doesn't) is that it's immune to changes in compiler version; upgrading gcc without rerunning configure won't cause it to fail. It might be optimal to try the basename produced by -print-libgcc-file-name, stripping the "lib" and ".a" parts and using it with -l, to see if that works. But it might not actually work for anything other than gcc. I know it doesn't (or at least didn't in the past) work for pcc. Note that -print-libgcc-file-name does work with pcc, at least modern versions, so I think we could remove the pcc-specific check too at some point. Rich