There where a few problems with the handling originally discussed in this issue here: https://reviews.llvm.org/D80425
We want to make sure that LINKER_IS_LLD_LINK is properly set - in this case it shouldn't be set when building for MinGW.
Then we want to make the test for it correct and finally include the option to build with thinlto cache since the MinGW driver now supports that.
Note that this will break when building with LTO and a older lld than what ships before the addition of that option in the tree. We could add logic for checking if the linker flags are correct - but I think when using LTO multi-stage builds are not uncommon.
I'd feel more comfortable with parentheses here