• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5// rc.exe:
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 \
10// 	 test_resource.res
11// > cvtres /machine:X64 /readonly /nologo /out:test_resource.obj.coff.x64 \
12// 	 test_resource.res
13// > cvtres /machine:ARM /readonly /nologo /out:test_resource.obj.coff.x64 \
14// 	 test_resource.res
15
16RUN: llvm-cvtres /machine:X86 /out:%t %p/Inputs/test_resource.res
17RUN: llvm-readobj -h -relocations %t | FileCheck %s -check-prefix=X86
18
19RUN: llvm-cvtres /machine:X64 /out:%t %p/Inputs/test_resource.res
20RUN: llvm-readobj -h -relocations %t | FileCheck %s -check-prefix=X64
21
22RUN: llvm-cvtres /machine:ARM /out:%t %p/Inputs/test_resource.res
23RUN: llvm-readobj -h -relocations %t | FileCheck %s -check-prefix=ARM
24
25RUN: llvm-cvtres /machine:ARM64 /out:%t %p/Inputs/test_resource.res
26RUN: llvm-readobj -h -relocations %t | FileCheck %s -check-prefix=ARM64
27
28X86:         Machine: IMAGE_FILE_MACHINE_I386 (0x14C)
29X86-DAG:   Relocations [
30X86-DAG:                 .rsrc$01 {
31X86-NEXT:      0x1E8 IMAGE_REL_I386_DIR32NB $R000000
32X86-NEXT:      0x198 IMAGE_REL_I386_DIR32NB $R000001
33X86-NEXT:      0x1A8 IMAGE_REL_I386_DIR32NB $R000002
34X86-NEXT:      0x1C8 IMAGE_REL_I386_DIR32NB $R000003
35X86-NEXT:      0x1D8 IMAGE_REL_I386_DIR32NB $R000004
36X86-NEXT:      0x1F8 IMAGE_REL_I386_DIR32NB $R000005
37X86-NEXT:      0x1B8 IMAGE_REL_I386_DIR32NB $R000006
38X86-NEXT:      0x188 IMAGE_REL_I386_DIR32NB $R000007
39
40X64:         Machine: IMAGE_FILE_MACHINE_AMD64 (0x8664)
41X64-DAG:   Relocations [
42X64-DAG:                 .rsrc$01 {
43X64-NEXT:      0x1E8 IMAGE_REL_AMD64_ADDR32NB $R000000
44X64-NEXT:      0x198 IMAGE_REL_AMD64_ADDR32NB $R000001
45X64-NEXT:      0x1A8 IMAGE_REL_AMD64_ADDR32NB $R000002
46X64-NEXT:      0x1C8 IMAGE_REL_AMD64_ADDR32NB $R000003
47X64-NEXT:      0x1D8 IMAGE_REL_AMD64_ADDR32NB $R000004
48X64-NEXT:      0x1F8 IMAGE_REL_AMD64_ADDR32NB $R000005
49X64-NEXT:      0x1B8 IMAGE_REL_AMD64_ADDR32NB $R000006
50X64-NEXT:      0x188 IMAGE_REL_AMD64_ADDR32NB $R000007
51
52ARM:         Machine: IMAGE_FILE_MACHINE_ARMNT (0x1C4)
53ARM-DAG:   Relocations [
54ARM-DAG:                 .rsrc$01 {
55ARM-NEXT:      0x1E8 IMAGE_REL_ARM_ADDR32NB $R000000
56ARM-NEXT:      0x198 IMAGE_REL_ARM_ADDR32NB $R000001
57ARM-NEXT:      0x1A8 IMAGE_REL_ARM_ADDR32NB $R000002
58ARM-NEXT:      0x1C8 IMAGE_REL_ARM_ADDR32NB $R000003
59ARM-NEXT:      0x1D8 IMAGE_REL_ARM_ADDR32NB $R000004
60ARM-NEXT:      0x1F8 IMAGE_REL_ARM_ADDR32NB $R000005
61ARM-NEXT:      0x1B8 IMAGE_REL_ARM_ADDR32NB $R000006
62ARM-NEXT:      0x188 IMAGE_REL_ARM_ADDR32NB $R000007
63
64ARM64:       Machine: IMAGE_FILE_MACHINE_ARM64 (0xAA64)
65ARM64-DAG: Relocations [
66ARM64-DAG:               .rsrc$01 {
67ARM64-NEXT:    0x1E8 IMAGE_REL_ARM64_ADDR32NB $R000000
68ARM64-NEXT:    0x198 IMAGE_REL_ARM64_ADDR32NB $R000001
69ARM64-NEXT:    0x1A8 IMAGE_REL_ARM64_ADDR32NB $R000002
70ARM64-NEXT:    0x1C8 IMAGE_REL_ARM64_ADDR32NB $R000003
71ARM64-NEXT:    0x1D8 IMAGE_REL_ARM64_ADDR32NB $R000004
72ARM64-NEXT:    0x1F8 IMAGE_REL_ARM64_ADDR32NB $R000005
73ARM64-NEXT:    0x1B8 IMAGE_REL_ARM64_ADDR32NB $R000006
74ARM64-NEXT:    0x188 IMAGE_REL_ARM64_ADDR32NB $R000007
75