[clang] [Clang][Driver] Add option to provide path for multilib's YAML config file (PR #109640)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 23 02:24:22 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-driver

Author: Lucas Duarte Prates (pratlucas)

<details>
<summary>Changes</summary>

Since the introduction of the use of a YAML file to configure the
selection of multilibs for baremetal, the path for that file has been
hardcoded into the clang driver code. This makes it difficult to provide
any alternative configurations for multilib and, by consequence, impacts
the tetability of any changes related to it - e.g. the existing multilib
YAML tests currently rely on creating fake toolchain directories to
inject their own configuration files.

This change introduces a new command line option to the clang driver,
`--multi-lib-config=`, to enable the use of a custom path to be used
when loading the multilib YAML config file. It also updates the existing
multilib YAML tests to use the new option.


---

Patch is 22.58 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/109640.diff


9 Files Affected:

- (modified) clang/include/clang/Driver/Options.td (+3) 
- (modified) clang/lib/Driver/ToolChains/BareMetal.cpp (+7) 
- (added) clang/test/Driver/Inputs/multilib/empty.yaml (+8) 
- (modified) clang/test/Driver/baremetal-multilib-custom-error.yaml (+5-12) 
- (modified) clang/test/Driver/baremetal-multilib-exclusive-group.yaml (+6-14) 
- (modified) clang/test/Driver/baremetal-multilib-group-error.yaml (+1-9) 
- (modified) clang/test/Driver/baremetal-multilib-layered.yaml (+4-10) 
- (modified) clang/test/Driver/baremetal-multilib.yaml (+7-14) 
- (modified) clang/test/Driver/print-multi-selection-flags.c (+19-19) 


``````````diff
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 002f60350543d9..ac95acd1e854a3 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5546,6 +5546,9 @@ def mthumb : Flag<["-"], "mthumb">, Group<m_Group>;
 def mtune_EQ : Joined<["-"], "mtune=">, Group<m_Group>,
   Visibility<[ClangOption, FlangOption]>,
   HelpText<"Only supported on AArch64, PowerPC, RISC-V, SPARC, SystemZ, and X86">;
+def multi_lib_config : Joined<["-", "--"], "multi-lib-config=">,
+  HelpText<"Path to the YAML configuration file to be used for multilib selection">,
+  MetaVarName<"<file>">;
 def multi__module : Flag<["-"], "multi_module">;
 def multiply__defined__unused : Separate<["-"], "multiply_defined_unused">;
 def multiply__defined : Separate<["-"], "multiply_defined">;
diff --git a/clang/lib/Driver/ToolChains/BareMetal.cpp b/clang/lib/Driver/ToolChains/BareMetal.cpp
index 8aed9ed6e18817..124acdd0a66a20 100644
--- a/clang/lib/Driver/ToolChains/BareMetal.cpp
+++ b/clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -172,6 +172,13 @@ static bool isPPCBareMetal(const llvm::Triple &Triple) {
 static void findMultilibsFromYAML(const ToolChain &TC, const Driver &D,
                                   StringRef MultilibPath, const ArgList &Args,
                                   DetectedMultilibs &Result) {
+  if (Arg *ConfigFileArg = Args.getLastArg(options::OPT_multi_lib_config)) {
+    MultilibPath = ConfigFileArg->getValue();
+    if (!D.getVFS().exists(MultilibPath)) {
+      D.Diag(clang::diag::err_drv_no_such_file) << MultilibPath.str();
+      return;
+    }
+  }
   llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> MB =
       D.getVFS().getBufferForFile(MultilibPath);
   if (!MB)
diff --git a/clang/test/Driver/Inputs/multilib/empty.yaml b/clang/test/Driver/Inputs/multilib/empty.yaml
new file mode 100644
index 00000000000000..82c476a13367cd
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib/empty.yaml
@@ -0,0 +1,8 @@
+
+MultilibVersion: 1.0
+
+Variants:
+
+Mappings:
+
+...
diff --git a/clang/test/Driver/baremetal-multilib-custom-error.yaml b/clang/test/Driver/baremetal-multilib-custom-error.yaml
index c006bb4072ce2f..151eece9f69954 100644
--- a/clang/test/Driver/baremetal-multilib-custom-error.yaml
+++ b/clang/test/Driver/baremetal-multilib-custom-error.yaml
@@ -1,35 +1,28 @@
 # REQUIRES: shell
 # UNSUPPORTED: system-windows
 
-# RUN: rm -rf %t
-# RUN: mkdir -p %t/bin
-# RUN: mkdir -p %t/lib/clang-runtimes/arm-none-eabi/thumb/v8-m.main/fp/lib
-# RUN: touch %t/lib/clang-runtimes/arm-none-eabi/thumb/v8-m.main/fp/lib/libclang_rt.builtins.a
-# RUN: ln -s %clang %t/bin/clang
-# RUN: ln -s %s %t/lib/clang-runtimes/multilib.yaml
-
-# RUN: %t/bin/clang -no-canonical-prefixes -print-multi-directory 2>&1 \
+# RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -print-multi-directory 2>&1 \
 # RUN:     --target=thumbv8m.main-none-eabi -march=armv8.1m.main --sysroot= \
 # RUN:   | FileCheck --check-prefix=CHECK-PRINT-MULTI-DIRECTORY-NOMVE-SOFTFLOAT %s
 # CHECK-PRINT-MULTI-DIRECTORY-NOMVE-SOFTFLOAT: nomve-softfloat
 
-# RUN: not %t/bin/clang -no-canonical-prefixes -print-multi-directory 2>&1 \
+# RUN: not %clang --multi-lib-config=%s -no-canonical-prefixes -print-multi-directory 2>&1 \
 # RUN:     --target=thumbv8m.main-none-eabi -march=armv8.1m.main+mve --sysroot= \
 # RUN:   | FileCheck --check-prefix=CHECK-ERROR %s
 # CHECK-ERROR: multilib configuration error: mve-softfloat is not supported
 
-# RUN: %t/bin/clang -no-canonical-prefixes -print-multi-directory 2>&1 \
+# RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -print-multi-directory 2>&1 \
 # RUN:     --target=thumbv8m.main-none-eabi -march=armv8.1m.main+mve -mfloat-abi=hard --sysroot= \
 # RUN:   | FileCheck --check-prefix=CHECK-PRINT-MULTI-DIRECTORY-MVE-HARDFLOAT %s
 # CHECK-PRINT-MULTI-DIRECTORY-MVE-HARDFLOAT: mve-hardfloat
 
-# RUN: %t/bin/clang -no-canonical-prefixes -print-multi-lib 2>&1 \
+# RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -print-multi-lib 2>&1 \
 # RUN:     --target=arm-none-eabi --sysroot= \
 # RUN:   | FileCheck --check-prefix=CHECK-PRINT-MULTI-LIB %s
 # CHECK-PRINT-MULTI-LIB: nomve-softfloat;@-target=thumbv8.1m.main-unknown-none-eabi
 # CHECK-PRINT-MULTI-LIB-NEXT: mve-hardfloat;@-target=thumbv8.1m.main-unknown-none-eabihf at march=thumbv8.1m.main+mve at mfloat-abi=hard
 
-# RUN: %t/bin/clang -no-canonical-prefixes -print-multi-directory 2>&1 \
+# RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -print-multi-directory 2>&1 \
 # RUN:     --target=arm-none-eabi --sysroot= \
 # RUN:   | FileCheck --check-prefix=CHECK-NO-MATCH-WARNING %s
 # CHECK-NO-MATCH-WARNING: clang: note: available multilibs are:
diff --git a/clang/test/Driver/baremetal-multilib-exclusive-group.yaml b/clang/test/Driver/baremetal-multilib-exclusive-group.yaml
index a98549efea4f0a..8f9e2900f92711 100644
--- a/clang/test/Driver/baremetal-multilib-exclusive-group.yaml
+++ b/clang/test/Driver/baremetal-multilib-exclusive-group.yaml
@@ -1,17 +1,9 @@
 # UNSUPPORTED: system-windows
 
-# RUN: rm -rf %t
+# RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -x c++ %s -### -o %t.out --target=thumbv7em-none-unknown-eabi --sysroot= 2>%t.err
 
-# RUN: mkdir -p %t/baremetal_multilib/bin
-# RUN: ln -s %clang %t/baremetal_multilib/bin/clang
-
-# RUN: mkdir -p %t/baremetal_multilib/lib/clang-runtimes
-# RUN: ln -s %s %t/baremetal_multilib/lib/clang-runtimes/multilib.yaml
-
-# RUN: %t/baremetal_multilib/bin/clang -no-canonical-prefixes -x c++ %s -### -o %t.out --target=thumbv7em-none-unknown-eabi --sysroot= 2>%t.err
-
-# RUN: FileCheck -DSYSROOT=%t/baremetal_multilib %s < %t.err --check-prefix=POS
-# RUN: FileCheck -DSYSROOT=%t/baremetal_multilib %s < %t.err --check-prefix=NEG
+# RUN: FileCheck %s < %t.err --check-prefix=POS
+# RUN: FileCheck %s < %t.err --check-prefix=NEG
 
 # Expected results:
 #
@@ -25,14 +17,14 @@
 # So we expect five of these seven directories to show up in the clang-cc1
 # command line, but not testdir1_exclusive or testdir2_exclusive.
 
-# POS-DAG: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/testdir1_non_exclusive/include/c++/v1"
+# POS-DAG: "-internal-isystem" "[[SYSROOT:[^"]*]]/bin/../lib/clang-runtimes/testdir1_non_exclusive/include/c++/v1"
 # POS-DAG: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/testdir2_non_exclusive/include/c++/v1"
 # POS-DAG: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/testdir3_exclusive/include/c++/v1"
 # POS-DAG: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/testdir1_own_group/include/c++/v1"
 # POS-DAG: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/testdir2_own_group/include/c++/v1"
 
-# NEG-NOT: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/testdir1_exclusive/include/c++/v1"
-# NEG-NOT: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/testdir2_exclusive/include/c++/v1"
+# NEG-NOT: "-internal-isystem" "{{[^"]*}}/bin/../lib/clang-runtimes/testdir1_exclusive/include/c++/v1"
+# NEG-NOT: "-internal-isystem" "{{[^"]*}}/bin/../lib/clang-runtimes/testdir2_exclusive/include/c++/v1"
 
 ---
 MultilibVersion: 1.0
diff --git a/clang/test/Driver/baremetal-multilib-group-error.yaml b/clang/test/Driver/baremetal-multilib-group-error.yaml
index 1e8f83fa50d244..b73e4bd21a43af 100644
--- a/clang/test/Driver/baremetal-multilib-group-error.yaml
+++ b/clang/test/Driver/baremetal-multilib-group-error.yaml
@@ -1,14 +1,6 @@
 # UNSUPPORTED: system-windows
 
-# RUN: rm -rf %t
-
-# RUN: mkdir -p %t/baremetal_multilib/bin
-# RUN: ln -s %clang %t/baremetal_multilib/bin/clang
-
-# RUN: mkdir -p %t/baremetal_multilib/lib/clang-runtimes
-# RUN: ln -s %s %t/baremetal_multilib/lib/clang-runtimes/multilib.yaml
-
-# RUN: %t/baremetal_multilib/bin/clang -no-canonical-prefixes -x c++ %s -### -o %t.out --target=thumbv7em-none-unknown-eabi --sysroot= 2>%t.err
+# RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -x c++ %s -### -o %t.out --target=thumbv7em-none-unknown-eabi --sysroot= 2>%t.err
 # RUN: FileCheck %s < %t.err
 
 ---
diff --git a/clang/test/Driver/baremetal-multilib-layered.yaml b/clang/test/Driver/baremetal-multilib-layered.yaml
index a525436d8122f5..6671d9d672f58e 100644
--- a/clang/test/Driver/baremetal-multilib-layered.yaml
+++ b/clang/test/Driver/baremetal-multilib-layered.yaml
@@ -9,24 +9,18 @@
 # However -fno-exceptions is not yet supported for multilib selection
 # so we use a more contrived -mfloat-abi example instead.
 
-# RUN: rm -rf %T/baremetal_multilib_layered
-# RUN: mkdir -p %T/baremetal_multilib_layered/bin
-# RUN: mkdir -p %T/baremetal_multilib_layered/lib/clang-runtimes
-# RUN: ln -s %clang %T/baremetal_multilib_layered/bin/clang
-# RUN: ln -s %s %T/baremetal_multilib_layered/lib/clang-runtimes/multilib.yaml
-
-# RUN: %T/baremetal_multilib_layered/bin/clang -no-canonical-prefixes -x c++ %s -### -o %t.out 2>&1 \
+# RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -x c++ %s -### -o %t.out 2>&1 \
 # RUN:     --target=thumbv7m-none-eabi -mfloat-abi=softfp --sysroot= \
-# RUN:   | FileCheck -DSYSROOT=%T/baremetal_multilib_layered %s
+# RUN:   | FileCheck %s
 # CHECK:      "-cc1" "-triple" "thumbv7m-unknown-none-eabi"
-# CHECK-SAME: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/softfp/include/c++/v1"
+# CHECK-SAME: "-internal-isystem" "[[SYSROOT:[^"]*]]/bin/../lib/clang-runtimes/softfp/include/c++/v1"
 # CHECK-SAME: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/soft/include/c++/v1"
 # CHECK-SAME: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/softfp/include"
 # CHECK-SAME: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/soft/include"
 # CHECK-NEXT: "-L[[SYSROOT]]/bin/../lib/clang-runtimes/softfp/lib"
 # CHECK-SAME: "-L[[SYSROOT]]/bin/../lib/clang-runtimes/soft/lib"
 
-# RUN: %T/baremetal_multilib_layered/bin/clang -no-canonical-prefixes -print-multi-directory 2>&1 \
+# RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -print-multi-directory 2>&1 \
 # RUN:     --target=arm-none-eabi -mfloat-abi=softfp --sysroot= \
 # RUN:   | FileCheck --check-prefix=CHECK-PRINT-MULTI-DIRECTORY %s
 # CHECK-PRINT-MULTI-DIRECTORY:      soft
diff --git a/clang/test/Driver/baremetal-multilib.yaml b/clang/test/Driver/baremetal-multilib.yaml
index 9ed83e4aec839c..b6bfd0ed3a94cb 100644
--- a/clang/test/Driver/baremetal-multilib.yaml
+++ b/clang/test/Driver/baremetal-multilib.yaml
@@ -1,18 +1,11 @@
 # REQUIRES: shell
 # UNSUPPORTED: system-windows
 
-# RUN: rm -rf %T/baremetal_multilib
-# RUN: mkdir -p %T/baremetal_multilib/bin
-# RUN: mkdir -p %T/baremetal_multilib/lib/clang-runtimes/arm-none-eabi/thumb/v8-m.main/fp/lib
-# RUN: touch %T/baremetal_multilib/lib/clang-runtimes/arm-none-eabi/thumb/v8-m.main/fp/lib/libclang_rt.builtins.a
-# RUN: ln -s %clang %T/baremetal_multilib/bin/clang
-# RUN: ln -s %s %T/baremetal_multilib/lib/clang-runtimes/multilib.yaml
-
-# RUN: %T/baremetal_multilib/bin/clang -no-canonical-prefixes -x c++ %s -### -o %t.out 2>&1 \
+# RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -x c++ %s -### -o %t.out 2>&1 \
 # RUN:     --target=thumbv8m.main-none-eabihf --sysroot= \
-# RUN:   | FileCheck -DSYSROOT=%T/baremetal_multilib %s
+# RUN:   | FileCheck %s
 # CHECK:      "-cc1" "-triple" "thumbv8m.main-unknown-none-eabihf"
-# CHECK-SAME: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/arm-none-eabi/thumb/v8-m.main/fp/include/c++/v1"
+# CHECK-SAME: "-internal-isystem" "[[SYSROOT:[^"]*]]/bin/../lib/clang-runtimes/arm-none-eabi/thumb/v8-m.main/fp/include/c++/v1"
 # CHECK-SAME: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/arm-none-eabi/thumb/v8-m.main/fp/include"
 # CHECK-SAME: "-x" "c++" "{{.*}}baremetal-multilib.yaml"
 # CHECK-NEXT: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
@@ -20,7 +13,7 @@
 # CHECK-SAME: "-lc" "-lm" "{{[^"]*}}libclang_rt.builtins.a"
 # CHECK-SAME: "-o" "{{.*}}.tmp.out"
 
-# RUN: %T/baremetal_multilib/bin/clang -no-canonical-prefixes -x c++ %s -### -o %t.out 2>&1 \
+# RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -x c++ %s -### -o %t.out 2>&1 \
 # RUN:     --target=thumbv7em-none-eabi -mfpu=fpv4-sp-d16 --sysroot= \
 # RUN:   | FileCheck --check-prefix=CHECK-NO-MATCH %s
 # CHECK-NO-MATCH: warning: no multilib found matching flags:
@@ -30,12 +23,12 @@
 # CHECK-NO-MATCH: --target=thumbv7m-unknown-none-eabi -mfpu=none
 # CHECK-NO-MATCH: --target=thumbv7em-unknown-none-eabi -mfpu=none
 
-# RUN: %T/baremetal_multilib/bin/clang -no-canonical-prefixes -print-multi-directory 2>&1 \
+# RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -print-multi-directory 2>&1 \
 # RUN:     --target=thumbv8m.main-none-eabihf --sysroot= \
 # RUN:   | FileCheck --check-prefix=CHECK-PRINT-MULTI-DIRECTORY %s
 # CHECK-PRINT-MULTI-DIRECTORY: arm-none-eabi/thumb/v8-m.main/fp
 
-# RUN: %T/baremetal_multilib/bin/clang -no-canonical-prefixes -print-multi-lib 2>&1 \
+# RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -print-multi-lib 2>&1 \
 # RUN:     --target=arm-none-eabi --sysroot= \
 # RUN:   | FileCheck --check-prefix=CHECK-PRINT-MULTI-LIB %s
 # CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v6-m/nofp;@-target=thumbv6m-unknown-none-eabi at mfpu=none
@@ -49,7 +42,7 @@
 # CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8.1-m.main/fp;@-target=thumbv8.1m.main-unknown-none-eabihf at mfpu=fp-armv8-fullfp16-sp-d16
 # CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8.1-m.main/nofp/mve;@-target=thumbv8.1m.main-unknown-none-eabihf at march=thumbv8.1m.main+mve at mfpu=none
 
-# RUN: %T/baremetal_multilib/bin/clang -no-canonical-prefixes -x assembler -mexecute-only \
+# RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -x assembler -mexecute-only \
 # RUN:     --target=arm-none-eabi --sysroot= %s -c -### 2>&1 \
 # RUN:    | FileCheck %s --check-prefix=CHECK-NO-EXECUTE-ONLY-ASM
 # CHECK-NO-EXECUTE-ONLY-ASM: warning: argument unused during compilation: '-mexecute-only'
diff --git a/clang/test/Driver/print-multi-selection-flags.c b/clang/test/Driver/print-multi-selection-flags.c
index 0116c7f5a03b9a..045cfec080540e 100644
--- a/clang/test/Driver/print-multi-selection-flags.c
+++ b/clang/test/Driver/print-multi-selection-flags.c
@@ -1,79 +1,79 @@
-// RUN: %clang -print-multi-flags-experimental --target=aarch64-linux -fc++-abi=itanium -fsanitize=address | FileCheck --check-prefix=CHECK-LINUX %s
+// RUN: %clang -multi-lib-config=%S/Inputs/multilib/empty.yaml -print-multi-flags-experimental --target=aarch64-linux -fc++-abi=itanium -fsanitize=address | FileCheck --check-prefix=CHECK-LINUX %s
 // CHECK-LINUX: --target=aarch64-unknown-linux
 
-// RUN: %clang -print-multi-flags-experimental --target=aarch64-fuchsia -fsanitize=hwaddress | FileCheck --check-prefix=CHECK-FUCHSIA %s
+// RUN: %clang -multi-lib-config=%S/Inputs/multilib/empty.yaml -print-multi-flags-experimental --target=aarch64-fuchsia -fsanitize=hwaddress | FileCheck --check-prefix=CHECK-FUCHSIA %s
 // CHECK-FUCHSIA: --target=aarch64-unknown-fuchsia
 
-// RUN: %clang -print-multi-flags-experimental --target=arm-none-eabi -mfloat-abi=soft -fno-exceptions -fno-rtti | FileCheck --check-prefix=CHECK-ARMV4T %s
+// RUN: %clang -multi-lib-config=%S/Inputs/multilib/empty.yaml -print-multi-flags-experimental --target=arm-none-eabi -mfloat-abi=soft -fno-exceptions -fno-rtti | FileCheck --check-prefix=CHECK-ARMV4T %s
 // CHECK-ARMV4T: --target=armv4t-unknown-none-eabi
 // CHECK-ARMV4T: -mfloat-abi=soft
 // CHECK-ARMV4T: -mfpu=none
 
-// RUN: %clang -print-multi-flags-experimental --target=armv7em-none-eabi -mfloat-abi=softfp | FileCheck --check-prefix=CHECK-SOFTFP %s
+// RUN: %clang -multi-lib-config=%S/Inputs/multilib/empty.yaml -print-multi-flags-experimental --target=armv7em-none-eabi -mfloat-abi=softfp | FileCheck --check-prefix=CHECK-SOFTFP %s
 // CHECK-SOFTFP: --target=thumbv7em-unknown-none-eabi
 // CHECK-SOFTFP: -mfloat-abi=softfp
 // CHECK-SOFTFP: -mfpu=fpv4-sp-d16
 
-// RUN: %clang -print-multi-flags-experimental --target=arm-none-eabihf -march=armv7em -mfpu=fpv5-d16 | FileCheck --check-prefix=CHECK-HARD %s
+// RUN: %clang -multi-lib-config=%S/Inputs/multilib/empty.yaml -print-multi-flags-experimental --target=arm-none-eabihf -march=armv7em -mfpu=fpv5-d16 | FileCheck --check-prefix=CHECK-HARD %s
 // CHECK-HARD: --target=thumbv7em-unknown-none-eabihf
 // CHECK-HARD: -mfloat-abi=hard
 // CHECK-HARD: -mfpu=fpv5-d16
 
-// RUN: %clang -print-multi-flags-experimental --target=arm-none-eabi -mfloat-abi=soft -march=armv8-m.main+nofp | FileCheck --check-prefix=CHECK-V8MMAIN-NOFP %s
+// RUN: %clang -multi-lib-config=%S/Inputs/multilib/empty.yaml -print-multi-flags-experimental --target=arm-none-eabi -mfloat-abi=soft -march=armv8-m.main+nofp | FileCheck --check-prefix=CHECK-V8MMAIN-NOFP %s
 // CHECK-V8MMAIN-NOFP: --target=thumbv8m.main-unknown-none-eabi
 // CHECK-V8MMAIN-NOFP: -mfloat-abi=soft
 // CHECK-V8MMAIN-NOFP: -mfpu=none
 
-// RUN: %clang -print-multi-flags-experimental --target=arm-none-eabi -mfloat-abi=hard -march=armv8.1m.main+mve.fp | FileCheck --check-prefix=CHECK-MVE %s
+// RUN: %clang -multi-lib-config=%S/Inputs/multilib/empty.yaml -print-multi-flags-experimental --target=arm-none-eabi -mfloat-abi=hard -march=armv8.1m.main+mve.fp | FileCheck --check-prefix=CHECK-MVE %s
 // CHECK-MVE: --target=thumbv8.1m.main-unknown-none-eabihf
 // CHECK-MVE: -march=thumbv8.1m.main{{.*}}+mve{{.*}}+mve.fp{{.*}}
 // CHECK-MVE: -mfloat-abi=hard
 // CHECK-MVE: -mfpu=fp-armv8-fullfp16-sp-d16
 
-// RUN: %clang -print-multi-flags-experimental --target=arm-none-eabi -march=armv8.1m.main+mve+nofp | FileCheck --check-prefix=CHECK-MVENOFP %s
+// RUN: %clang -multi-lib-config=%S/Inputs/multilib/empty.yaml -print-multi-flags-experimental --target=arm-none-eabi -march=armv8.1m.main+mve+nofp | FileCheck --check-prefix=CHECK-MVENOFP %s
 // CHECK-MVENOFP: -march=thumbv8.1m.main{{.*}}+mve{{.*}}
 // CHECK-MVENOFP-NOT: -march=thumbv8.1m.main{{.*}}+mve.fp{{.*}}
 // CHECK-MVENOFP: -mfpu=none
 
-// RUN: %clang -print-multi-flags-experimental --target=arm-none-eabihf -march=armv8.1m.main+fp.dp | FileCheck --check-prefix=CHECK-V8_1_FP_DP %s
+// RUN: %clang -multi-lib-config=%S/Inputs/multilib/empty.yaml -print-multi-flags-experimental --target=arm-none-eabihf -march=armv8.1m.main+fp.dp | FileCheck --check-prefix=CHECK-V8_1_FP_DP %s
 // CHECK-V8_1_FP_DP: -march=thumbv8.1m.main{{.*}}
 // CHECK-V8_1_FP_DP: -mfloat-abi=hard
 // CHECK-V8_1_FP_DP: -mfpu=fp-armv8-fullfp16-d16
 
-// RUN: %clang -print-multi-flags-experimental --target=arm-none-eabihf -march=armv8.1m.main+nofp+fp+nofp.dp | FileCheck --check-prefix=CHECK-V8_1_NO_FP_DP %s
+// RUN: %clang -multi-lib-config=%S/Inputs/multilib/empty.yaml -print-multi-flags-experimental --target=arm-none-eabihf -march=armv8.1m.main+nofp+fp+nofp.dp | FileCheck --check-prefix=CHECK-V8_1_NO_FP_DP %s
 // CHECK-V8_1_NO_FP_DP: -march=thumbv8.1m.main{{.*}}
 // CHECK-V8_1_NO_FP_DP: -mfloat-abi=hard
 // CHECK-V8_1_NO_FP_DP: -mfpu=fp-armv8-fullfp16-sp-d16
 
-// RUN: %clang -print-multi-flags-experimental --target=arm-none-eabihf -mcpu=cortex-m85+nofp.dp | FileCheck --check-prefix=CHECK-M85_NO_FP_DP %s
+// RUN: %clang -multi-lib-config=%S/Inputs/multilib/empty.yaml -print-multi-flags-experimental --target=arm-none-eabihf -mcpu=cortex-m85+nofp.dp | FileCheck --check-prefix=CHECK-M85_NO_FP_DP %s
 // CHECK-M85_NO_FP_DP: -march=thumbv8.1m.main{{.*}}
 // CHECK-M85_NO_FP_DP: -mfloat-abi=hard
 // CHECK-M85_NO_FP_DP: -mfpu=fp-armv8-fullfp16-sp-d16
 
-// RUN: %clang -print-multi-flags-experimental --target=aarch64-none-elf -march=armv8-a+lse | FileCheck --check-prefix=CHECK-LSE %s
+// RUN: %clang -multi-lib-config=%S/Inputs/multilib/empty.yaml -print-multi-flags-experimental --target=aarch64-none-elf -march=armv8-a+lse | FileCheck --check-prefix=CHECK-LSE %s
 // CHECK-LSE: --target=aarch64-unknown-none-elf
 // CHECK-LSE: -march=armv8-a{{.*}}+lse{{.*}}
 
-// RUN: %clang -print-multi-flags-experimental --target=aarch64-none-elf -march=armv8.5-a+sve+sve2 | FileCheck --check-prefix=CHECK-SVE2 %s
-// RUN: %clang -print-multi-flags-experimental --target=aarch64-none-elf -march=armv9-a            | FileCheck --check-prefix=CHECK-SVE2 %s
+// RUN: %clang -multi-lib-config=%S/Inputs/multilib/empty.yaml -print-multi-flags-experimental --target=aarch64-none-elf -march=armv8.5-a+sve+sve2 | FileCheck --check-prefix=CHECK-SVE2 %s
+// RUN: %clang -multi-lib-config=%S/Inputs/multilib/empty.yaml -print-multi-flags-experimental --target=aarch64-none-elf -march=arm...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/109640


More information about the cfe-commits mailing list