[llvm] [TargetParser] Normalize "aarch64-amazon-linux" to "aarch64-amazon-linux-gnu" (PR #140070)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 20:48:45 PDT 2025


MaskRay wrote:

> > Sorry for the late response. I've now looked at other changes you've made.
> > ```
> > // libcxx/test/std/re/re.alg/re.alg.search/awk.locale.pass.cpp
> > // XFAIL: target={{.*}}-amazon-linux{{.*}}
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > Why do we want to use aarch64-amazon-linux instead of aarch64-unknown-linux-gnu? If the only issue is that clang cannot pick up `lib/gcc/aarch64-amazon-linux`, you can specify a config file for `--gcc-triple=aarch64-amazon-linux`. In LLVM, we can just use `aarch64-unknown-linux-gnu` and we don't need to update TargetParser/config.guess at all.
> 
> I can think of many reasons why it is not the best idea. But let's have an example. Some users need to use `--no-default-config` option. This may be considered an advanced user scenario and if someone is in a need of using such flag, they usually know what they are doing and know about lot of relevant circumstances, e.g. what system they are working with, but then again, it is only an assumption and does not need to be valid - even the most advanced LLVM users may not notice that if they work on Amazon Linux and the CPU is not x86_64, then they need to specify an extra --gcc-triple flag that they might never needed to use on any other system they did the same work in the past. This is very punishing, hence if we demand it for one OS/CPU combination, we should do it for all.

We do not support and cannot support automatic GCC selection when using `clang --no-default-config`.
If --no-default-config is specified, users must also provide the appropriate options to select the desired GCC installation.

You may want to review https://github.com/gentoo/gcc-config/blob/7933c4262ceb0ee44a72880a0f05aa7dc4bbe6f5/gcc-config#L800
It supports multiple GCC versions, allowing users to select the desired version via the gcc-config command. This generates `/etc/clang/gentoo-gcc-install.cfg`, which Clang reads as part of its default configuration, alongside other customizable options (fortify source, Intel IBT, -z now, etc).

We support the most common triples arch-unknown-linux-gnu and arch-linux-gnu, as well as some vendor specific ones (though their new architectures should migrate to configuration files). We don't want to encourage 100+ Linux distros that customize the "vendor" component to add new elements to `Generic_GCC::GCCInstallationDetector::CollectLibDirsAndTriples`.




https://github.com/llvm/llvm-project/pull/140070


More information about the llvm-commits mailing list