1 // This test checks that the COFF object emitter works for the most basic 2 // programs. 3 4 // RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | coff-dump.py | FileCheck %s 5 // I WOULD RUN, BUT THIS FAILS: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s 6 7 .def _main; 8 .scl 2; 9 .type 32; 10 .endef 11 .text 12 .globl _main 13 .align 16, 0x90 14 _main: # @main 15 # BB#0: # %entry 16 subl $4, %esp 17 movl $L_.str, (%esp) 18 calll _printf 19 xorl %eax, %eax 20 addl $4, %esp 21 ret 22 23 .data 24 L_.str: # @.str 25 .asciz "Hello World" 26 27 // CHECK: { 28 // CHECK: MachineType = IMAGE_FILE_MACHINE_I386 (0x14C) 29 // CHECK: NumberOfSections = 2 30 // CHECK: TimeDateStamp = {{[0-9]+}} 31 // CHECK: PointerToSymbolTable = 0x{{[0-9A-F]+}} 32 // CHECK: NumberOfSymbols = 6 33 // CHECK: SizeOfOptionalHeader = 0 34 // CHECK: Characteristics = 0x0 35 // CHECK: Sections = [ 36 // CHECK: 1 = { 37 // CHECK: Name = .text 38 // CHECK: VirtualSize = 0 39 // CHECK: VirtualAddress = 0 40 // CHECK: SizeOfRawData = {{[0-9]+}} 41 // CHECK: PointerToRawData = 0x{{[0-9A-F]+}} 42 // CHECK: PointerToRelocations = 0x{{[0-9A-F]+}} 43 // CHECK: PointerToLineNumbers = 0x0 44 // CHECK: NumberOfRelocations = 2 45 // CHECK: NumberOfLineNumbers = 0 46 // CHECK: Charateristics = 0x60500020 47 // CHECK: IMAGE_SCN_CNT_CODE 48 // CHECK: IMAGE_SCN_ALIGN_16BYTES 49 // CHECK: IMAGE_SCN_MEM_EXECUTE 50 // CHECK: IMAGE_SCN_MEM_READ 51 // CHECK: SectionData = 52 // CHECK: Relocations = [ 53 // CHECK: 0 = { 54 // CHECK: VirtualAddress = 0x{{[0-9A-F]+}} 55 // CHECK: SymbolTableIndex = 2 56 // CHECK: Type = IMAGE_REL_I386_DIR32 (6) 57 // CHECK: SymbolName = .data 58 // CHECK: } 59 // CHECK: 1 = { 60 // CHECK: VirtualAddress = 0x{{[0-9A-F]+}} 61 // CHECK: SymbolTableIndex = 5 62 // CHECK: Type = IMAGE_REL_I386_REL32 (20) 63 // CHECK: SymbolName = _printf 64 // CHECK: } 65 // CHECK: ] 66 // CHECK: } 67 // CHECK: 2 = { 68 // CHECK: Name = .data 69 // CHECK: VirtualSize = 0 70 // CHECK: VirtualAddress = 0 71 // CHECK: SizeOfRawData = {{[0-9]+}} 72 // CHECK: PointerToRawData = 0x{{[0-9A-F]+}} 73 // CHECK: PointerToRelocations = 0x0 74 // CHECK: PointerToLineNumbers = 0x0 75 // CHECK: NumberOfRelocations = 0 76 // CHECK: NumberOfLineNumbers = 0 77 // CHECK: Charateristics = 0xC0300040 78 // CHECK: IMAGE_SCN_CNT_INITIALIZED_DATA 79 // CHECK: IMAGE_SCN_ALIGN_4BYTES 80 // CHECK: IMAGE_SCN_MEM_READ 81 // CHECK: IMAGE_SCN_MEM_WRITE 82 // CHECK: SectionData = 83 // CHECK: 48 65 6C 6C 6F 20 57 6F - 72 6C 64 00 |Hello World.| 84 // CHECK: Relocations = None 85 // CHECK: } 86 // CHECK: ] 87 // CHECK: Symbols = [ 88 // CHECK: 0 = { 89 // CHECK: Name = .text 90 // CHECK: Value = 0 91 // CHECK: SectionNumber = 1 92 // CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) 93 // CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) 94 // CHECK: StorageClass = IMAGE_SYM_CLASS_STATIC (3) 95 // CHECK: NumberOfAuxSymbols = 1 96 // CHECK: AuxillaryData = 97 // CHECK: 15 00 00 00 02 00 00 00 - 00 00 00 00 01 00 00 00 |................| 98 // CHECK: 00 00 |..| 99 // CHECK: } 100 // CHECK: 2 = { 101 // CHECK: Name = .data 102 // CHECK: Value = 0 103 // CHECK: SectionNumber = 2 104 // CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) 105 // CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) 106 // CHECK: StorageClass = IMAGE_SYM_CLASS_STATIC (3) 107 // CHECK: NumberOfAuxSymbols = 1 108 // CHECK: AuxillaryData = 109 // CHECK: 0C 00 00 00 00 00 00 00 - 00 00 00 00 02 00 00 00 |................| 110 // CHECK: 00 00 |..| 111 // CHECK: } 112 // CHECK: 4 = { 113 // CHECK: Name = _main 114 // CHECK: Value = 0 115 // CHECK: SectionNumber = 1 116 // CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) 117 // CHECK: ComplexType = IMAGE_SYM_DTYPE_FUNCTION (2) 118 // CHECK: StorageClass = IMAGE_SYM_CLASS_EXTERNAL (2) 119 // CHECK: NumberOfAuxSymbols = 0 120 // CHECK: AuxillaryData = 121 // CHECK: } 122 // CHECK: 5 = { 123 // CHECK: Name = _printf 124 // CHECK: Value = 0 125 // CHECK: SectionNumber = 0 126 // CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) 127 // CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) 128 // CHECK: StorageClass = IMAGE_SYM_CLASS_EXTERNAL (2) 129 // CHECK: NumberOfAuxSymbols = 0 130 // CHECK: AuxillaryData = 131 // CHECK: } 132 // CHECK: ] 133 // CHECK: } 134