1// RUN: llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o %t.o
2// RUN: llvm-readobj -file-headers -s -sd -r -t -macho-segment -macho-dysymtab -macho-indirect-symbols < %t.o > %t.dump
3// RUN: FileCheck < %t.dump %s
4
5_a:
6L0:
7        .long 1
8L1:
9        .long 2
10        .long _c - _d + 4
11        .long (_c - L0) - (_d - L1) // == (_c - _d) + (L1 - L0)
12                                    // == (_c - _d + 4)
13_c:
14        .long 0
15_d:
16        .long 0
17
18// CHECK: File: <stdin>
19// CHECK: Format: Mach-O 64-bit x86-64
20// CHECK: Arch: x86_64
21// CHECK: AddressSize: 64bit
22// CHECK: MachHeader {
23// CHECK:   Magic: Magic64 (0xFEEDFACF)
24// CHECK:   CpuType: X86-64 (0x1000007)
25// CHECK:   CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)
26// CHECK:   FileType: Relocatable (0x1)
27// CHECK:   NumOfLoadCommands: 4
28// CHECK:   SizeOfLoadCommands: 272
29// CHECK:   Flags [ (0x0)
30// CHECK:   ]
31// CHECK:   Reserved: 0x0
32// CHECK: }
33// CHECK: Sections [
34// CHECK:   Section {
35// CHECK:     Index: 0
36// CHECK:     Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
37// CHECK:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
38// CHECK:     Address: 0x0
39// CHECK:     Size: 0x18
40// CHECK:     Offset: 304
41// CHECK:     Alignment: 0
42// CHECK:     RelocationOffset: 0x148
43// CHECK:     RelocationCount: 4
44// CHECK:     Type: 0x0
45// CHECK:     Attributes [ (0x800000)
46// CHECK:       PureInstructions (0x800000)
47// CHECK:     ]
48// CHECK:     Reserved1: 0x0
49// CHECK:     Reserved2: 0x0
50// CHECK:     Reserved3: 0x0
51// CHECK:     SectionData (
52// CHECK:       0000: 01000000 02000000 04000000 04000000  |................|
53// CHECK:       0010: 00000000 00000000                    |........|
54// CHECK:     )
55// CHECK:   }
56// CHECK: ]
57// CHECK: Relocations [
58// CHECK:   Section __text {
59// CHECK:     0xC 0 2 1 X86_64_RELOC_SUBTRACTOR 0 _d
60// CHECK:     0xC 0 2 1 X86_64_RELOC_UNSIGNED 0 _c
61// CHECK:     0x8 0 2 1 X86_64_RELOC_SUBTRACTOR 0 _d
62// CHECK:     0x8 0 2 1 X86_64_RELOC_UNSIGNED 0 _c
63// CHECK:   }
64// CHECK: ]
65// CHECK: Symbols [
66// CHECK:   Symbol {
67// CHECK:     Name: _a (7)
68// CHECK:     Type: Section (0xE)
69// CHECK:     Section: __text (0x1)
70// CHECK:     RefType: UndefinedNonLazy (0x0)
71// CHECK:     Flags [ (0x0)
72// CHECK:     ]
73// CHECK:     Value: 0x0
74// CHECK:   }
75// CHECK:   Symbol {
76// CHECK:     Name: _c (4)
77// CHECK:     Type: Section (0xE)
78// CHECK:     Section: __text (0x1)
79// CHECK:     RefType: UndefinedNonLazy (0x0)
80// CHECK:     Flags [ (0x0)
81// CHECK:     ]
82// CHECK:     Value: 0x10
83// CHECK:   }
84// CHECK:   Symbol {
85// CHECK:     Name: _d (1)
86// CHECK:     Type: Section (0xE)
87// CHECK:     Section: __text (0x1)
88// CHECK:     RefType: UndefinedNonLazy (0x0)
89// CHECK:     Flags [ (0x0)
90// CHECK:     ]
91// CHECK:     Value: 0x14
92// CHECK:   }
93// CHECK: ]
94// CHECK: Indirect Symbols {
95// CHECK:   Number: 0
96// CHECK:   Symbols [
97// CHECK:   ]
98// CHECK: }
99// CHECK: Segment {
100// CHECK:   Cmd: LC_SEGMENT_64
101// CHECK:   Name:
102// CHECK:   Size: 152
103// CHECK:   vmaddr: 0x0
104// CHECK:   vmsize: 0x18
105// CHECK:   fileoff: 304
106// CHECK:   filesize: 24
107// CHECK:   maxprot: rwx
108// CHECK:   initprot: rwx
109// CHECK:   nsects: 1
110// CHECK:   flags: 0x0
111// CHECK: }
112// CHECK: Dysymtab {
113// CHECK:   ilocalsym: 0
114// CHECK:   nlocalsym: 3
115// CHECK:   iextdefsym: 3
116// CHECK:   nextdefsym: 0
117// CHECK:   iundefsym: 3
118// CHECK:   nundefsym: 0
119// CHECK:   tocoff: 0
120// CHECK:   ntoc: 0
121// CHECK:   modtaboff: 0
122// CHECK:   nmodtab: 0
123// CHECK:   extrefsymoff: 0
124// CHECK:   nextrefsyms: 0
125// CHECK:   indirectsymoff: 0
126// CHECK:   nindirectsyms: 0
127// CHECK:   extreloff: 0
128// CHECK:   nextrel: 0
129// CHECK:   locreloff: 0
130// CHECK:   nlocrel: 0
131// CHECK: }
132