Home | History | Annotate | Download | only in MachO
      1 // RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | llvm-readobj -file-headers -s -sd -r -t -macho-segment -macho-dysymtab -macho-indirect-symbols | FileCheck %s
      2 
      3 _text_a:
      4         xorl %eax,%eax
      5 _text_b:
      6         xorl %eax,%eax
      7 Ltext_c:
      8         xorl %eax,%eax
      9 Ltext_d:
     10         xorl %eax,%eax
     11 
     12         movl $(_text_a - _text_b), %eax
     13 Ltext_expr_0 = _text_a - _text_b
     14         movl $(Ltext_expr_0), %eax
     15 
     16         movl $(Ltext_c - _text_b), %eax
     17 Ltext_expr_1 = Ltext_c - _text_b
     18         movl $(Ltext_expr_1), %eax
     19 
     20         movl $(Ltext_d - Ltext_c), %eax
     21 Ltext_expr_2 = Ltext_d - Ltext_c
     22         movl $(Ltext_expr_2), %eax
     23 
     24         movl $(_text_a + Ltext_expr_0), %eax
     25 
     26         .data
     27 _data_a:
     28         .long 0
     29 _data_b:
     30         .long 0
     31 Ldata_c:
     32         .long 0
     33 Ldata_d:
     34         .long 0
     35 
     36         .long _data_a - _data_b
     37 Ldata_expr_0 = _data_a - _data_b
     38         .long Ldata_expr_0
     39 
     40         .long Ldata_c - _data_b
     41 Ldata_expr_1 = Ldata_c - _data_b
     42         .long Ldata_expr_1
     43 
     44         .long Ldata_d - Ldata_c
     45 Ldata_expr_2 = Ldata_d - Ldata_c
     46         .long Ldata_expr_2
     47 
     48         .long _data_a + Ldata_expr_0
     49 
     50 // CHECK: File: <stdin>
     51 // CHECK: Format: Mach-O 32-bit i386
     52 // CHECK: Arch: i386
     53 // CHECK: AddressSize: 32bit
     54 // CHECK: MachHeader {
     55 // CHECK:   Magic: Magic (0xFEEDFACE)
     56 // CHECK:   CpuType: X86 (0x7)
     57 // CHECK:   CpuSubType: CPU_SUBTYPE_I386_ALL (0x3)
     58 // CHECK:   FileType: Relocatable (0x1)
     59 // CHECK:   NumOfLoadCommands: 4
     60 // CHECK:   SizeOfLoadCommands: 312
     61 // CHECK:   Flags [ (0x0)
     62 // CHECK:   ]
     63 // CHECK: }
     64 // CHECK: Sections [
     65 // CHECK:   Section {
     66 // CHECK:     Index: 0
     67 // CHECK:     Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
     68 // CHECK:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
     69 // CHECK:     Address: 0x0
     70 // CHECK:     Size: 0x2B
     71 // CHECK:     Offset: 340
     72 // CHECK:     Alignment: 0
     73 // CHECK:     RelocationOffset: 0x1AC
     74 // CHECK:     RelocationCount: 3
     75 // CHECK:     Type: 0x0
     76 // CHECK:     Attributes [ (0x800004)
     77 // CHECK:       PureInstructions (0x800000)
     78 // CHECK:       SomeInstructions (0x4)
     79 // CHECK:     ]
     80 // CHECK:     Reserved1: 0x0
     81 // CHECK:     Reserved2: 0x0
     82 // CHECK:     SectionData (
     83 // CHECK:       0000: 31C031C0 31C031C0 B8FEFFFF FFB8FEFF  |1.1.1.1.........|
     84 // CHECK:       0010: FFFFB802 000000B8 02000000 B8020000  |................|
     85 // CHECK:       0020: 00B80200 0000B8FE FFFFFF             |...........|
     86 // CHECK:     )
     87 // CHECK:   }
     88 // CHECK:   Section {
     89 // CHECK:     Index: 1
     90 // CHECK:     Name: __data (5F 5F 64 61 74 61 00 00 00 00 00 00 00 00 00 00)
     91 // CHECK:     Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)
     92 // CHECK:     Address: 0x2B
     93 // CHECK:     Size: 0x2C
     94 // CHECK:     Offset: 383
     95 // CHECK:     Alignment: 0
     96 // CHECK:     RelocationOffset: 0x1C4
     97 // CHECK:     RelocationCount: 3
     98 // CHECK:     Type: 0x0
     99 // CHECK:     Attributes [ (0x0)
    100 // CHECK:     ]
    101 // CHECK:     Reserved1: 0x0
    102 // CHECK:     Reserved2: 0x0
    103 // CHECK:     SectionData (
    104 // CHECK:       0000: 00000000 00000000 00000000 00000000  |................|
    105 // CHECK:       0010: FCFFFFFF FCFFFFFF 04000000 04000000  |................|
    106 // CHECK:       0020: 04000000 04000000 27000000           |........'...|
    107 // CHECK:     )
    108 // CHECK:   }
    109 // CHECK: ]
    110 // CHECK: Relocations [
    111 // CHECK:   Section __text {
    112 // CHECK:     0x27 0 2 n/a GENERIC_RELOC_VANILLA 1 0x0
    113 // CHECK:     0x9 0 2 n/a GENERIC_RELOC_LOCAL_SECTDIFF 1 0x0
    114 // CHECK:     0x0 0 2 n/a GENERIC_RELOC_PAIR 1 0x2
    115 // CHECK:   }
    116 // CHECK:   Section __data {
    117 // CHECK:     0x28 0 2 n/a GENERIC_RELOC_VANILLA 1 0x2B
    118 // CHECK:     0x10 0 2 n/a GENERIC_RELOC_LOCAL_SECTDIFF 1 0x2B
    119 // CHECK:     0x0 0 2 n/a GENERIC_RELOC_PAIR 1 0x2F
    120 // CHECK:   }
    121 // CHECK: ]
    122 // CHECK: Symbols [
    123 // CHECK:   Symbol {
    124 // CHECK:     Name: _text_a (17)
    125 // CHECK:     Type: Section (0xE)
    126 // CHECK:     Section: __text (0x1)
    127 // CHECK:     RefType: UndefinedNonLazy (0x0)
    128 // CHECK:     Flags [ (0x0)
    129 // CHECK:     ]
    130 // CHECK:     Value: 0x0
    131 // CHECK:   }
    132 // CHECK:   Symbol {
    133 // CHECK:     Name: _text_b (1)
    134 // CHECK:     Type: Section (0xE)
    135 // CHECK:     Section: __text (0x1)
    136 // CHECK:     RefType: UndefinedNonLazy (0x0)
    137 // CHECK:     Flags [ (0x0)
    138 // CHECK:     ]
    139 // CHECK:     Value: 0x2
    140 // CHECK:   }
    141 // CHECK:   Symbol {
    142 // CHECK:     Name: _data_a (25)
    143 // CHECK:     Type: Section (0xE)
    144 // CHECK:     Section: __data (0x2)
    145 // CHECK:     RefType: UndefinedNonLazy (0x0)
    146 // CHECK:     Flags [ (0x0)
    147 // CHECK:     ]
    148 // CHECK:     Value: 0x2B
    149 // CHECK:   }
    150 // CHECK:   Symbol {
    151 // CHECK:     Name: _data_b (9)
    152 // CHECK:     Type: Section (0xE)
    153 // CHECK:     Section: __data (0x2)
    154 // CHECK:     RefType: UndefinedNonLazy (0x0)
    155 // CHECK:     Flags [ (0x0)
    156 // CHECK:     ]
    157 // CHECK:     Value: 0x2F
    158 // CHECK:   }
    159 // CHECK: ]
    160 // CHECK: Indirect Symbols {
    161 // CHECK:   Number: 0
    162 // CHECK:   Symbols [
    163 // CHECK:   ]
    164 // CHECK: }
    165 // CHECK: Segment {
    166 // CHECK:   Cmd: LC_SEGMENT
    167 // CHECK:   Name:
    168 // CHECK:   Size: 192
    169 // CHECK:   vmaddr: 0x0
    170 // CHECK:   vmsize: 0x57
    171 // CHECK:   fileoff: 340
    172 // CHECK:   filesize: 87
    173 // CHECK:   maxprot: rwx
    174 // CHECK:   initprot: rwx
    175 // CHECK:   nsects: 2
    176 // CHECK:   flags: 0x0
    177 // CHECK: }
    178 // CHECK: Dysymtab {
    179 // CHECK:   ilocalsym: 0
    180 // CHECK:   nlocalsym: 4
    181 // CHECK:   iextdefsym: 4
    182 // CHECK:   nextdefsym: 0
    183 // CHECK:   iundefsym: 4
    184 // CHECK:   nundefsym: 0
    185 // CHECK:   tocoff: 0
    186 // CHECK:   ntoc: 0
    187 // CHECK:   modtaboff: 0
    188 // CHECK:   nmodtab: 0
    189 // CHECK:   extrefsymoff: 0
    190 // CHECK:   nextrefsyms: 0
    191 // CHECK:   indirectsymoff: 0
    192 // CHECK:   nindirectsyms: 0
    193 // CHECK:   extreloff: 0
    194 // CHECK:   nextrel: 0
    195 // CHECK:   locreloff: 0
    196 // CHECK:   nlocrel: 0
    197 // CHECK: }
    198