1// The purpose of this test is to see if the COFF object writer is emitting the 2// proper relocations for multiple pieces of data in a single data fragment. 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_.str0, (%esp) 18 calll _printf 19 movl $L_.str1, (%esp) 20 calll _puts 21 movl $L_.str2, (%esp) 22 calll _puts 23 xorl %eax, %eax 24 addl $4, %esp 25 ret 26 27 .data 28L_.str0: # @.str0 29 .asciz "Hello " 30 31L_.str1: # @.str1 32 .asciz "World!" 33 34 .align 16 # @.str2 35L_.str2: 36 .asciz "I'm The Last Line." 37 38// CHECK: { 39// CHECK: MachineType = IMAGE_FILE_MACHINE_I386 (0x14C) 40// CHECK: NumberOfSections = 2 41// CHECK: TimeDateStamp = {{[0-9]+}} 42// CHECK: PointerToSymbolTable = 0x{{[0-9A-F]+}} 43// CHECK: NumberOfSymbols = 7 44// CHECK: SizeOfOptionalHeader = 0 45// CHECK: Characteristics = 0x0 46// CHECK: Sections = [ 47// CHECK: 1 = { 48// CHECK: Name = .text 49// CHECK: VirtualSize = 0 50// CHECK: VirtualAddress = 0 51// CHECK: SizeOfRawData = {{[0-9]+}} 52// CHECK: PointerToRawData = 0x{{[0-9A-F]+}} 53// CHECK: PointerToRelocations = 0x{{[0-9A-F]+}} 54// CHECK: PointerToLineNumbers = 0x0 55// CHECK: NumberOfRelocations = 6 56// CHECK: NumberOfLineNumbers = 0 57// CHECK: Charateristics = 0x60500020 58// CHECK: IMAGE_SCN_CNT_CODE 59// CHECK: IMAGE_SCN_ALIGN_16BYTES 60// CHECK: IMAGE_SCN_MEM_EXECUTE 61// CHECK: IMAGE_SCN_MEM_READ 62// CHECK: SectionData = 63// CHECK: 83 EC 04 C7 04 24 00 00 - 00 00 E8 00 00 00 00 C7 |.....$..........| 64// CHECK: 04 24 07 00 00 00 E8 00 - 00 00 00 C7 04 24 10 00 |.$...........$..| 65// CHECK: 00 00 E8 00 00 00 00 31 - C0 83 C4 04 C3 |.......1.....| 66// CHECK: Relocations = [ 67// CHECK: 0 = { 68// CHECK: VirtualAddress = 0x6 69// CHECK: SymbolTableIndex = 2 70// CHECK: Type = IMAGE_REL_I386_DIR32 (6) 71// CHECK: SymbolName = .data 72// CHECK: } 73// CHECK: 1 = { 74// CHECK: VirtualAddress = 0xB 75// CHECK: SymbolTableIndex = 5 76// CHECK: Type = IMAGE_REL_I386_REL32 (20) 77// CHECK: SymbolName = _printf 78// CHECK: } 79// CHECK: 2 = { 80// CHECK: VirtualAddress = 0x12 81// CHECK: SymbolTableIndex = 2 82// CHECK: Type = IMAGE_REL_I386_DIR32 (6) 83// CHECK: SymbolName = .data 84// CHECK: } 85// CHECK: 3 = { 86// CHECK: VirtualAddress = 0x17 87// CHECK: SymbolTableIndex = 6 88// CHECK: Type = IMAGE_REL_I386_REL32 (20) 89// CHECK: SymbolName = _puts 90// CHECK: } 91// CHECK: 4 = { 92// CHECK: VirtualAddress = 0x1E 93// CHECK: SymbolTableIndex = 2 94// CHECK: Type = IMAGE_REL_I386_DIR32 (6) 95// CHECK: SymbolName = .data 96// CHECK: } 97// CHECK: 5 = { 98// CHECK: VirtualAddress = 0x23 99// CHECK: SymbolTableIndex = 6 100// CHECK: Type = IMAGE_REL_I386_REL32 (20) 101// CHECK: SymbolName = _puts 102// CHECK: } 103// CHECK: ] 104// CHECK: } 105// CHECK: 2 = { 106// CHECK: Name = .data 107// CHECK: VirtualSize = 0 108// CHECK: VirtualAddress = 0 109// CHECK: SizeOfRawData = {{[0-9]+}} 110// CHECK: PointerToRawData = 0x{{[0-9A-F]+}} 111// CHECK: PointerToRelocations = 0x0 112// CHECK: PointerToLineNumbers = 0x0 113// CHECK: NumberOfRelocations = 0 114// CHECK: NumberOfLineNumbers = 0 115// CHECK: Charateristics = 0xC0500040 116// CHECK: IMAGE_SCN_CNT_INITIALIZED_DATA 117// CHECK: IMAGE_SCN_ALIGN_16BYTES 118// CHECK: IMAGE_SCN_MEM_READ 119// CHECK: IMAGE_SCN_MEM_WRITE 120// CHECK: SectionData = 121// CHECK: 48 65 6C 6C 6F 20 00 57 - 6F 72 6C 64 21 00 00 00 |Hello .World!...| 122// CHECK: 49 27 6D 20 54 68 65 20 - 4C 61 73 74 20 4C 69 6E |I'm The Last Lin| 123// CHECK: 65 2E 00 |e..| 124// CHECK: Relocations = None 125// CHECK: } 126// CHECK: ] 127// CHECK: Symbols = [ 128// CHECK: 0 = { 129// CHECK: Name = .text 130// CHECK: Value = 0 131// CHECK: SectionNumber = 1 132// CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) 133// CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) 134// CHECK: StorageClass = IMAGE_SYM_CLASS_STATIC (3) 135// CHECK: NumberOfAuxSymbols = 1 136// CHECK: AuxillaryData = 137// CHECK: 2D 00 00 00 06 00 00 00 - 00 00 00 00 01 00 00 00 |-...............| 138// CHECK: 00 00 |..| 139 140// CHECK: } 141// CHECK: 2 = { 142// CHECK: Name = .data 143// CHECK: Value = 0 144// CHECK: SectionNumber = 2 145// CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) 146// CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) 147// CHECK: StorageClass = IMAGE_SYM_CLASS_STATIC (3) 148// CHECK: NumberOfAuxSymbols = 1 149// CHECK: AuxillaryData = 150// CHECK: 23 00 00 00 00 00 00 00 - 00 00 00 00 02 00 00 00 |#...............| 151// CHECK: 00 00 |..| 152 153// CHECK: } 154// CHECK: 4 = { 155// CHECK: Name = _main 156// CHECK: Value = 0 157// CHECK: SectionNumber = 1 158// CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) 159// CHECK: ComplexType = IMAGE_SYM_DTYPE_FUNCTION (2) 160// CHECK: StorageClass = IMAGE_SYM_CLASS_EXTERNAL (2) 161// CHECK: NumberOfAuxSymbols = 0 162// CHECK: AuxillaryData = 163 164// CHECK: 5 = { 165// CHECK: Name = _printf 166// CHECK: Value = 0 167// CHECK: SectionNumber = 0 168// CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) 169// CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) 170// CHECK: StorageClass = IMAGE_SYM_CLASS_EXTERNAL (2) 171// CHECK: NumberOfAuxSymbols = 0 172// CHECK: AuxillaryData = 173 174// CHECK: } 175// CHECK: 6 = { 176// CHECK: Name = _puts 177// CHECK: Value = 0 178// CHECK: SectionNumber = 0 179// CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) 180// CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) 181// CHECK: StorageClass = IMAGE_SYM_CLASS_EXTERNAL (2) 182// CHECK: NumberOfAuxSymbols = 0 183// CHECK: AuxillaryData = 184 185// CHECK: } 186// CHECK: ] 187// CHECK: } 188