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 | llvm-readobj -h -S --sr --sd --symbols - | 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_.str0, (%esp) 17 calll _printf 18 movl $L_.str1, (%esp) 19 calll _puts 20 movl $L_.str2, (%esp) 21 calll _puts 22 xorl %eax, %eax 23 addl $4, %esp 24 ret 25 26 .data 27L_.str0: # @.str0 28 .asciz "Hello " 29 30L_.str1: # @.str1 31 .asciz "World!" 32 33 .align 16 # @.str2 34L_.str2: 35 .asciz "I'm The Last Line." 36 37// CHECK: { 38// CHECK: Machine: IMAGE_FILE_MACHINE_I386 (0x14C) 39// CHECK: SectionCount: 3 40// CHECK: TimeDateStamp: {{[0-9]+}} 41// CHECK: PointerToSymbolTable: 0x{{[0-9A-F]+}} 42// CHECK: SymbolCount: 9 43// CHECK: OptionalHeaderSize: 0 44// CHECK: Characteristics [ (0x0) 45// CHECK: ] 46// CHECK: } 47// CHECK: Sections [ 48// CHECK: Section { 49// CHECK: Number: 1 50// CHECK: Name: .text 51// CHECK: VirtualSize: 0 52// CHECK: VirtualAddress: 0 53// CHECK: RawDataSize: {{[0-9]+}} 54// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} 55// CHECK: PointerToRelocations: 0x{{[0-9A-F]+}} 56// CHECK: PointerToLineNumbers: 0x0 57// CHECK: RelocationCount: 6 58// CHECK: LineNumberCount: 0 59// CHECK: Characteristics [ (0x60500020) 60// CHECK: IMAGE_SCN_ALIGN_16BYTES 61// CHECK: IMAGE_SCN_CNT_CODE 62// CHECK: IMAGE_SCN_MEM_EXECUTE 63// CHECK: IMAGE_SCN_MEM_READ 64// CHECK: ] 65// CHECK: Relocations [ 66// CHECK: 0x6 IMAGE_REL_I386_DIR32 .data 67// CHECK: 0xB IMAGE_REL_I386_REL32 _printf 68// CHECK: 0x12 IMAGE_REL_I386_DIR32 .data 69// CHECK: 0x17 IMAGE_REL_I386_REL32 _puts 70// CHECK: 0x1E IMAGE_REL_I386_DIR32 .data 71// CHECK: 0x23 IMAGE_REL_I386_REL32 _puts 72// CHECK: ] 73// CHECK: SectionData ( 74// CHECK: 0000: 83EC04C7 04240000 0000E800 000000C7 |.....$..........| 75// CHECK: 0010: 04240700 0000E800 000000C7 04241000 |.$...........$..| 76// CHECK: 0020: 0000E800 00000031 C083C404 C3 |.......1.....| 77// CHECK: ) 78// CHECK: } 79// CHECK: Section { 80// CHECK: Number: 2 81// CHECK: Name: .data 82// CHECK: VirtualSize: 0 83// CHECK: VirtualAddress: 0 84// CHECK: RawDataSize: {{[0-9]+}} 85// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} 86// CHECK: PointerToRelocations: 0x0 87// CHECK: PointerToLineNumbers: 0x0 88// CHECK: RelocationCount: 0 89// CHECK: LineNumberCount: 0 90// CHECK: Characteristics [ (0xC0500040) 91// CHECK: IMAGE_SCN_ALIGN_16BYTES 92// CHECK: IMAGE_SCN_CNT_INITIALIZED_DATA 93// CHECK: IMAGE_SCN_MEM_READ 94// CHECK: IMAGE_SCN_MEM_WRITE 95// CHECK: Relocations [ 96// CHECK: ] 97// CHECK: SectionData ( 98// CHECK: 0000: 48656C6C 6F200057 6F726C64 21000000 |Hello .World!...| 99// CHECK: 0010: 49276D20 54686520 4C617374 204C696E |I'm The Last Lin| 100// CHECK: 0020: 652E00 |e..| 101// CHECK: ) 102// CHECK: } 103// CHECK: ] 104// CHECK: Symbols [ 105// CHECK: Symbol { 106// CHECK: Name: .text 107// CHECK: Value: 0 108// CHECK: Section: .text 109// CHECK: BaseType: Null 110// CHECK: ComplexType: Null 111// CHECK: StorageClass: Static 112// CHECK: AuxSymbolCount: 1 113// CHECK: AuxSectionDef { 114// CHECK: Length: 45 115// CHECK: RelocationCount: 6 116// CHECK: LineNumberCount: 0 117// CHECK: Checksum: 0xDED1DC2 118// CHECK: Number: 1 119// CHECK: Selection: 0x0 120// CHECK: } 121// CHECK: } 122// CHECK: Symbol { 123// CHECK: Name: .data 124// CHECK: Value: 0 125// CHECK: Section: .data 126// CHECK: BaseType: Null 127// CHECK: ComplexType: Null 128// CHECK: StorageClass: Static 129// CHECK: AuxSymbolCount: 1 130// CHECK: AuxSectionDef { 131// CHECK: Length: 35 132// CHECK: RelocationCount: 0 133// CHECK: LineNumberCount: 0 134// CHECK: Checksum: 0xB0A4C21 135// CHECK: Number: 2 136// CHECK: Selection: 0x0 137// CHECK: } 138// CHECK: } 139// CHECK: Symbol { 140// CHECK: Name: _main 141// CHECK: Value: 0 142// CHECK: Section: .text 143// CHECK: BaseType: Null 144// CHECK: ComplexType: Function 145// CHECK: StorageClass: External 146// CHECK: AuxSymbolCount: 0 147// CHECK: } 148// CHECK: Symbol { 149// CHECK: Name: _printf 150// CHECK: Value: 0 151// CHECK: Section: IMAGE_SYM_UNDEFINED (0) 152// CHECK: BaseType: Null 153// CHECK: ComplexType: Null 154// CHECK: StorageClass: External 155// CHECK: AuxSymbolCount: 0 156// CHECK: } 157// CHECK: Symbol { 158// CHECK: Name: _puts 159// CHECK: Value: 0 160// CHECK: Section: IMAGE_SYM_UNDEFINED (0) 161// CHECK: BaseType: Null 162// CHECK: ComplexType: Null 163// CHECK: StorageClass: External 164// CHECK: AuxSymbolCount: 0 165// CHECK: } 166// CHECK: ] 167