Author: Kiran Chandramohan Date: 2024-10-01T15:01:32+01:00 New Revision: 28be39f174f109923c321b4111d21028db432e3e
URL: https://github.com/llvm/llvm-project/commit/28be39f174f109923c321b4111d21028db432e3e DIFF: https://github.com/llvm/llvm-project/commit/28be39f174f109923c321b4111d21028db432e3e.diff LOG: [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. Added: flang/test/Driver/B-opt.f90 flang/test/Driver/Inputs/B_opt_tree/dir1/i386-unknown-linux-ld flang/test/Driver/Inputs/B_opt_tree/dir1/ld flang/test/Driver/Inputs/B_opt_tree/dir2/ld flang/test/Driver/Inputs/B_opt_tree/dir3/prefix-ld Modified: clang/include/clang/Driver/Options.td Removed: ################################################################################ diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 607ff47a857b8f..9d183ff2d69b3c 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -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=">, diff --git a/flang/test/Driver/B-opt.f90 b/flang/test/Driver/B-opt.f90 new file mode 100644 index 00000000000000..f5cd58fa97d08b --- /dev/null +++ b/flang/test/Driver/B-opt.f90 @@ -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" diff --git a/flang/test/Driver/Inputs/B_opt_tree/dir1/i386-unknown-linux-ld b/flang/test/Driver/Inputs/B_opt_tree/dir1/i386-unknown-linux-ld new file mode 100755 index 00000000000000..e69de29bb2d1d6 diff --git a/flang/test/Driver/Inputs/B_opt_tree/dir1/ld b/flang/test/Driver/Inputs/B_opt_tree/dir1/ld new file mode 100755 index 00000000000000..e69de29bb2d1d6 diff --git a/flang/test/Driver/Inputs/B_opt_tree/dir2/ld b/flang/test/Driver/Inputs/B_opt_tree/dir2/ld new file mode 100755 index 00000000000000..e69de29bb2d1d6 diff --git a/flang/test/Driver/Inputs/B_opt_tree/dir3/prefix-ld b/flang/test/Driver/Inputs/B_opt_tree/dir3/prefix-ld new file mode 100755 index 00000000000000..e69de29bb2d1d6 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits