[PATCH] D110900: Triple: Add RedHat vendor

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 11:29:58 PDT 2021


tstellar added a comment.

In D110900#3043415 <https://reviews.llvm.org/D110900#3043415>, @hvdijk wrote:

> In D110900#3041312 <https://reviews.llvm.org/D110900#3041312>, @tstellar wrote:
>
>> @hvdijk There are two things I'm trying to fix with this patch:
>>
>> 1. I want a triple that behaves the same as gcc's x86_64-redhat-linux and can also be used to select the gcc install at /usr/lib/x86_64-redhat-linux
>
> Yeah, I saw your comments on D109837 <https://reviews.llvm.org/D109837>. It's unfortunate that changing the GCC target name is a no go, that would have been the nicest fix IMO.
>
>> 1. I want to be able to use gcc -dumpmachine to determine the host architecture rather than config.guess.
>>
>> I really want to fix 1, but if I can fix 2 too that would be a bonus.
>>
>> Another solution for 1 (but not 2), would be to update the driver to select the x86_64-redhat-linux gcc install when the triple is x86_64-redhat-linux-gnu.   Do you think this would be better?
>
> That should already happen, `x86_64-redhat-linux` is in `X86_64Triples` (https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/ToolChains/Gnu.cpp), so any GCC install that uses `x86_64-redhat-linux` as the triple name should be picked up by LLVM/clang regardless of whether the LLVM target includes `-gnu`.

It picks the first triple from the list that is installed on your system.  So if you also have an x86_64-linux-gnu gcc installation on your system, it will pick that one over x86_64-redhat-linux.

> So that means, I *think*, that if the CMake logic to read `gcc -dumpmachine`'s output could change `x86_64-redhat-linux` (and `x86_64-suse-linux` and others) to append `-gnu`, the core LLVM code wouldn't need updating. I've been holding back on commenting in more detail as I am not currently in a position to test that this actually works, but I should be able to try soon.

Doing this will have the same problem I described above, clang will still pick x86_64-linux-gnu over x86_64-redhat-linux.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110900



More information about the llvm-commits mailing list