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 | llvm-readobj -h -s -sr -sd -t | FileCheck %s 5 6.def _main; 7 .scl 2; 8 .type 32; 9 .endef 10 .text 11 .globl _main 12 .align 16, 0x90 13_main: # @main 14# %bb.0: # %entry 15 subl $4, %esp 16 movl $L_.str, (%esp) 17 call _printf 18 xorl %eax, %eax 19 addl $4, %esp 20 ret 21 22 .data 23L_.str: # @.str 24 .asciz "Hello World" 25 26// CHECK: ImageFileHeader { 27// CHECK: Machine: IMAGE_FILE_MACHINE_I386 28// CHECK: SectionCount: 3 29// CHECK: TimeDateStamp: {{[0-9]+}} 30// CHECK: PointerToSymbolTable: 0x{{[0-9A-F]+}} 31// CHECK: SymbolCount: 8 32// CHECK: OptionalHeaderSize: 0 33// CHECK: Characteristics [ (0x0) 34// CHECK: ] 35// CHECK: } 36// CHECK: Sections [ 37// CHECK: Section { 38// CHECK: Number: [[TextNum:[0-9]+]] 39// CHECK: Name: .text 40// CHECK: VirtualSize: 0 41// CHECK: VirtualAddress: 0 42// CHECK: RawDataSize: {{[0-9]+}} 43// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} 44// CHECK: PointerToRelocations: 0x{{[0-9A-F]+}} 45// CHECK: PointerToLineNumbers: 0x0 46// CHECK: RelocationCount: 2 47// CHECK: LineNumberCount: 0 48// CHECK: Characteristics [ (0x60500020) 49// CHECK: IMAGE_SCN_ALIGN_16BYTES 50// CHECK: IMAGE_SCN_CNT_CODE 51// CHECK: IMAGE_SCN_MEM_EXECUTE 52// CHECK: IMAGE_SCN_MEM_READ 53// CHECK: ] 54// CHECK: Relocations [ 55// CHECK: 0x{{[0-9A-F]+}} IMAGE_REL_I386_DIR32 .data 56// CHECK: 0x{{[0-9A-F]+}} IMAGE_REL_I386_REL32 _printf 57// CHECK: ] 58// CHECK: } 59// CHECK: Section { 60// CHECK: Number: [[DataNum:[0-9]+]] 61// CHECK: Name: .data 62// CHECK: VirtualSize: 0 63// CHECK: VirtualAddress: 0 64// CHECK: RawDataSize: {{[0-9]+}} 65// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} 66// CHECK: PointerToRelocations: 0x0 67// CHECK: PointerToLineNumbers: 0x0 68// CHECK: RelocationCount: 0 69// CHECK: LineNumberCount: 0 70// CHECK: Characteristics [ (0xC0300040) 71// CHECK: IMAGE_SCN_ALIGN_4BYTES 72// CHECK: IMAGE_SCN_CNT_INITIALIZED_DATA 73// CHECK: IMAGE_SCN_MEM_READ 74// CHECK: IMAGE_SCN_MEM_WRITE 75// CHECK: ] 76// CHECK: Relocations [ 77// CHECK: ] 78// CHECK: SectionData ( 79// CHECK: 0000: 48656C6C 6F20576F 726C6400 |Hello World.| 80// CHECK: ) 81// CHECK: } 82// CHECK: ] 83// CHECK: Symbols [ 84// CHECK: Symbol { 85// CHECK: Name: .text 86// CHECK: Value: 0 87// CHECK: Section: .text 88// CHECK: BaseType: Null 89// CHECK: ComplexType: Null 90// CHECK: StorageClass: Static 91// CHECK: AuxSymbolCount: 1 92// CHECK: AuxSectionDef { 93// CHECK: Length: 21 94// CHECK: RelocationCount: 2 95// CHECK: LineNumberCount: 0 96// CHECK: Checksum: 0xC6461CBE 97// CHECK: Number: 1 98// CHECK: Selection: 0x0 99// CHECK: } 100// CHECK: } 101// CHECK: Symbol { 102// CHECK: Name: .data 103// CHECK: Value: 0 104// CHECK: Section: .data 105// CHECK: BaseType: Null 106// CHECK: ComplexType: Null 107// CHECK: StorageClass: Static 108// CHECK: AuxSymbolCount: 1 109// CHECK: AuxSectionDef { 110// CHECK: Length: 12 111// CHECK: RelocationCount: 0 112// CHECK: LineNumberCount: 0 113// CHECK: Checksum: 0x2B95CA92 114// CHECK: Number: 2 115// CHECK: Selection: 0x0 116// CHECK: } 117// CHECK: } 118// CHECK: Symbol { 119// CHECK: Name: _main 120// CHECK: Value: 0 121// CHECK: Section: .text 122// CHECK: BaseType: Null 123// CHECK: ComplexType: Function 124// CHECK: StorageClass: External 125// CHECK: AuxSymbolCount: 0 126// CHECK: } 127// CHECK: Symbol { 128// CHECK: Name: _printf 129// CHECK: Value: 0 130// CHECK: Section: IMAGE_SYM_UNDEFINED (0) 131// CHECK: BaseType: Null 132// CHECK: ComplexType: Null 133// CHECK: StorageClass: External 134// CHECK: AuxSymbolCount: 0 135// CHECK: } 136// CHECK: ] 137