Skip to content

Commit 75e7e7d

Browse files
authored
[flang] Add --gcc-toolchain and --gcc-install-dir options to flang. (llvm#87360)
The `--gcc-toolchain` and `--gcc-install-dir` option were previously only visible to the Clang driver, but not Flang. These determine which assembler, linker, and libraries to use, e.g. for cross-compiling, and therefore are relevant for Flang as well. Tests are implemented using a mock GCC installation in `basic_cross_linux_tree` copied over from Clang's tests. The Clang driver already contains tests with `--driver-mode=flang` but `flang-new` is an entirely different executable (containing the `-fc1` stage) that should be tested as well. While not all files in `basic_cross_linux_tree` are strictly needed for testing those two driver flags, they will be necessarily needed for future added flags such as `--rtlib`.   Also remove the entry `*.o` in flang's `.gitignore` since `crt*.o` files are needed in the GCC mock installation. Fixes llvm#86729
1 parent aa6ba23 commit 75e7e7d

File tree

31 files changed

+45
-1
lines changed

31 files changed

+45
-1
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,9 +802,11 @@ def B : JoinedOrSeparate<["-"], "B">, MetaVarName<"<prefix>">,
802802
HelpText<"Search $prefix$file for executables, libraries, and data files. "
803803
"If $prefix is a directory, search $prefix/$file">;
804804
def gcc_install_dir_EQ : Joined<["--"], "gcc-install-dir=">,
805+
Visibility<[ClangOption, FlangOption]>,
805806
HelpText<"Use GCC installation in the specified directory. The directory ends with path components like 'lib{,32,64}/gcc{,-cross}/$triple/$version'. "
806807
"Note: executables (e.g. ld) used by the compiler are not overridden by the selected GCC installation">;
807808
def gcc_toolchain : Joined<["--"], "gcc-toolchain=">, Flags<[NoXarchOption]>,
809+
Visibility<[ClangOption, FlangOption]>,
808810
HelpText<"Specify a directory where Clang can find 'include' and 'lib{,32,64}/gcc{,-cross}/$triple/$version'. "
809811
"Clang will use the GCC installation with the largest version">;
810812
def gcc_triple_EQ : Joined<["--"], "gcc-triple=">,

flang/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ build
55
root
66
tags
77
TAGS
8-
*.o
98
.nfs*
109
*.sw?
1110
*~
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#!/bin/true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#!/bin/true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#!/bin/true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#!/bin/true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#!/bin/true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#!/bin/true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#!/bin/true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#!/bin/true

0 commit comments

Comments
 (0)