From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12240 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Use LDFLAGS when testing linker flags Date: Thu, 14 Dec 2017 23:34:26 -0500 Message-ID: <20171215043426.GI1627@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=us-ascii X-Trace: blaine.gmane.org 1513312478 30168 195.159.176.226 (15 Dec 2017 04:34:38 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 15 Dec 2017 04:34:38 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-12256-gllmg-musl=m.gmane.org@lists.openwall.com Fri Dec 15 05:34:34 2017 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 1ePhhg-0007ZT-VT for gllmg-musl@m.gmane.org; Fri, 15 Dec 2017 05:34:33 +0100 Original-Received: (qmail 23833 invoked by uid 550); 15 Dec 2017 04:34:38 -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 23815 invoked from network); 15 Dec 2017 04:34:37 -0000 Content-Disposition: inline In-Reply-To: Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:12240 Archived-At: On Thu, Dec 07, 2017 at 04:03:03PM +0000, Nicholas Wilson wrote: > Hi, > > This is another patch for the WebAssembly build. > > In Wasm, we currently need to pass some extra flags to the linker, and LDFLAGS would seem to be a good way to do this. > > The patch below tests the linker by passing LDFLAGS on the link line. This ought to be a safe change to make? > > Thanks, > Nick > > ======= > commit a951daab68b4b6ee6f46278f02df279188559b89 > Author: Nicholas Wilson > Date: Thu Dec 7 15:42:58 2017 +0000 > > [Wasm] Use LDFLAGS when testing linker > > diff --git a/configure b/configure > index f320660d..519d31fa 100755 > --- a/configure > +++ b/configure > @@ -98,7 +98,7 @@ fi > tryldflag () { > printf "checking whether linker accepts %s... " "$2" > echo "typedef int x;" > "$tmpc" > -if $CC $LDFLAGS_TRY -nostdlib -shared "$2" -o /dev/null "$tmpc" >/dev/null 2>&1 ; then > +if $CC $LDFLAGS $LDFLAGS_TRY -nostdlib -shared "$2" -o /dev/null "$tmpc" >/dev/null 2>&1 ; then > printf "yes\n" > eval "$1=\"\${$1} \$2\"" > eval "$1=\${$1# }" > I'm not sure this is a good idea. At make time, $(LDFLAGS) is applied after the auto-added ldflags from the various "try"s. If it's applied before when testing, the order in which things override will be different and might cause wrong test results. If there are flags that *need* to be passed in order for the toolchain to work, they might belong as part of $CC rather than any *FLAGS variable. But without seeing them it's hard to say. If this is needed we probably need to flip around the above order, at least. Rich