|
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/checked.
|
|
57 | 58 | //
|
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,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR1
|
59 | 60 | // CK-ERR1: error: only one input file supported in unbundling mode
|
60 |
| -// CK-ERR1: error: number of output files and targets should match in unbundling mode |
| 61 | + |
| 62 | +// 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 |
| 63 | +// CK-ERR1A: error: number of output files and targets should match in unbundling mode |
61 | 64 |
|
62 | 65 | // 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
|
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 -inputs=%t.i,%t.tgt1 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR2
|
64 | 67 | // CK-ERR2: error: number of input files and targets should match in bundling mode
|
65 | 68 |
|
66 | 69 | // 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
|
67 | 70 | // CK-ERR3: error: only one output file supported in bundling mode
|
68 |
| -// CK-ERR3: error: number of input files and targets should match in bundling mode |
69 | 71 |
|
70 | 72 | // 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
|
71 | 73 | // 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
|
|
79 | 81 | // CK-ERR6: error: '[[TYPE]]': invalid file type specified
|
80 | 82 |
|
81 | 83 | // RUN: not clang-offload-bundler 2>&1 | FileCheck %s --check-prefix CK-ERR7
|
82 |
| -// CK-ERR7-DAG: clang-offload-bundler: for the --type option: must be specified at least once! |
83 |
| -// CK-ERR7-DAG: clang-offload-bundler: for the --inputs option: must be specified at least once! |
84 |
| -// CK-ERR7-DAG: clang-offload-bundler: for the --targets option: must be specified at least once! |
| 84 | +// CK-ERR7: clang-offload-bundler: for the --type option: must be specified at least once! |
| 85 | + |
| 86 | +// RUN: not clang-offload-bundler -type=i -inputs=%t.i,%t.tgt1,%t.tgt2 2>&1 | FileCheck %s -check-prefix=CK-ERR7A |
| 87 | +// CK-ERR7A: error: for the --outputs option: must be specified at least once! |
| 88 | + |
| 89 | +// 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 |
| 90 | +// CK-ERR7B: error: for the --targets option: must be specified at least once! |
85 | 91 |
|
86 | 92 | // 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
|
87 | 93 | // CK-ERR8: error: invalid target 'hxst-powerpcxxle-ibm-linux-gnu', unknown offloading kind 'hxst', unknown target triple 'powerpcxxle-ibm-linux-gnu'
|
88 |
| -// CK-ERR8: error: invalid target 'openxp-pxxerpc64le-ibm-linux-gnu', unknown offloading kind 'openxp', unknown target triple 'pxxerpc64le-ibm-linux-gnu' |
89 |
| -// CK-ERR8: error: invalid target 'xpenmp-x86_xx-pc-linux-gnu', unknown offloading kind 'xpenmp', unknown target triple 'x86_xx-pc-linux-gnu' |
| 94 | + |
| 95 | +// 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 |
| 96 | +// CK-ERR8A: error: invalid target 'openxp-pxxerpc64le-ibm-linux-gnu', unknown offloading kind 'openxp', unknown target triple 'pxxerpc64le-ibm-linux-gnu' |
| 97 | + |
| 98 | +// 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 |
| 99 | +// CK-ERR8B: error: invalid target 'xpenmp-x86_xx-pc-linux-gnu', unknown offloading kind 'xpenmp', unknown target triple 'x86_xx-pc-linux-gnu' |
90 | 100 |
|
91 | 101 | // 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
|
92 |
| -// 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 |
93 | 102 | // CK-ERR9A: error: expecting exactly one host target but got 0
|
| 103 | + |
| 104 | +// 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 |
94 | 105 | // CK-ERR9B: error: Duplicate targets are not allowed
|
95 | 106 |
|
96 | 107 | // 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 -check-section 2>&1 | FileCheck %s --check-prefix CK-ERR10
|
|
166 | 177 | //
|
167 | 178 | // Check text unbundle. Check if we get the exact same content that we bundled before for each file.
|
168 | 179 | //
|
| 180 | +// RUN: clang-offload-bundler -type=i -inputs=%t.bundle3.i -list | FileCheck -check-prefix=CKLST %s |
169 | 181 | // 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
|
170 | 182 | // RUN: diff %t.i %t.res.i
|
171 | 183 | // RUN: diff %t.tgt1 %t.res.tgt1
|
172 | 184 | // RUN: diff %t.tgt2 %t.res.tgt2
|
173 | 185 | // RUN: clang-offload-bundler -type=i -targets=openmp-powerpc64le-ibm-linux-gnu -outputs=%t.res.tgt1 -inputs=%t.bundle3.i -unbundle
|
174 | 186 | // RUN: diff %t.tgt1 %t.res.tgt1
|
| 187 | +// RUN: clang-offload-bundler -type=ii -inputs=%t.bundle3.ii -list | FileCheck -check-prefix=CKLST %s |
175 | 188 | // 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
|
176 | 189 | // RUN: diff %t.ii %t.res.ii
|
177 | 190 | // RUN: diff %t.tgt1 %t.res.tgt1
|
178 | 191 | // RUN: diff %t.tgt2 %t.res.tgt2
|
179 | 192 | // RUN: clang-offload-bundler -type=ii -targets=openmp-x86_64-pc-linux-gnu -outputs=%t.res.tgt2 -inputs=%t.bundle3.ii -unbundle
|
180 | 193 | // RUN: diff %t.tgt2 %t.res.tgt2
|
| 194 | +// RUN: clang-offload-bundler -type=ll -inputs=%t.bundle3.ll -list | FileCheck -check-prefix=CKLST %s |
181 | 195 | // 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
|
182 | 196 | // RUN: diff %t.ll %t.res.ll
|
183 | 197 | // RUN: diff %t.tgt1 %t.res.tgt1
|
184 | 198 | // RUN: diff %t.tgt2 %t.res.tgt2
|
185 | 199 | // RUN: clang-offload-bundler -type=ll -targets=openmp-powerpc64le-ibm-linux-gnu -outputs=%t.res.tgt1 -inputs=%t.bundle3.ll -unbundle
|
186 | 200 | // RUN: diff %t.tgt1 %t.res.tgt1
|
| 201 | +// RUN: clang-offload-bundler -type=s -inputs=%t.bundle3.s -list | FileCheck -check-prefix=CKLST %s |
187 | 202 | // 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
|
188 | 203 | // RUN: diff %t.s %t.res.s
|
189 | 204 | // RUN: diff %t.tgt1 %t.res.tgt1
|
|
196 | 211 | // RUN: diff %t.tgt2 %t.res.tgt2
|
197 | 212 |
|
198 | 213 | // Check if we can unbundle a file with no magic strings.
|
| 214 | +// RUN: clang-offload-bundler -type=s -inputs=%t.s -list | FileCheck -check-prefix=CKLST2 --allow-empty %s |
199 | 215 | // 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
|
200 | 216 | // RUN: diff %t.s %t.res.s
|
201 | 217 | // RUN: diff %t.empty %t.res.tgt1
|
|
216 | 232 | // 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
|
217 | 233 | // 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
|
218 | 234 | // 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
|
| 235 | +// RUN: clang-offload-bundler -type=bc -inputs=%t.bundle3.bc -list | FileCheck -check-prefix=CKLST %s |
219 | 236 | // 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
|
220 | 237 | // RUN: diff %t.bc %t.res.bc
|
221 | 238 | // RUN: diff %t.tgt1 %t.res.tgt1
|
222 | 239 | // RUN: diff %t.tgt2 %t.res.tgt2
|
223 | 240 | // RUN: clang-offload-bundler -type=bc -targets=openmp-powerpc64le-ibm-linux-gnu -outputs=%t.res.tgt1 -inputs=%t.bundle3.bc -unbundle
|
224 | 241 | // RUN: diff %t.tgt1 %t.res.tgt1
|
| 242 | +// RUN: clang-offload-bundler -type=gch -inputs=%t.bundle3.gch -list | FileCheck -check-prefix=CKLST %s |
225 | 243 | // 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
|
226 | 244 | // RUN: diff %t.ast %t.res.gch
|
227 | 245 | // RUN: diff %t.tgt1 %t.res.tgt1
|
228 | 246 | // RUN: diff %t.tgt2 %t.res.tgt2
|
229 | 247 | // RUN: clang-offload-bundler -type=gch -targets=openmp-x86_64-pc-linux-gnu -outputs=%t.res.tgt2 -inputs=%t.bundle3.gch -unbundle
|
230 | 248 | // RUN: diff %t.tgt2 %t.res.tgt2
|
| 249 | +// RUN: clang-offload-bundler -type=ast -inputs=%t.bundle3.ast -list | FileCheck -check-prefix=CKLST %s |
231 | 250 | // 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
|
232 | 251 | // RUN: diff %t.ast %t.res.ast
|
233 | 252 | // RUN: diff %t.tgt1 %t.res.tgt1
|
|
272 | 291 | // 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]]"
|
273 | 292 |
|
274 | 293 | // 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
|
| 294 | +// RUN: clang-offload-bundler -type=o -inputs=%t.bundle3.o -list | FileCheck -check-prefix=CKLST %s |
275 | 295 | // 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
|
276 | 296 | // RUN: diff %t.bundle3.o %t.res.o
|
277 | 297 | // RUN: diff %t.tgt1 %t.res.tgt1
|
|
284 | 304 | // RUN: diff %t.tgt1 %t.res.tgt1
|
285 | 305 |
|
286 | 306 | // Check if we can unbundle a file with no magic strings.
|
| 307 | +// RUN: clang-offload-bundler -type=o -inputs=%t.o -list | FileCheck -check-prefix=CKLST2 --allow-empty %s |
287 | 308 | // 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
|
288 | 309 | // RUN: diff %t.o %t.res.o
|
289 | 310 | // RUN: diff %t.empty %t.res.tgt1
|
|
383 | 404 | // RUN: -targets=hip-amdgcn-amd-amdhsa-gfx906,hip-amdgcn-amd-amdhsa-gfx906 \
|
384 | 405 | // RUN: 2>&1 | FileCheck -check-prefix=DUP %s
|
385 | 406 | // DUP: error: Duplicate targets are not allowed
|
| 407 | +// |
| 408 | +// Check -list option |
| 409 | +// |
| 410 | + |
| 411 | +// 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 |
| 412 | +// RUN: not clang-offload-bundler -type=bc -inputs=%t.bundle3.bc -unbundle -list 2>&1 | FileCheck -check-prefix=CKLST-ERR %s |
| 413 | +// CKLST-ERR: error: -unbundle and -list cannot be used together |
| 414 | +// 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 |
| 415 | +// CKLST-ERR2: error: -targets option is invalid for -list |
| 416 | +// RUN: not clang-offload-bundler -type=bc -inputs=%t.bundle3.bc -outputs=out.txt -list 2>&1 | FileCheck -check-prefix=CKLST-ERR3 %s |
| 417 | +// CKLST-ERR3: error: -outputs option is invalid for -list |
| 418 | +// RUN: not clang-offload-bundler -type=bc -inputs=%t.bundle3.bc,%t.bc -list 2>&1 | FileCheck -check-prefix=CKLST-ERR4 %s |
| 419 | +// CKLST-ERR4: error: only one input file supported for -list |
| 420 | + |
| 421 | +// CKLST-DAG: host- |
| 422 | +// CKLST-DAG: openmp-powerpc64le-ibm-linux-gnu |
| 423 | +// CKLST-DAG: openmp-x86_64-pc-linux-gnu |
| 424 | + |
| 425 | +// CKLST2-NOT: host- |
| 426 | +// CKLST2-NOT: openmp-powerpc64le-ibm-linux-gnu |
| 427 | +// CKLST2-NOT: openmp-x86_64-pc-linux-gnu |
386 | 428 |
|
387 | 429 | // Some code so that we can create a binary out of this file.
|
388 | 430 | int A = 0;
|
|
0 commit comments