Home | History | Annotate | Download | only in COFF
      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 x86_64-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_.str0, (%esp)
     17 	callq	_printf
     18 	movl	$.L_.str1, (%esp)
     19 	callq	_puts
     20 	movl	$.L_.str2, (%esp)
     21 	callq	_puts
     22 	xorl	%eax, %eax
     23 	addl	$4, %esp
     24 	ret
     25 
     26 	.data
     27 .L_.str0:                                # @.str0
     28 	.asciz	 "Hello "
     29 
     30 .L_.str1:                                # @.str1
     31 	.asciz	 "World!"
     32 
     33 	.align	16                      # @.str2
     34 .L_.str2:
     35 	.asciz	 "I'm The Last Line."
     36 
     37 // CHECK: {
     38 // CHECK:   Machine:                   IMAGE_FILE_MACHINE_AMD64
     39 // CHECK:   SectionCount:              2
     40 // CHECK:   TimeDateStamp:             {{[0-9]+}}
     41 // CHECK:   PointerToSymbolTable:      0x{{[0-9A-F]+}}
     42 // CHECK:   SymbolCount:               7
     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:       0x7  IMAGE_REL_AMD64_ADDR32 .data
     67 // CHECK:       0xC  IMAGE_REL_AMD64_REL32 _printf
     68 // CHECK:       0x14 IMAGE_REL_AMD64_ADDR32 .data
     69 // CHECK:       0x19 IMAGE_REL_AMD64_REL32 _puts
     70 // CHECK:       0x21 IMAGE_REL_AMD64_ADDR32 .data
     71 // CHECK:       0x26 IMAGE_REL_AMD64_REL32 _puts
     72 // CHECK:     ]
     73 // CHECK:     SectionData (
     74 // CHECK:       0000: 83EC0467 C7042400 000000E8 00000000
     75 // CHECK:       0010: 67C70424 07000000 E8000000 0067C704
     76 // CHECK:       0020: 24100000 00E80000 000031C0 83C404C3
     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: 48
    115 // CHECK:       RelocationCount: 6
    116 // CHECK:       LineNumberCount: 0
    117 // CHECK:       Checksum: 0x0
    118 // CHECK:       Number: 1
    119 // CHECK:       Selection: 0x0
    120 // CHECK:       Unused: (00 00 00)
    121 // CHECK:     }
    122 // CHECK:   }
    123 // CHECK:   Symbol {
    124 // CHECK:     Name:                      .data
    125 // CHECK:     Value:                     0
    126 // CHECK:     Section:                   .data
    127 // CHECK:     BaseType:                  Null
    128 // CHECK:     ComplexType:               Null
    129 // CHECK:     StorageClass:              Static
    130 // CHECK:     AuxSymbolCount:            1
    131 // CHECK:     AuxSectionDef {
    132 // CHECK:       Length: 35
    133 // CHECK:       RelocationCount: 0
    134 // CHECK:       LineNumberCount: 0
    135 // CHECK:       Checksum: 0x0
    136 // CHECK:       Number: 2
    137 // CHECK:       Selection: 0x0
    138 // CHECK:       Unused: (00 00 00)
    139 // CHECK:     }
    140 // CHECK:   }
    141 // CHECK:   Symbol {
    142 // CHECK:     Name:                      _main
    143 // CHECK:     Value:                     0
    144 // CHECK:     Section:                   .text
    145 // CHECK:     BaseType:                  Null
    146 // CHECK:     ComplexType:               Function
    147 // CHECK:     StorageClass:              External
    148 // CHECK:     AuxSymbolCount:            0
    149 // CHECK:   }
    150 // CHECK:   Symbol {
    151 // CHECK:     Name:                      _printf
    152 // CHECK:     Value:                     0
    153 // CHECK:     Section:                   (0)
    154 // CHECK:     BaseType:                  Null
    155 // CHECK:     ComplexType:               Null
    156 // CHECK:     StorageClass:              External
    157 // CHECK:     AuxSymbolCount:            0
    158 // CHECK:   }
    159 // CHECK:   Symbol {
    160 // CHECK:     Name:                      _puts
    161 // CHECK:     Value:                     0
    162 // CHECK:     Section:                   (0)
    163 // CHECK:     BaseType:                  Null
    164 // CHECK:     ComplexType:               Null
    165 // CHECK:     StorageClass:              External
    166 // CHECK:     AuxSymbolCount:            0
    167 // CHECK:   }
    168 // CHECK: ]
    169