1 // Check that cvtres properly generates COFF for different machine types. The
2 // only things that changes with machine type are the machine constant listed
3 // in the COFF header, and the relocation types in the relocation tables.
4 // The input was generated with the following command, using the original Windows
6 // > rc /fo test_resource.res /nologo test_resource.rc
7 // The object files we are comparing against were generated with these commands
8 // using the original Windows cvtres.exe.
9 // > cvtres /machine:X86 /readonly /nologo /out:test_resource.obj.coff \
11 // > cvtres /machine:X64 /readonly /nologo /out:test_resource.obj.coff.x64 \
13 // > cvtres /machine:ARM /readonly /nologo /out:test_resource.obj.coff.x64 \
16 RUN: llvm-cvtres /machine:X86 /out:%t %p/Inputs/test_resource.res
17 RUN: llvm-readobj -h -r %t | FileCheck %s -check-prefix=X86
19 RUN: llvm-cvtres /machine:X64 /out:%t %p/Inputs/test_resource.res
20 RUN: llvm-readobj -h -r %t | FileCheck %s -check-prefix=X64
22 RUN: llvm-cvtres /machine:ARM /out:%t %p/Inputs/test_resource.res
23 RUN: llvm-readobj -h -r %t | FileCheck %s -check-prefix=ARM
25 RUN: llvm-cvtres /machine:ARM64 /out:%t %p/Inputs/test_resource.res
26 RUN: llvm-readobj -h -r %t | FileCheck %s -check-prefix=ARM64
28 RUN: llvm-cvtres /machine:ARM64EC /out:%t %p/Inputs/test_resource.res
29 RUN: llvm-readobj -h -r %t | FileCheck %s -check-prefix=ARM64EC
31 RUN: llvm-cvtres /machine:ARM64X /out:%t %p/Inputs/test_resource.res
32 RUN: llvm-readobj -h -r %t | FileCheck %s -check-prefix=ARM64X
34 X86: Machine: IMAGE_FILE_MACHINE_I386 (0x14C)
35 X86-DAG: Relocations [
37 X86-NEXT: 0x1E8 IMAGE_REL_I386_DIR32NB $R000000
38 X86-NEXT: 0x198 IMAGE_REL_I386_DIR32NB $R000001
39 X86-NEXT: 0x1A8 IMAGE_REL_I386_DIR32NB $R000002
40 X86-NEXT: 0x1C8 IMAGE_REL_I386_DIR32NB $R000003
41 X86-NEXT: 0x1D8 IMAGE_REL_I386_DIR32NB $R000004
42 X86-NEXT: 0x1F8 IMAGE_REL_I386_DIR32NB $R000005
43 X86-NEXT: 0x1B8 IMAGE_REL_I386_DIR32NB $R000006
44 X86-NEXT: 0x188 IMAGE_REL_I386_DIR32NB $R000007
46 X64: Machine: IMAGE_FILE_MACHINE_AMD64 (0x8664)
47 X64-DAG: Relocations [
49 X64-NEXT: 0x1E8 IMAGE_REL_AMD64_ADDR32NB $R000000
50 X64-NEXT: 0x198 IMAGE_REL_AMD64_ADDR32NB $R000001
51 X64-NEXT: 0x1A8 IMAGE_REL_AMD64_ADDR32NB $R000002
52 X64-NEXT: 0x1C8 IMAGE_REL_AMD64_ADDR32NB $R000003
53 X64-NEXT: 0x1D8 IMAGE_REL_AMD64_ADDR32NB $R000004
54 X64-NEXT: 0x1F8 IMAGE_REL_AMD64_ADDR32NB $R000005
55 X64-NEXT: 0x1B8 IMAGE_REL_AMD64_ADDR32NB $R000006
56 X64-NEXT: 0x188 IMAGE_REL_AMD64_ADDR32NB $R000007
58 ARM: Machine: IMAGE_FILE_MACHINE_ARMNT (0x1C4)
59 ARM-DAG: Relocations [
61 ARM-NEXT: 0x1E8 IMAGE_REL_ARM_ADDR32NB $R000000
62 ARM-NEXT: 0x198 IMAGE_REL_ARM_ADDR32NB $R000001
63 ARM-NEXT: 0x1A8 IMAGE_REL_ARM_ADDR32NB $R000002
64 ARM-NEXT: 0x1C8 IMAGE_REL_ARM_ADDR32NB $R000003
65 ARM-NEXT: 0x1D8 IMAGE_REL_ARM_ADDR32NB $R000004
66 ARM-NEXT: 0x1F8 IMAGE_REL_ARM_ADDR32NB $R000005
67 ARM-NEXT: 0x1B8 IMAGE_REL_ARM_ADDR32NB $R000006
68 ARM-NEXT: 0x188 IMAGE_REL_ARM_ADDR32NB $R000007
70 ARM64: Machine: IMAGE_FILE_MACHINE_ARM64 (0xAA64)
71 ARM64-DAG: Relocations [
73 ARM64-NEXT: 0x1E8 IMAGE_REL_ARM64_ADDR32NB $R000000
74 ARM64-NEXT: 0x198 IMAGE_REL_ARM64_ADDR32NB $R000001
75 ARM64-NEXT: 0x1A8 IMAGE_REL_ARM64_ADDR32NB $R000002
76 ARM64-NEXT: 0x1C8 IMAGE_REL_ARM64_ADDR32NB $R000003
77 ARM64-NEXT: 0x1D8 IMAGE_REL_ARM64_ADDR32NB $R000004
78 ARM64-NEXT: 0x1F8 IMAGE_REL_ARM64_ADDR32NB $R000005
79 ARM64-NEXT: 0x1B8 IMAGE_REL_ARM64_ADDR32NB $R000006
80 ARM64-NEXT: 0x188 IMAGE_REL_ARM64_ADDR32NB $R000007
82 ARM64EC: Machine: IMAGE_FILE_MACHINE_ARM64EC (0xA641)
83 ARM64EC-DAG: Relocations [
84 ARM64EC-DAG: .rsrc$01 {
85 ARM64EC-NEXT: 0x1E8 IMAGE_REL_ARM64_ADDR32NB $R000000
86 ARM64EC-NEXT: 0x198 IMAGE_REL_ARM64_ADDR32NB $R000001
87 ARM64EC-NEXT: 0x1A8 IMAGE_REL_ARM64_ADDR32NB $R000002
88 ARM64EC-NEXT: 0x1C8 IMAGE_REL_ARM64_ADDR32NB $R000003
89 ARM64EC-NEXT: 0x1D8 IMAGE_REL_ARM64_ADDR32NB $R000004
90 ARM64EC-NEXT: 0x1F8 IMAGE_REL_ARM64_ADDR32NB $R000005
91 ARM64EC-NEXT: 0x1B8 IMAGE_REL_ARM64_ADDR32NB $R000006
92 ARM64EC-NEXT: 0x188 IMAGE_REL_ARM64_ADDR32NB $R000007
94 ARM64X: Machine: IMAGE_FILE_MACHINE_ARM64X (0xA64E)
95 ARM64X-DAG: Relocations [
96 ARM64X-DAG: .rsrc$01 {
97 ARM64X-NEXT: 0x1E8 IMAGE_REL_ARM64_ADDR32NB $R000000
98 ARM64X-NEXT: 0x198 IMAGE_REL_ARM64_ADDR32NB $R000001
99 ARM64X-NEXT: 0x1A8 IMAGE_REL_ARM64_ADDR32NB $R000002
100 ARM64X-NEXT: 0x1C8 IMAGE_REL_ARM64_ADDR32NB $R000003
101 ARM64X-NEXT: 0x1D8 IMAGE_REL_ARM64_ADDR32NB $R000004
102 ARM64X-NEXT: 0x1F8 IMAGE_REL_ARM64_ADDR32NB $R000005
103 ARM64X-NEXT: 0x1B8 IMAGE_REL_ARM64_ADDR32NB $R000006
104 ARM64X-NEXT: 0x188 IMAGE_REL_ARM64_ADDR32NB $R000007