|
35 | 35 | // CK-HELP: {{.*}}USAGE: clang-offload-bundler [options]
|
36 | 36 | // CK-HELP: {{.*}}-allow-missing-bundles {{.*}}- Create empty files if bundles are missing when unbundling
|
37 | 37 | // CK-HELP: {{.*}}-inputs=<string> - [<input file>,...]
|
| 38 | +// CK-HELP: {{.*}}-list {{.*}}- List bundle IDs in the bundled file. |
38 | 39 | // CK-HELP: {{.*}}-outputs=<string> - [<output file>,...]
|
39 | 40 | // CK-HELP: {{.*}}-targets=<string> - [<offload kind>-<target triple>,...]
|
40 | 41 | // CK-HELP: {{.*}}-type=<string> - Type of the files to be bundled/unbundled.
|
|
54 | 55 | //
|
55 | 56 | // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR1
|
56 | 57 | // CK-ERR1: error: only one input file supported in unbundling mode
|
57 |
| -// CK-ERR1: error: number of output files and targets should match in unbundling mode |
| 58 | + |
| 59 | +// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i -outputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR1A |
| 60 | +// CK-ERR1A: error: number of output files and targets should match in unbundling mode |
58 | 61 |
|
59 | 62 | // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR2
|
60 | 63 | // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR2
|
61 | 64 | // CK-ERR2: error: number of input files and targets should match in bundling mode
|
62 | 65 |
|
63 | 66 | // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR3
|
64 | 67 | // CK-ERR3: error: only one output file supported in bundling mode
|
65 |
| -// CK-ERR3: error: number of input files and targets should match in bundling mode |
66 | 68 |
|
67 | 69 | // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR4
|
68 | 70 | // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.i,%t.tgt1 -inputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR4
|
|
76 | 78 | // CK-ERR6: error: '[[TYPE]]': invalid file type specified
|
77 | 79 |
|
78 | 80 | // RUN: not clang-offload-bundler 2>&1 | FileCheck %s --check-prefix CK-ERR7
|
79 |
| -// CK-ERR7-DAG: clang-offload-bundler: for the --type option: must be specified at least once! |
80 |
| -// CK-ERR7-DAG: clang-offload-bundler: for the --inputs option: must be specified at least once! |
81 |
| -// CK-ERR7-DAG: clang-offload-bundler: for the --outputs option: must be specified at least once! |
82 |
| -// CK-ERR7-DAG: clang-offload-bundler: for the --targets option: must be specified at least once! |
| 81 | +// CK-ERR7: clang-offload-bundler: for the --type option: must be specified at least once! |
| 82 | + |
| 83 | +// RUN: not clang-offload-bundler -type=i -inputs=%t.i,%t.tgt1,%t.tgt2 2>&1 | FileCheck %s -check-prefix=CK-ERR7A |
| 84 | +// CK-ERR7A: error: for the --outputs option: must be specified at least once! |
| 85 | + |
| 86 | +// RUN: not clang-offload-bundler -type=i -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s -check-prefix=CK-ERR7B |
| 87 | +// CK-ERR7B: error: for the --targets option: must be specified at least once! |
83 | 88 |
|
84 | 89 | // RUN: not clang-offload-bundler -type=i -targets=hxst-powerpcxxle-ibm-linux-gnu,openxp-pxxerpc64le-ibm-linux-gnu,xpenmp-x86_xx-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR8
|
85 | 90 | // CK-ERR8: error: invalid target 'hxst-powerpcxxle-ibm-linux-gnu', unknown offloading kind 'hxst', unknown target triple 'powerpcxxle-ibm-linux-gnu'
|
86 |
| -// CK-ERR8: error: invalid target 'openxp-pxxerpc64le-ibm-linux-gnu', unknown offloading kind 'openxp', unknown target triple 'pxxerpc64le-ibm-linux-gnu' |
87 |
| -// CK-ERR8: error: invalid target 'xpenmp-x86_xx-pc-linux-gnu', unknown offloading kind 'xpenmp', unknown target triple 'x86_xx-pc-linux-gnu' |
| 91 | + |
| 92 | +// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openxp-pxxerpc64le-ibm-linux-gnu,xpenmp-x86_xx-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR8A |
| 93 | +// CK-ERR8A: error: invalid target 'openxp-pxxerpc64le-ibm-linux-gnu', unknown offloading kind 'openxp', unknown target triple 'pxxerpc64le-ibm-linux-gnu' |
| 94 | + |
| 95 | +// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,xpenmp-x86_xx-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR8B |
| 96 | +// CK-ERR8B: error: invalid target 'xpenmp-x86_xx-pc-linux-gnu', unknown offloading kind 'xpenmp', unknown target triple 'x86_xx-pc-linux-gnu' |
88 | 97 |
|
89 | 98 | // RUN: not clang-offload-bundler -type=i -targets=openmp-powerpc64le-linux,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR9A
|
90 |
| -// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR9B |
91 | 99 | // CK-ERR9A: error: expecting exactly one host target but got 0
|
| 100 | + |
| 101 | +// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR9B |
92 | 102 | // CK-ERR9B: error: Duplicate targets are not allowed
|
93 | 103 |
|
94 | 104 | //
|
|
152 | 162 | //
|
153 | 163 | // Check text unbundle. Check if we get the exact same content that we bundled before for each file.
|
154 | 164 | //
|
| 165 | +// RUN: clang-offload-bundler -type=i -inputs=%t.bundle3.i -list | FileCheck -check-prefix=CKLST %s |
155 | 166 | // RUN: clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.i,%t.res.tgt1,%t.res.tgt2 -inputs=%t.bundle3.i -unbundle
|
156 | 167 | // RUN: diff %t.i %t.res.i
|
157 | 168 | // RUN: diff %t.tgt1 %t.res.tgt1
|
158 | 169 | // RUN: diff %t.tgt2 %t.res.tgt2
|
159 | 170 | // RUN: clang-offload-bundler -type=i -targets=openmp-powerpc64le-ibm-linux-gnu -outputs=%t.res.tgt1 -inputs=%t.bundle3.i -unbundle
|
160 | 171 | // RUN: diff %t.tgt1 %t.res.tgt1
|
| 172 | +// RUN: clang-offload-bundler -type=ii -inputs=%t.bundle3.ii -list | FileCheck -check-prefix=CKLST %s |
161 | 173 | // RUN: clang-offload-bundler -type=ii -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.ii,%t.res.tgt1,%t.res.tgt2 -inputs=%t.bundle3.ii -unbundle
|
162 | 174 | // RUN: diff %t.ii %t.res.ii
|
163 | 175 | // RUN: diff %t.tgt1 %t.res.tgt1
|
164 | 176 | // RUN: diff %t.tgt2 %t.res.tgt2
|
165 | 177 | // RUN: clang-offload-bundler -type=ii -targets=openmp-x86_64-pc-linux-gnu -outputs=%t.res.tgt2 -inputs=%t.bundle3.ii -unbundle
|
166 | 178 | // RUN: diff %t.tgt2 %t.res.tgt2
|
| 179 | +// RUN: clang-offload-bundler -type=ll -inputs=%t.bundle3.ll -list | FileCheck -check-prefix=CKLST %s |
167 | 180 | // RUN: clang-offload-bundler -type=ll -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.ll,%t.res.tgt1,%t.res.tgt2 -inputs=%t.bundle3.ll -unbundle
|
168 | 181 | // RUN: diff %t.ll %t.res.ll
|
169 | 182 | // RUN: diff %t.tgt1 %t.res.tgt1
|
170 | 183 | // RUN: diff %t.tgt2 %t.res.tgt2
|
171 | 184 | // RUN: clang-offload-bundler -type=ll -targets=openmp-powerpc64le-ibm-linux-gnu -outputs=%t.res.tgt1 -inputs=%t.bundle3.ll -unbundle
|
172 | 185 | // RUN: diff %t.tgt1 %t.res.tgt1
|
| 186 | +// RUN: clang-offload-bundler -type=s -inputs=%t.bundle3.s -list | FileCheck -check-prefix=CKLST %s |
173 | 187 | // RUN: clang-offload-bundler -type=s -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.s,%t.res.tgt1,%t.res.tgt2 -inputs=%t.bundle3.s -unbundle
|
174 | 188 | // RUN: diff %t.s %t.res.s
|
175 | 189 | // RUN: diff %t.tgt1 %t.res.tgt1
|
|
182 | 196 | // RUN: diff %t.tgt2 %t.res.tgt2
|
183 | 197 |
|
184 | 198 | // Check if we can unbundle a file with no magic strings.
|
| 199 | +// RUN: clang-offload-bundler -type=s -inputs=%t.s -list | FileCheck -check-prefix=CKLST2 --allow-empty %s |
185 | 200 | // RUN: clang-offload-bundler -type=s -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.s,%t.res.tgt1,%t.res.tgt2 -inputs=%t.s -unbundle -allow-missing-bundles
|
186 | 201 | // RUN: diff %t.s %t.res.s
|
187 | 202 | // RUN: diff %t.empty %t.res.tgt1
|
|
202 | 217 | // RUN: clang-offload-bundler -type=gch -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.ast,%t.tgt1,%t.tgt2 -outputs=%t.bundle3.gch
|
203 | 218 | // RUN: clang-offload-bundler -type=ast -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.ast,%t.tgt1,%t.tgt2 -outputs=%t.bundle3.ast
|
204 | 219 | // RUN: clang-offload-bundler -type=ast -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -inputs=%t.tgt1,%t.ast,%t.tgt2 -outputs=%t.bundle3.unordered.ast
|
| 220 | +// RUN: clang-offload-bundler -type=bc -inputs=%t.bundle3.bc -list | FileCheck -check-prefix=CKLST %s |
205 | 221 | // RUN: clang-offload-bundler -type=bc -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.bc,%t.res.tgt1,%t.res.tgt2 -inputs=%t.bundle3.bc -unbundle
|
206 | 222 | // RUN: diff %t.bc %t.res.bc
|
207 | 223 | // RUN: diff %t.tgt1 %t.res.tgt1
|
208 | 224 | // RUN: diff %t.tgt2 %t.res.tgt2
|
209 | 225 | // RUN: clang-offload-bundler -type=bc -targets=openmp-powerpc64le-ibm-linux-gnu -outputs=%t.res.tgt1 -inputs=%t.bundle3.bc -unbundle
|
210 | 226 | // RUN: diff %t.tgt1 %t.res.tgt1
|
| 227 | +// RUN: clang-offload-bundler -type=gch -inputs=%t.bundle3.gch -list | FileCheck -check-prefix=CKLST %s |
211 | 228 | // RUN: clang-offload-bundler -type=gch -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.gch,%t.res.tgt1,%t.res.tgt2 -inputs=%t.bundle3.gch -unbundle
|
212 | 229 | // RUN: diff %t.ast %t.res.gch
|
213 | 230 | // RUN: diff %t.tgt1 %t.res.tgt1
|
214 | 231 | // RUN: diff %t.tgt2 %t.res.tgt2
|
215 | 232 | // RUN: clang-offload-bundler -type=gch -targets=openmp-x86_64-pc-linux-gnu -outputs=%t.res.tgt2 -inputs=%t.bundle3.gch -unbundle
|
216 | 233 | // RUN: diff %t.tgt2 %t.res.tgt2
|
| 234 | +// RUN: clang-offload-bundler -type=ast -inputs=%t.bundle3.ast -list | FileCheck -check-prefix=CKLST %s |
217 | 235 | // RUN: clang-offload-bundler -type=ast -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.ast,%t.res.tgt1,%t.res.tgt2 -inputs=%t.bundle3.ast -unbundle
|
218 | 236 | // RUN: diff %t.ast %t.res.ast
|
219 | 237 | // RUN: diff %t.tgt1 %t.res.tgt1
|
|
258 | 276 | // CK-OBJ-CMD: llvm-objcopy{{(.exe)?}}" "--set-section-flags=__CLANG_OFFLOAD_BUNDLE__host-[[HOST]]=readonly,exclude" "--set-section-flags=__CLANG_OFFLOAD_BUNDLE__openmp-powerpc64le-ibm-linux-gnu=readonly,exclude" "--set-section-flags=__CLANG_OFFLOAD_BUNDLE__openmp-x86_64-pc-linux-gnu=readonly,exclude" "[[TEMPOBJ]]" "[[OUTOBJ]]"
|
259 | 277 |
|
260 | 278 | // RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.o,%t.tgt1,%t.tgt2 -outputs=%t.bundle3.o
|
| 279 | +// RUN: clang-offload-bundler -type=o -inputs=%t.bundle3.o -list | FileCheck -check-prefix=CKLST %s |
261 | 280 | // RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.o,%t.res.tgt1,%t.res.tgt2 -inputs=%t.bundle3.o -unbundle
|
262 | 281 | // RUN: diff %t.bundle3.o %t.res.o
|
263 | 282 | // RUN: diff %t.tgt1 %t.res.tgt1
|
|
270 | 289 | // RUN: diff %t.tgt1 %t.res.tgt1
|
271 | 290 |
|
272 | 291 | // Check if we can unbundle a file with no magic strings.
|
| 292 | +// RUN: clang-offload-bundler -type=o -inputs=%t.o -list | FileCheck -check-prefix=CKLST2 --allow-empty %s |
273 | 293 | // RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.res.o,%t.res.tgt1,%t.res.tgt2 -inputs=%t.o -unbundle -allow-missing-bundles
|
274 | 294 | // RUN: diff %t.o %t.res.o
|
275 | 295 | // RUN: diff %t.empty %t.res.tgt1
|
|
318 | 338 | // RUN: -targets=hip-amdgcn-amd-amdhsa-gfx906,hip-amdgcn-amd-amdhsa-gfx906 \
|
319 | 339 | // RUN: 2>&1 | FileCheck -check-prefix=DUP %s
|
320 | 340 | // DUP: error: Duplicate targets are not allowed
|
| 341 | +// |
| 342 | +// Check -list option |
| 343 | +// |
| 344 | + |
| 345 | +// RUN: clang-offload-bundler -bundle-align=4096 -type=bc -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.bc,%t.tgt1,%t.tgt2 -outputs=%t.bundle3.bc |
| 346 | +// RUN: not clang-offload-bundler -type=bc -inputs=%t.bundle3.bc -unbundle -list 2>&1 | FileCheck -check-prefix=CKLST-ERR %s |
| 347 | +// CKLST-ERR: error: -unbundle and -list cannot be used together |
| 348 | +// RUN: not clang-offload-bundler -type=bc -inputs=%t.bundle3.bc -targets=host-%itanium_abi_triple -list 2>&1 | FileCheck -check-prefix=CKLST-ERR2 %s |
| 349 | +// CKLST-ERR2: error: -targets option is invalid for -list |
| 350 | +// RUN: not clang-offload-bundler -type=bc -inputs=%t.bundle3.bc -outputs=out.txt -list 2>&1 | FileCheck -check-prefix=CKLST-ERR3 %s |
| 351 | +// CKLST-ERR3: error: -outputs option is invalid for -list |
| 352 | +// RUN: not clang-offload-bundler -type=bc -inputs=%t.bundle3.bc,%t.bc -list 2>&1 | FileCheck -check-prefix=CKLST-ERR4 %s |
| 353 | +// CKLST-ERR4: error: only one input file supported for -list |
| 354 | + |
| 355 | +// CKLST-DAG: host- |
| 356 | +// CKLST-DAG: openmp-powerpc64le-ibm-linux-gnu |
| 357 | +// CKLST-DAG: openmp-x86_64-pc-linux-gnu |
| 358 | + |
| 359 | +// CKLST2-NOT: host- |
| 360 | +// CKLST2-NOT: openmp-powerpc64le-ibm-linux-gnu |
| 361 | +// CKLST2-NOT: openmp-x86_64-pc-linux-gnu |
321 | 362 |
|
322 | 363 | // Some code so that we can create a binary out of this file.
|
323 | 364 | int A = 0;
|
|
0 commit comments