[llvm-dev] RFC: Deprecate config.guess
Fāng-ruì Sòng via llvm-dev
llvm-dev at lists.llvm.org
Wed Sep 15 12:34:48 PDT 2021
On Wed, Sep 15, 2021 at 12:32 PM Fāng-ruì Sòng <maskray at google.com> wrote:
>
> On Wed, Sep 15, 2021 at 11:31 AM Renato Golin via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> >
> > On Wed, 15 Sept 2021 at 17:55, Tom Stellard via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> >>
> >> I've submitted this patch[3], which turns off config.guess by default
> >> and tries to determine the host triple using the host compiler. Given
> >> all the different combinations for triples, I don't know if there is
> >> any better way to test this than to turn it off and wait for the bug
> >> reports.
> >
> >
> > I think this is a good change and one that we should really work on, but I'm not sure compiler front-ends are a drop-in replacement for all variations.
>
> +1 :)
>
> > Perhaps add the option and make it ON by default for now, which will still work for all current platforms, and add the possibility of turning guessing OFF and allowing those that aren't supported by out very old config.guess version to use the compiler.
>
> I think config.guess can be OFF by default. Doing two stages probably
> doesn't bring too much benefit.
> The nature of such a change is that only when I flip the default,
> users will actually notice.
s/I/we/ :)
When GCC or Clang is unavailable and the compiler is not an existing
with encoded logic (see MSVC, z/OS),
the cmake code will give a nice warning that -DLLVM_HOST_TRIPLE=
should be specified explicitly.
This seems much better than config.guess potentially inferring a wrong triplet.
> But I have some theories that switching now will actually be better.... Read on.
>
> For the patch (https://reviews.llvm.org/D109837), I suggested that we
> can use {gcc,clang} -dumpmachine.
> Users of alternative compilers have already contributed relevant logic
> to llvm/cmake/modules/GetHostTriple.cmake ,
> and we should just focus on gcc/clang which are more relevant for the
> existing config.guess use cases.
> I believe {gcc,clang} -dumpmachine is correct in more cases than config.guess .
>
> When is config.guess wrong? Here are two examples that I can attest:
>
> 1. For example, I have an unfinished upgrade from FreeBSD 12.2 to FreeBSD 13.0.
> The host compiler's `/usr/bin/clang -dumpmachine` output remains
> x86_64-unknown-freebsd12.2 while config.guess starts to say
> x86_64-unknown-freebsd13 because it just checks `uname -a`.
>
> 2. On musl based Linux distributions, other than riscv*, all have
> incorrect *-linux-gnu triplets.
> So on Alpine Linux amd64, I need to set
> -DLLVM_HOST_TRIPLE=x86_64-alpine-linux-musl
> because config.guess says x86_64-unknown-linux-gnu, which is wrong.
>
> I think this may be wrong for *-suse-* and *-redhat-* as well but I
> don't have such machines at hand.
>
>
>
> > Fixing the triple in the front-end isn't really trivial, there are a number of replacements on the triple until it hits the middle-end, so this may actually create problems that aren't easy to fix down the line.
> >
> > Just like moving from automake to CMake, I think we need to do this slowly and changing buildbots until all are running the new format, then we change the default behaviour.
> >
> > cheers,
> > --renato
> > _______________________________________________
> > LLVM Developers mailing list
> > llvm-dev at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
>
> --
> 宋方睿
--
宋方睿
More information about the llvm-dev
mailing list