2 # UNSUPPORTED: system-windows
4 # RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -x c++ %s -### -o %t.out 2>&1 \
5 # RUN: --target=thumbv8m.main-none-eabihf --sysroot= \
7 # CHECK: "-cc1" "-triple" "thumbv8m.main-unknown-none-eabihf"
8 # CHECK-SAME: "-internal-isystem" "[[SYSROOT:[^"]*]]/bin/../lib/clang-runtimes/arm-none-eabi/thumb/v8-m.main/fp/include/c++/v1"
9 # CHECK-SAME: "-internal-isystem" "[[SYSROOT]]/bin/../lib/clang-runtimes/arm-none-eabi/thumb/v8-m.main/fp/include"
10 # CHECK-SAME: "-x" "c++" "{{.*}}baremetal-multilib.yaml"
11 # CHECK-NEXT: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic"
12 # CHECK-SAME: "-L[[SYSROOT]]/bin/../lib/clang-runtimes/arm-none-eabi/thumb/v8-m.main/fp/lib"
13 # CHECK-SAME: "{{[^"]*}}libclang_rt.builtins.a"
15 # CHECK-SAME: "-o" "{{.*}}.tmp.out"
17 # RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -x c++ %s -### -o %t.out 2>&1 \
18 # RUN: --target=thumbv7em-none-eabi -mfpu=fpv4-sp-d16 --sysroot= \
19 # RUN: | FileCheck --check-prefix=CHECK-NO-MATCH %s
20 # CHECK-NO-MATCH: warning: no multilib found matching flags:
21 # CHECK-NO-MATCH-SAME: --target=thumbv7em-unknown-none-eabi
22 # CHECK-NO-MATCH: note: available multilibs are:
23 # CHECK-NO-MATCH: --target=thumbv6m-unknown-none-eabi -mfpu=none
24 # CHECK-NO-MATCH: --target=thumbv7m-unknown-none-eabi -mfpu=none
25 # CHECK-NO-MATCH: --target=thumbv7em-unknown-none-eabi -mfpu=none
27 # RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -print-multi-directory 2>&1 \
28 # RUN: --target=thumbv8m.main-none-eabihf --sysroot= \
29 # RUN: | FileCheck --check-prefix=CHECK-PRINT-MULTI-DIRECTORY %s
30 # CHECK-PRINT-MULTI-DIRECTORY: arm-none-eabi/thumb/v8-m.main/fp
32 # RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -print-multi-lib 2>&1 \
33 # RUN: --target=arm-none-eabi --sysroot= \
34 # RUN: | FileCheck --check-prefix=CHECK-PRINT-MULTI-LIB %s
35 # CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v6-m/nofp;@-target=thumbv6m-unknown-none-eabi@mfpu=none
36 # CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v7-m/nofp;@-target=thumbv7m-unknown-none-eabi@mfpu=none
37 # CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v7e-m/nofp;@-target=thumbv7em-unknown-none-eabi@mfpu=none
38 # CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8-m.main/nofp;@-target=thumbv8m.main-unknown-none-eabi@mfpu=none
39 # CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8.1-m.main/nofp/nomve;@-target=thumbv8.1m.main-unknown-none-eabi@mfpu=none
40 # CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v7e-m/fpv4_sp_d16;@-target=thumbv7em-unknown-none-eabihf@mfpu=fpv4-sp-d16
41 # CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v7e-m/fpv5_d16;@-target=thumbv7em-unknown-none-eabihf@mfpu=fpv5-d16
42 # CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8-m.main/fp;@-target=thumbv8m.main-unknown-none-eabihf@mfpu=fpv5-d16
43 # CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8.1-m.main/fp;@-target=thumbv8.1m.main-unknown-none-eabihf@mfpu=fp-armv8-fullfp16-sp-d16
44 # CHECK-PRINT-MULTI-LIB: arm-none-eabi/thumb/v8.1-m.main/nofp/mve;@-target=thumbv8.1m.main-unknown-none-eabihf@march=thumbv8.1m.main+mve@mfpu=none
46 # RUN: %clang --multi-lib-config=%s -no-canonical-prefixes -x assembler -mexecute-only \
47 # RUN: --target=arm-none-eabi --sysroot= %s -c -### 2>&1 \
48 # RUN: | FileCheck %s --check-prefix=CHECK-NO-EXECUTE-ONLY-ASM
49 # CHECK-NO-EXECUTE-ONLY-ASM: warning: argument unused during compilation: '-mexecute-only'
52 # This file is in two parts:
53 # 1. A list of library variants.
54 # 2. A mapping from flags generated from command line arguments to further
57 # How does clang use this file?
58 # 1. If the ToolChain class for the architecture supports this form of
59 # multilib it then it loads the file if present in sysroot.
60 # 2. Generate flags from the user provided arguments.
61 # (Use `clang -print-multi-flags-experimental` to see which flags are
63 # 3. Compare the arguments against each regular expression and store
64 # associated flags if there's a match.
65 # 4. Find the last library variant whose flags are a subset of the
66 # flags derived from the user provided arguments.
67 # 5. Use the directory for the library variant as the sysroot.
69 # Clang will emit an error if this number is greater than its current multilib
70 # version or if its major version differs, but will accept lesser minor
74 # The first section of the file is the list of library variants.
75 # A library is considered compatible if the are a subset of the flags derived
76 # from the arguments provided by the user.
77 # If multiple libraries are deemed compatible then the one that appears
78 # last in the list wins. A ToolChain may instead opt to use more than one
79 # multilib, layered on top of each other.
82 - Dir: arm-none-eabi/arm/v4t
83 Flags: [--target=armv4t-unknown-none-eabi]
85 - Dir: arm-none-eabi/thumb/v6-m/nofp
86 Flags: [--target=thumbv6m-unknown-none-eabi, -mfpu=none]
88 - Dir: arm-none-eabi/thumb/v7-m/nofp
89 Flags: [--target=thumbv7m-unknown-none-eabi, -mfpu=none]
91 - Dir: arm-none-eabi/thumb/v7e-m/nofp
92 Flags: [--target=thumbv7em-unknown-none-eabi, -mfpu=none]
94 - Dir: arm-none-eabi/thumb/v8-m.main/nofp
95 Flags: [--target=thumbv8m.main-unknown-none-eabi, -mfpu=none]
97 - Dir: arm-none-eabi/thumb/v8.1-m.main/nofp/nomve
98 Flags: [--target=thumbv8.1m.main-unknown-none-eabi, -mfpu=none]
100 - Dir: arm-none-eabi/thumb/v7e-m/fpv4_sp_d16
101 Flags: [--target=thumbv7em-unknown-none-eabihf, -mfpu=fpv4-sp-d16]
103 - Dir: arm-none-eabi/thumb/v7e-m/fpv5_d16
104 Flags: [--target=thumbv7em-unknown-none-eabihf, -mfpu=fpv5-d16]
106 - Dir: arm-none-eabi/thumb/v8-m.main/fp
107 Flags: [--target=thumbv8m.main-unknown-none-eabihf, -mfpu=fpv5-d16]
109 - Dir: arm-none-eabi/thumb/v8.1-m.main/fp
110 Flags: [--target=thumbv8.1m.main-unknown-none-eabihf, -mfpu=fp-armv8-fullfp16-sp-d16]
112 - Dir: arm-none-eabi/thumb/v8.1-m.main/nofp/mve
113 Flags: [--target=thumbv8.1m.main-unknown-none-eabihf, -march=thumbv8.1m.main+mve, -mfpu=none]
116 # The second section of the file is a map from auto-detected flags
117 # to custom flags. The auto-detected flags can be printed out
118 # by running clang with `-print-multi-flags-experimental`.
119 # The regex must match a whole flag string.
120 # All flags in the "Flags" list will be added if an argument matches.
122 # For v8m.base (and potential later v8m baseline versions) use v6m
123 - Match: --target=thumbv8(\.[0-9]+)?m\.base-unknown-none-eabi
124 Flags: [--target=thumbv6m-unknown-none-eabi]
125 # Match versions after v8.1m.main. We assume that v8.2m (if/when it exists) will
126 # be backwards compatible with v8.1m.
127 # The alternative is to not recognise later versions, and require that
128 # this multilib spec is updated before it can be used with newer
129 # architecture versions.
130 - Match: --target=thumbv8\.[1-9]m\.main-unknown-none-eabi
131 Flags: [--target=thumbv8.1m.main-unknown-none-eabi]
132 - Match: --target=thumbv8\.[1-9]m\.main-unknown-none-eabihf
133 Flags: [--target=thumbv8.1m.main-unknown-none-eabihf]
135 - Match: -march=thumbv8\.[1-9]m\.main.*\+mve($|\+).*
136 Flags: [-march=thumbv8.1m.main+mve]
138 # Hierarchy among FPUs: fpvN-d16 is a superset of fpvN-sp-d16, and
139 # fpvN-d16 is a superset of fpv[N-1]-d16, for all N.
140 - Match: -mfpu=fpv5-d16
145 - Match: -mfpu=fpv5-sp-d16
148 - Match: -mfpu=fpv4-d16