mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Nicholas Wilson <nicholas.wilson@realvnc.com>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: Re: [PATCH] Use LDFLAGS when testing linker flags
Date: Fri, 15 Dec 2017 12:42:21 +0000	[thread overview]
Message-ID: <HE1PR0502MB3883EB1C9E88F4B2A87FF9BDE70B0@HE1PR0502MB3883.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <20171215043426.GI1627@brightrain.aerifal.cx>

Hi Rich,

On 15 December 2017 04:34, Rich Felker wrote:
> 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.

It's sneaky to put some flags in $CC! That's actually how I'm bodging the libcxx (C++ standard library) build at the moment. Unfortunately Musl's configure script actually assumes you're not doing that. If you do "CC='clang -Wl,XXX' ./configure" then the check for whether the compiler accepts "-Werror=unused-command-line-argument" fails (because of course the linker flag indeed isn't used). Given that the Clang does support that argument, it would be good for the configure script not to detect it, which relies on not putting linker flags in $CC.

The arguments I'm currently using are specified with "-Wl,..." to pass some Wasm-specific linking paths. While we're developing the linker, the defaults haven't all been ironed out! Ultimately I believe the goal is that the linker's defaults should be usable with Musl, but I think support for LDFLAGS is a reasonable request in the meantime. The configure script already supports use of LDFLAGS lower down.

Thanks for your suggested improvement to put LDFLAGS at the end of the argument list, so that the tested order matches the order used later. That change makes sense. I've tested it, and it works with our toolchain (the LDFLAGS we're interested in can go in any order on the link-line).

Nick


      reply	other threads:[~2017-12-15 12:42 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
2017-12-15 12:42   ` Nicholas Wilson [this message]

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=HE1PR0502MB3883EB1C9E88F4B2A87FF9BDE70B0@HE1PR0502MB3883.eurprd05.prod.outlook.com \
    --to=nicholas.wilson@realvnc.com \
    --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).