Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 14 Dec 2017 23:34:26 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] Use LDFLAGS when testing linker flags

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@...lvnc.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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.