-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Description
The documentation states that if clang is called as <triple>-<driver>
(e.g. x86_64-w64-mingw32-clang++
), then clang will load both config files <triple>.cfg
and <driver>.cfg
. This is really convenient as it allows you to share configuration between drivers and targets.
However, this is not what actually happens. Under the hood, clang converts that <triple>
to it's preferred "real triple". In the example above, that happens to be x86_64-w64-windows-gnu
instead.
This is very confusing as it is not documented. It is also not very practical as the that triple then differs to what the rest of the system is using. It's also fragile as we then need to keep track of what clang considers a "real triple" for everything and keep an eye on if that changes.
Relevant code here:
llvm-project/clang/lib/Driver/Driver.cpp
Lines 1417 to 1423 in 2d3167f
// Otherwise, use the real triple as used by the driver. | |
llvm::Triple RealTriple = | |
computeTargetTriple(*this, TargetTriple, *CLOptions); | |
if (Triple.str().empty()) { | |
Triple = RealTriple; | |
assert(!Triple.str().empty()); | |
} |