Commit bf5332c
authored
[flang][driver] Bring --gcc-triple to flang (llvm#165886)
When there are multiple gcc versions installed, we want `flang` to be
able
to find the right one based on the triple. Here's `flang` selecting an
unwanted `gcc` candidate installation, namely
`/usr/lib/gcc/x86_64-linux-gnu/15`:
```
~/src/llvm-project/main/build-RelWithDebInfo > ./bin/flang -v
flang version 22.0.0custombuild
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /home/fedora/src/llvm-project/main/build-RelWithDebInfo/bin
System configuration file directory: /etc/clang/
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/15
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/15
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/15
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
```
When passing `--gcc-triple=x86_64-redhat-linux` we get the desired gcc
candidate installation:
```
~/src/llvm-project/main/build-RelWithDebInfo > ./bin/flang --gcc-triple=x86_64-redhat-linux -v
flang version 22.0.0custombuild
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /home/fedora/src/llvm-project/main/build-RelWithDebInfo/bin
System configuration file directory: /etc/clang/
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/15
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/15
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
```
* Test: `LIT_FILTER="Flang :: Driver/gcc-triple.f90" ninja check-flang`
* Copied `flang/test/Driver/Inputs/fedora_39_tree` from
`clang/test/Driver/Inputs/fedora_39_tree`.
* Testing what default triple is selected when two are possible.
* Testing that we can select an existing triple.
* Testing that triple is not selected if it doesn't exist.1 parent 3bd5963 commit bf5332c
File tree
10 files changed
+19
-0
lines changed- clang/include/clang/Driver
- flang/test/Driver
- Inputs/fedora_39_tree/usr/lib/gcc
- x86_64-linux-gnu/13
- x86_64-redhat-linux/13
10 files changed
+19
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
741 | 741 | | |
742 | 742 | | |
743 | 743 | | |
| 744 | + | |
744 | 745 | | |
745 | 746 | | |
746 | 747 | | |
| |||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments