mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH] Use LDFLAGS when testing linker flags
Date: Thu, 14 Dec 2017 23:34:26 -0500	[thread overview]
Message-ID: <20171215043426.GI1627@brightrain.aerifal.cx> (raw)
In-Reply-To: <VI1PR0502MB3885C5129C26CEF375ECF862E7330@VI1PR0502MB3885.eurprd05.prod.outlook.com>

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 <nicholas.wilson@realvnc.com>
> 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


  reply	other threads:[~2017-12-15  4:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 16:03 Nicholas Wilson
2017-12-15  4:34 ` Rich Felker [this message]
2017-12-15 12:42   ` Nicholas Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171215043426.GI1627@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).