1Prepare inputs:
2
3RUN: rm -rf %t && mkdir -p %t
4RUN: llvm-mc -triple=i386-pc-windows-msvc -filetype=obj -o %t/i386.obj %S/Inputs/a.s
5RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o %t/x86_64.obj %S/Inputs/a.s
6RUN: llvm-as -o %t/i386.bc %S/Inputs/i386.ll
7RUN: llvm-as -o %t/x86_64.bc %S/Inputs/x86_64.ll
8RUN: llvm-as -o %t/arm64.bc %S/Inputs/arm64.ll
9
10
11Mixing bitcode and normal object files with the same machine type is ok:
12
13RUN: llvm-lib %t/i386.obj %t/i386.bc
14RUN: llvm-lib %t/x86_64.obj %t/x86_64.bc
15
16
17As is including resource files:
18
19RUN: llvm-lib /out:%t.lib %S/Inputs/resource.res %t/i386.obj %t/i386.bc
20RUN: llvm-lib /out:%t.lib %t/x86_64.obj %S/Inputs/resource.res %t/x86_64.bc
21
22
23Mixing object files with different machine type is not ok:
24
25RUN: not llvm-lib %t/x86_64.obj %t/i386.obj 2>&1 | \
26RUN:     FileCheck --check-prefix=OBJ32 %s
27OBJ32: i386.obj: file machine type x86 conflicts with library machine type x64 (inferred from earlier file '{{.*}}x86_64.obj')
28
29
30Neither is mixing object and bitcode files with different machine type:
31
32RUN: not llvm-lib %t/x86_64.obj %t/i386.bc 2>&1 | \
33RUN:     FileCheck --check-prefix=BC32 %s
34BC32: i386.bc: file machine type x86 conflicts with library machine type x64 (inferred from earlier file '{{.*}}x86_64.obj')
35
36RUN: not llvm-lib %t/arm64.bc %t/x86_64.bc 2>&1 | \
37RUN:     FileCheck --check-prefix=BC64 %s
38BC64: x86_64.bc: file machine type x64 conflicts with library machine type arm64 (inferred from earlier file '{{.*}}arm64.bc')
39
40
41If /machine: is passed, its value is authoritative.
42
43RUN: not llvm-lib /machine:X86 %t/x86_64.obj %t/i386.obj 2>&1 | \
44RUN:     FileCheck --check-prefix=OBJ64 %s
45OBJ64: x86_64.obj: file machine type x64 conflicts with library machine type x86 (from '/machine:X86' flag)
46