[PATCH] D134972: [CMake] Only set LLVM_DEFAULT_TARGET_TRIPLE to LLVM_HOST_TRIPLE when native target is enabled

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 13:12:34 PDT 2022


smeenai added a comment.

In D134972#3847325 <https://reviews.llvm.org/D134972#3847325>, @python3kgae wrote:

> In D134972#3847120 <https://reviews.llvm.org/D134972#3847120>, @smeenai wrote:
>
>> In D134972#3844420 <https://reviews.llvm.org/D134972#3844420>, @python3kgae wrote:
>>
>>> In D134972#3844340 <https://reviews.llvm.org/D134972#3844340>, @smeenai wrote:
>>>
>>>> Sorry for the slow review.
>>>>
>>>> Does this mean that LLVM_DEFAULT_TARGET_TRIPLE will now be empty when the native target isn't enabled (since LLVM_DEFAULT_TARGET_TRIPLE_default won't be set)? Does that cause any problems?
>>>
>>> Thanks for reviewing.
>>> Yes. Now LLVM_DEFAULT_TARGET_TRIPLE will be empty when the native target is not enabled.
>>> check-llvm passed with this change (It fails when the native target is not enabled without this change. I only tested Linux build on x86 though.)
>>
>> What about check-clang? What does clang do in this case if you try a compile without specifying an explicit triple?
>>
>> Conceptually, requiring the user to explicitly pick a default target triple from one of the backends they have enabled seems cleaner than having it be empty to me. We'd error out if you don't have the native target enabled and didn't explicitly specify LLVM_DEFAULT_TARGET_TRIPLE. Would that work for you?
>
> check-clang fails as you expected :(
> And set LLVM_DEFAULT_TARGET_TRIPLE to "" will also make check-clang fail.
>
> My use case is native target disabled in llvm, which will fail check-llvm because LLVM_DEFAULT_TARGET_TRIPLE is set to native target which is not enabled.
> That could be workaround by set LLVM_DEFAULT_TARGET_TRIPLE to "" or apply this patch.
> And I also want to run check-clang, it will work by default, but it fails after set LLVM_DEFAULT_TARGET_TRIPLE "".
>
> Is it possible to make both check-clang and check-llvm pass while native target is not enabled?
> One solution could be add something like native_triple_enabled in lit config, then update all tests that check default_triple to check native_triple_enabled.
> Is there another way to make it work?

How does check-clang behave if you set `LLVM_DEFAULT_TARGET_TRIPLE` to a triple for a backend that you do have enabled?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134972



More information about the llvm-commits mailing list