mstorsjo added a comment.

In D101479#2813797 <https://reviews.llvm.org/D101479#2813797>, @phosek wrote:

> In D101479#2813724 <https://reviews.llvm.org/D101479#2813724>, @mstorsjo 
> wrote:
>
>> Couldn’t this commit have been kept in, and just reverting the one for using 
>> it in the fuchsia cmake cache? (I’m not using this particular commit myself, 
>> just observing.)
>
> The problem is that there's no way to configure the default libc++ on a 
> per-target basis. We want to use libc++ as a default for all targets that 
> support it, so for example even if you're compiling on Windows but targeting 
> Fuchsia or Linux. Unfortunately, with this change that triggers D103947 
> <https://reviews.llvm.org/D103947> when compiling compiler-rt and I don't 
> know how to work around it.
>
> I'd point out that we have the same problem for other defaults, for example 
> if you set lld as the default linker on Darwin, it causes issues because 
> Clang tries to use `lld.ld64` which is not yet usable. We still want to use 
> lld for all other targets, but there's no way to specify that in CMake today 
> which is something we may want to address.

Ah, I see, thanks for explaining - the link between those wasn’t obvious to me.

Yes, that’s indeed a problem with the mechanism of overriding the default 
choices. (FWIW, in llvm-mingw I work around this issue by having small wrapper 
scripts, like <triple>-clang, that set the cross target and the defaults I when 
invoking clang - but that’s not very elegant either.)

Clang does have the concept of a config file, named the same a the target 
triple plus “.cfg”, iirc, located next to the compiler binary, that might work 
for setting different defaults per cross target. I haven’t really used that 
much though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101479/new/

https://reviews.llvm.org/D101479

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to