[Flang][Driver] Enable the -B option (#109965)
The option provides the search prefix for executables, libraries and data files. The option is implemented in the common portion of the Driver and only needs to be enabled in Flang. Test added is a copy of the relevant test in Clang.
This commit is contained in:
parent
2026501cf1
commit
28be39f174
@ -816,6 +816,7 @@ def _DASH_DASH : Option<["--"], "", KIND_REMAINING_ARGS>,
|
||||
def A : JoinedOrSeparate<["-"], "A">, Flags<[RenderJoined]>,
|
||||
Group<gfortran_Group>;
|
||||
def B : JoinedOrSeparate<["-"], "B">, MetaVarName<"<prefix>">,
|
||||
Visibility<[ClangOption, FlangOption]>,
|
||||
HelpText<"Search $prefix$file for executables, libraries, and data files. "
|
||||
"If $prefix is a directory, search $prefix/$file">;
|
||||
def gcc_install_dir_EQ : Joined<["--"], "gcc-install-dir=">,
|
||||
|
23
flang/test/Driver/B-opt.f90
Normal file
23
flang/test/Driver/B-opt.f90
Normal file
@ -0,0 +1,23 @@
|
||||
! Check -B driver option.
|
||||
!
|
||||
! Target triple prefix is not detected for -B.
|
||||
! RUN: %flang %s -### -o %t.o --target=i386-unknown-linux \
|
||||
! RUN: -B %S/Inputs/B_opt_tree/dir1 -fuse-ld=ld 2>&1 \
|
||||
! RUN: | FileCheck --check-prefix=CHECK-B-OPT-TRIPLE %s
|
||||
! CHECK-B-OPT-TRIPLE-NOT: "{{.*}}/Inputs/B_opt_tree/dir1{{/|\\\\}}i386-unknown-linux-ld"
|
||||
!
|
||||
! RUN: %flang %s -### -o %t.o --target=i386-unknown-linux \
|
||||
! RUN: -B %S/Inputs/B_opt_tree/dir2 -fuse-ld=ld 2>&1 \
|
||||
! RUN: | FileCheck --check-prefix=CHECK-B-OPT-DIR %s
|
||||
! CHECK-B-OPT-DIR: "{{.*}}/Inputs/B_opt_tree/dir2{{/|\\\\}}ld"
|
||||
!
|
||||
! RUN: %flang %s -### -o %t.o --target=i386-unknown-linux \
|
||||
! RUN: -B %S/Inputs/B_opt_tree/dir3/prefix- -fuse-ld=ld 2>&1 \
|
||||
! RUN: | FileCheck --check-prefix=CHECK-B-OPT-PREFIX %s
|
||||
! CHECK-B-OPT-PREFIX: "{{.*}}/Inputs/B_opt_tree/dir3{{/|\\\\}}prefix-ld"
|
||||
!
|
||||
! RUN: %flang %s -### -o %t.o --target=i386-unknown-linux \
|
||||
! RUN: -B %S/Inputs/B_opt_tree/dir3/prefix- \
|
||||
! RUN: -B %S/Inputs/B_opt_tree/dir2 2>&1 -fuse-ld=ld \
|
||||
! RUN: | FileCheck --check-prefix=CHECK-B-OPT-MULT %s
|
||||
! CHECK-B-OPT-MULT: "{{.*}}/Inputs/B_opt_tree/dir3{{/|\\\\}}prefix-ld"
|
0
flang/test/Driver/Inputs/B_opt_tree/dir1/i386-unknown-linux-ld
Executable file
0
flang/test/Driver/Inputs/B_opt_tree/dir1/i386-unknown-linux-ld
Executable file
0
flang/test/Driver/Inputs/B_opt_tree/dir1/ld
Executable file
0
flang/test/Driver/Inputs/B_opt_tree/dir1/ld
Executable file
0
flang/test/Driver/Inputs/B_opt_tree/dir2/ld
Executable file
0
flang/test/Driver/Inputs/B_opt_tree/dir2/ld
Executable file
0
flang/test/Driver/Inputs/B_opt_tree/dir3/prefix-ld
Executable file
0
flang/test/Driver/Inputs/B_opt_tree/dir3/prefix-ld
Executable file
Loading…
x
Reference in New Issue
Block a user