On Thu, Sep 16, 2021 at 3:42 AM Renato Golin <rengolin at gmail.com>
wrote:>
> On Wed, 15 Sept 2021 at 20:32, Fāng-ruì Sòng <maskray at google.com>
wrote:
>>
>> The nature of such a change is that only when I flip the default,
>> users will actually notice.
>
>
> Getting a different triple may be worse than the wrong triple.
>
> The wrong triple crashes something and is easy to identify. A different,
but valid, triple may bring slight architectural changes down the line that are
difficult to spot.
>
> Changing the triple on the front end isn't always trivial either.
>
> There's a whole dance of changing triples in the clang driver that
defies logic sometimes. The command line options to the actual front-end depend
on the triple and the path taken, which in turn, can change code generation in
unpredictable ways down the line.
>
>> 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 .
>
>
> Not only that, but using the compiler driver to "predict" what
the compiler front-end needs is the obvious thing to do.
>
> I'm not against the change, I think we should have done this a long
time ago, but I think we can give people some grace time to test out on their
sides, especially downstream people and less popular platforms that still use
clang/gcc to build LLVM.
I'm glad we are on the same page for the direction, but I don't think
giving more grace time would be beneficial.
*-suse-*, *-redhat-*, *-linux-musl triples are already incorrect.
It led to unnecessary riscv-* changes such as
https://reviews.llvm.org/D63497 , https://reviews.llvm.org/D74399.
For less popular platforms, config.guess really caused more harm than
its benefit.
Some of the less popular platforms (I happen to like exploring such
less popular platforms sometimes) may need LLVM_DEFAULT_TARGET_TRIPLE
and LLVM_HOST_TRIPLE to cancel the config.guess harm.
In https://reviews.llvm.org/D109837 , Tom mentioned that
llvm/cmake/modules/GetHostTriple.cmake can just notify the user about
fetching the latest config.guess .
This will give the less popular compilers (technically, llvm-project
doesn't even support such compilers
https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library)
transition period.
> Giving them a CMake flag to test out for a few weeks wouldn't hurt
before we turn it on by default.
>
> cheers,
> --renato