[MC] Convert all the remaining tests from macho-dump to llvm-readobj.
[oota-llvm.git] / test / MC / MachO / absolute.s
1 // RUN: llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o - | llvm-readobj -file-headers -s -r -t -macho-segment -macho-dysymtab -macho-indirect-symbols | FileCheck %s
2
3 _bar:
4   nop
5 _foo:
6   nop
7
8   .set foo_set1, (_foo + 0xffff0000)
9   .set foo_set2, (_foo - _bar + 0xffff0000)
10
11 foo_equals = (_foo + 0xffff0000)
12 foo_equals2 = (_foo - _bar + 0xffff0000)
13
14   .globl foo_set1_global;
15   .set foo_set1_global, (_foo + 0xffff0000)
16
17   .globl foo_set2_global;
18   .set foo_set2_global, (_foo - _bar + 0xffff0000)
19
20 // CHECK: File: <stdin>
21 // CHECK: Format: Mach-O 64-bit x86-64
22 // CHECK: Arch: x86_64
23 // CHECK: AddressSize: 64bit
24 // CHECK: MachHeader {
25 // CHECK:   Magic: Magic64 (0xFEEDFACF)
26 // CHECK:   CpuType: X86-64 (0x1000007)
27 // CHECK:   CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)
28 // CHECK:   FileType: Relocatable (0x1)
29 // CHECK:   NumOfLoadCommands: 4
30 // CHECK:   SizeOfLoadCommands: 272
31 // CHECK:   Flags [ (0x0)
32 // CHECK:   ]
33 // CHECK:   Reserved: 0x0
34 // CHECK: }
35 // CHECK: Sections [
36 // CHECK:   Section {
37 // CHECK:     Index: 0
38 // CHECK:     Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
39 // CHECK:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
40 // CHECK:     Address: 0x0
41 // CHECK:     Size: 0x2
42 // CHECK:     Offset: 304
43 // CHECK:     Alignment: 0
44 // CHECK:     RelocationOffset: 0x0
45 // CHECK:     RelocationCount: 0
46 // CHECK:     Type: 0x0
47 // CHECK:     Attributes [ (0x800004)
48 // CHECK:       PureInstructions (0x800000)
49 // CHECK:       SomeInstructions (0x4)
50 // CHECK:     ]
51 // CHECK:     Reserved1: 0x0
52 // CHECK:     Reserved2: 0x0
53 // CHECK:     Reserved3: 0x0
54 // CHECK:   }
55 // CHECK: ]
56 // CHECK: Relocations [
57 // CHECK: ]
58 // CHECK: Symbols [
59 // CHECK:   Symbol {
60 // CHECK:     Name: _bar (12)
61 // CHECK:     Type: Section (0xE)
62 // CHECK:     Section: __text (0x1)
63 // CHECK:     RefType: UndefinedNonLazy (0x0)
64 // CHECK:     Flags [ (0x0)
65 // CHECK:     ]
66 // CHECK:     Value: 0x0
67 // CHECK:   }
68 // CHECK:   Symbol {
69 // CHECK:     Name: _foo (17)
70 // CHECK:     Type: Section (0xE)
71 // CHECK:     Section: __text (0x1)
72 // CHECK:     RefType: UndefinedNonLazy (0x0)
73 // CHECK:     Flags [ (0x0)
74 // CHECK:     ]
75 // CHECK:     Value: 0x1
76 // CHECK:   }
77 // CHECK:   Symbol {
78 // CHECK:     Name: foo_set1 (75)
79 // CHECK:     Type: Section (0xE)
80 // CHECK:     Section: __text (0x1)
81 // CHECK:     RefType: UndefinedNonLazy (0x0)
82 // CHECK:     Flags [ (0x20)
83 // CHECK:       NoDeadStrip (0x20)
84 // CHECK:     ]
85 // CHECK:     Value: 0xFFFF0001
86 // CHECK:   }
87 // CHECK:   Symbol {
88 // CHECK:     Name: foo_set2 (54)
89 // CHECK:     Type: Abs (0x2)
90 // CHECK:     Section:  (0x0)
91 // CHECK:     RefType: UndefinedNonLazy (0x0)
92 // CHECK:     Flags [ (0x20)
93 // CHECK:       NoDeadStrip (0x20)
94 // CHECK:     ]
95 // CHECK:     Value: 0xFFFF0001
96 // CHECK:   }
97 // CHECK:   Symbol {
98 // CHECK:     Name: foo_equals (1)
99 // CHECK:     Type: Section (0xE)
100 // CHECK:     Section: __text (0x1)
101 // CHECK:     RefType: UndefinedNonLazy (0x0)
102 // CHECK:     Flags [ (0x0)
103 // CHECK:     ]
104 // CHECK:     Value: 0xFFFF0001
105 // CHECK:   }
106 // CHECK:   Symbol {
107 // CHECK:     Name: foo_equals2 (63)
108 // CHECK:     Type: Abs (0x2)
109 // CHECK:     Section:  (0x0)
110 // CHECK:     RefType: UndefinedNonLazy (0x0)
111 // CHECK:     Flags [ (0x0)
112 // CHECK:     ]
113 // CHECK:     Value: 0xFFFF0001
114 // CHECK:   }
115 // CHECK:   Symbol {
116 // CHECK:     Name: foo_set1_global (38)
117 // CHECK:     Extern
118 // CHECK:     Type: Section (0xE)
119 // CHECK:     Section: __text (0x1)
120 // CHECK:     RefType: UndefinedNonLazy (0x0)
121 // CHECK:     Flags [ (0x20)
122 // CHECK:       NoDeadStrip (0x20)
123 // CHECK:     ]
124 // CHECK:     Value: 0xFFFF0001
125 // CHECK:   }
126 // CHECK:   Symbol {
127 // CHECK:     Name: foo_set2_global (22)
128 // CHECK:     Extern
129 // CHECK:     Type: Abs (0x2)
130 // CHECK:     Section:  (0x0)
131 // CHECK:     RefType: UndefinedNonLazy (0x0)
132 // CHECK:     Flags [ (0x20)
133 // CHECK:       NoDeadStrip (0x20)
134 // CHECK:     ]
135 // CHECK:     Value: 0xFFFF0001
136 // CHECK:   }
137 // CHECK: ]
138 // CHECK: Indirect Symbols {
139 // CHECK:   Number: 0
140 // CHECK:   Symbols [
141 // CHECK:   ]
142 // CHECK: }
143 // CHECK: Segment {
144 // CHECK:   Cmd: LC_SEGMENT_64
145 // CHECK:   Name: 
146 // CHECK:   Size: 152
147 // CHECK:   vmaddr: 0x0
148 // CHECK:   vmsize: 0x2
149 // CHECK:   fileoff: 304
150 // CHECK:   filesize: 2
151 // CHECK:   maxprot: rwx
152 // CHECK:   initprot: rwx
153 // CHECK:   nsects: 1
154 // CHECK:   flags: 0x0
155 // CHECK: }
156 // CHECK: Dysymtab {
157 // CHECK:   ilocalsym: 0
158 // CHECK:   nlocalsym: 6
159 // CHECK:   iextdefsym: 6
160 // CHECK:   nextdefsym: 2
161 // CHECK:   iundefsym: 8
162 // CHECK:   nundefsym: 0
163 // CHECK:   tocoff: 0
164 // CHECK:   ntoc: 0
165 // CHECK:   modtaboff: 0
166 // CHECK:   nmodtab: 0
167 // CHECK:   extrefsymoff: 0
168 // CHECK:   nextrefsyms: 0
169 // CHECK:   indirectsymoff: 0
170 // CHECK:   nindirectsyms: 0
171 // CHECK:   extreloff: 0
172 // CHECK:   nextrel: 0
173 // CHECK:   locreloff: 0
174 // CHECK:   nlocrel: 0
175 // CHECK: }