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 2/2] build: overhaul wrapper script system for multiple wrapper support
Date: Sun, 31 May 2015 23:18:29 -0400	[thread overview]
Message-ID: <20150601031829.GW17573@brightrain.aerifal.cx> (raw)
In-Reply-To: <1432918512-27823-1-git-send-email-hi@shiz.me>

On Fri, May 29, 2015 at 06:55:12PM +0200, Shiz wrote:
> this overhauls part of the build system in order to support multiple
> toolchain wrapper scripts, as opposed to solely the musl-gcc wrapper as
> before. it thereby replaces --enable-gcc-wrapper with --enable-wrapper=...,
> which has the options 'auto' (the default, detect whether to use wrappers),
> 'all' (build and install all wrappers), 'no' (don't build any) and finally
> the options named after the individual compiler scripts (currently 'clang'
> and 'gcc' are available) to build and install only that wrapper.
> the old --enable-gcc-wrapper is removed from --help, but still available.
> 
> it also modifies the wrappers to use the C compiler specified to the build
> system as 'inner' compiler, when applicable. as wrapper detection works by
> probing this compiler, it may not work with any other.

I believe there's still some change of behavior here that also
violates the principle of least surprise:

For the old option:

yes -- forcibly build wrapper regardless of
compiler or existing-musl-target detection

auto -- build depends on 2 conditions: $CC being gcc and not being
musl-targeted

no -- never build

For the new option:

yes or auto (same) -- build of gcc wrapper depends on 2 conditions:
$CC being gcc and not being musl-targeted. build of clang wrapper
depends only on one condition: $CC being clang.

gcc - unconditionally build gcc wrapper, never build clang wrapper

clang - unconditionally build clang wrapper, never build gcc wrapper

no -- never build

The most surprising part, which I think really should be fixed before
this is committed, is that the clang wrapper is built if you compile
musl with clang on a musl-native system. (Note that the gcc test right
now for musl-native is also wrong if the gcc toolchain omits dynamic
linking support entirely, but that's an existing bug, not a
regression.)

Even if that's fixed, it's also a problem, I think, that yes/auto are
equated. Presumably someone using --enable-wrapper with an existing
musl-targeted toolchain would want to bypass the musl-native detection
and force the wrapper (whichever one is appropriate for their
compiler) to be built. This is especially important to have if the
musl-native test has false positives, which I think it will if we take
the following approach I'd like to take:

Instead of testing for musl-native, test whether the toolchain is
targetting another known non-musl target, which is basically a matter
of #ifdef __GLIBC__. This ensures that the wrapper is never auto-built
for a musl-native system (which could happen before if the musl-native
test failed) and avoids compiler-specific hacks; we can simply have a
general test for known-non-native-toolchain.

If this is acceptable, it would probably make sense to do this change
before adding the clang wrapper infrastructure so that the clang
wrapper tests can use the result of it.

Rich


  reply	other threads:[~2015-06-01  3:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29 16:48 [PATCH 1/2] add musl-clang, a wrapper for system clang installs Shiz
2015-05-29 16:55 ` [PATCH 2/2] build: overhaul wrapper script system for multiple wrapper support Shiz
2015-06-01  3:18   ` Rich Felker [this message]
2015-06-01 14:15     ` Shiz
2015-06-01 14:47       ` Rich Felker
2015-06-01 15:39         ` Shiz
2015-06-01 16:03           ` Rich Felker
2015-05-29 17:03 ` [PATCH 1/2] add musl-clang, a wrapper for system clang installs Rich Felker
2015-05-29 17:11   ` Shiz
2015-05-29 17:13     ` Rich Felker
2015-05-29 17:35       ` Shiz
2015-05-29 18:43 ` [PATCH v2] " Shiz

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=20150601031829.GW17573@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).