1 // RUN
: llvm-mc
-triple x86_64-apple-darwin10
%s
-filetype
=obj
-o
- | macho-dump
--dump-section-data | FileCheck
%s
5 // FIXME
: llvm-mc doesn
't handle this in a way we can make compatible with 'as
',
6 // currently, because of how we handle assembler variables.
8 // See <rdar://problem/7763719> improve handling of absolute symbols
20 // FIXME: Darwin 'as
' for historical reasons widens this jump, but doesn't emit
21 // a relocation. It seems like
'as' widens any jump that is
not to
a temporary
,
22 // which is inherited from the x86_32 behavior
, even though x86_64 could do
29 // FIXME
: Darwin
'as' gets this wrong as well
, even though it could get it right
30 // given the other things we do on x86_64. It is using
a short jump here. This
31 // is probably fallout of the hack that exists for x86_32.
34 // FIXME
: We don
't support this, and would currently get it wrong, it should be a jump to an absolute address.
38 // FIXME: Darwin 'as
' comes up with 'SIGNED
' here instead of 'BRANCH
'.
40 // FIXME: Darwin 'as
' gets this completely wrong. It ends up with a single
41 // branch relocation. Fallout from the other delta hack?
48 // FIXME: Darwin 'as
' gets this completely wrong. It ends up with a single
49 // branch relocation. Fallout from the other delta hack?
52 // FIXME: Darwin 'as
' comes up with 'SIGNED
' here instead of 'BRANCH
'.
54 // FIXME: Darwin 'as
' gets this completely wrong. It ends up with a single
55 // branch relocation. Fallout from the other delta hack?
59 // movl %eax,_baz(%rip)
65 // FIXME: Darwin 'as
' gets most of these wrong, and there is an ambiguity in ATT
66 // syntax in what they should mean in the first place (absolute or
67 // rip-relative address).
68 // movl %eax,L0 - _g0(%rip)
69 // movl %eax,_g1 - _g0(%rip)
70 // movl %eax,_g1 - L1(%rip)
71 // movl %eax,L1 - _g0(%rip)
78 // FIXME: Darwin 'as
' gets most of these wrong, and there is an ambiguity in ATT
79 // syntax in what they should mean in the first place (absolute or
80 // rip-relative address).
81 // movl %eax,L2 - _g2(%rip)
82 // movl %eax,_g3 - _g2(%rip)
83 // movl %eax,_g3 - L3(%rip)
84 // movl %eax,L3 - _g2(%rip)
120 // CHECK: ('cputype
', 16777223)
121 // CHECK: ('cpusubtype
', 3)
122 // CHECK: ('filetype
', 1)
123 // CHECK: ('num_load_commands
', 3)
124 // CHECK: ('load_commands_size
', 336)
125 // CHECK: ('flag
', 0)
126 // CHECK: ('reserved
', 0)
127 // CHECK: ('load_commands
', [
128 // CHECK: # Load Command 0
129 // CHECK: (('command
', 25)
130 // CHECK: ('size
', 232)
131 // CHECK: ('segment_name
', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
132 // CHECK: ('vm_addr
', 0)
133 // CHECK: ('vm_size
', 236)
134 // CHECK: ('file_offset
', 368)
135 // CHECK: ('file_size
', 236)
136 // CHECK: ('maxprot
', 7)
137 // CHECK: ('initprot
', 7)
138 // CHECK: ('num_sections
', 2)
139 // CHECK: ('flags
', 0)
140 // CHECK: ('sections
', [
141 // CHECK: # Section 0
142 // CHECK: (('section_name
', '__text
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
143 // CHECK: ('segment_name
', '__TEXT
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
144 // CHECK: ('address
', 0)
145 // CHECK: ('size
', 94)
146 // CHECK: ('offset
', 368)
147 // CHECK: ('alignment
', 0)
148 // CHECK: ('reloc_offset
', 604)
149 // CHECK: ('num_reloc
', 12)
150 // CHECK: ('flags
', 0x80000400)
151 // CHECK: ('reserved1
', 0)
152 // CHECK: ('reserved2
', 0)
153 // CHECK: ('reserved3
', 0)
155 // CHECK: ('_relocations
', [
157 // FIXME: Unfortunately, we do not get these relocations in exactly the same
158 // order as Darwin 'as
'. It turns out that 'as
' *usually* ends up emitting
159 // them in reverse address order, but sometimes it allocates some
160 // additional relocations late so these end up precede the other entries. I
161 // haven't figured out the exact criteria for this yet.
163 // CHECK
: (('word-0', 0x56),
164 // CHECK
: ('word-1', 0x1d000004)),
165 // CHECK
: (('word-0', 0x50),
166 // CHECK
: ('word-1', 0x1d000004)),
167 // CHECK
: (('word-0', 0x4a),
168 // CHECK
: ('word-1', 0x1d000003)),
169 // CHECK
: (('word-0', 0x44),
170 // CHECK
: ('word-1', 0x1d000003)),
171 // CHECK
: (('word-0', 0x3e),
172 // CHECK
: ('word-1', 0x1d000002)),
173 // CHECK
: (('word-0', 0x38),
174 // CHECK
: ('word-1', 0x1d000002)),
175 // CHECK
: (('word-0', 0x20),
176 // CHECK
: ('word-1', 0x2d000004)),
177 // CHECK
: (('word-0', 0x1b),
178 // CHECK
: ('word-1', 0x2d000004)),
179 // CHECK
: (('word-0', 0x16),
180 // CHECK
: ('word-1', 0x2d000003)),
181 // CHECK
: (('word-0', 0x11),
182 // CHECK
: ('word-1', 0x2d000003)),
183 // CHECK
: (('word-0', 0xc),
184 // CHECK
: ('word-1', 0x2d000002)),
185 // CHECK
: (('word-0', 0x5),
186 // CHECK
: ('word-1', 0x2d000000)),
188 // CHECK
: # Section 1
189 // CHECK
: (('section_name', '__data\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
190 // CHECK
: ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
191 // CHECK
: ('address', 94)
192 // CHECK
: ('size', 142)
193 // CHECK
: ('offset', 462)
194 // CHECK
: ('alignment', 0)
195 // CHECK
: ('reloc_offset', 700)
196 // CHECK
: ('num_reloc', 16)
197 // CHECK
: ('flags', 0x400)
198 // CHECK
: ('reserved1', 0)
199 // CHECK
: ('reserved2', 0)
200 // CHECK
: ('reserved3', 0)
202 // CHECK
: ('_relocations', [
203 // CHECK
: # Relocation 0
204 // CHECK
: (('word-0', 0x7a),
205 // CHECK
: ('word-1', 0x5e000001)),
206 // CHECK
: # Relocation 1
207 // CHECK
: (('word-0', 0x7a),
208 // CHECK
: ('word-1', 0xe000002)),
209 // CHECK
: # Relocation 2
210 // CHECK
: (('word-0', 0x72),
211 // CHECK
: ('word-1', 0x5e000001)),
212 // CHECK
: # Relocation 3
213 // CHECK
: (('word-0', 0x72),
214 // CHECK
: ('word-1', 0xe000002)),
215 // CHECK
: # Relocation 4
216 // CHECK
: (('word-0', 0x62),
217 // CHECK
: ('word-1', 0xe000002)),
218 // CHECK
: # Relocation 5
219 // CHECK
: (('word-0', 0x5a),
220 // CHECK
: ('word-1', 0xe000002)),
221 // CHECK
: # Relocation 6
222 // CHECK
: (('word-0', 0x52),
223 // CHECK
: ('word-1', 0xe000001)),
224 // CHECK
: # Relocation 7
225 // CHECK
: (('word-0', 0x4a),
226 // CHECK
: ('word-1', 0xe000001)),
227 // CHECK
: # Relocation 8
228 // CHECK
: (('word-0', 0x3a),
229 // CHECK
: ('word-1', 0x5e000003)),
230 // CHECK
: # Relocation 9
231 // CHECK
: (('word-0', 0x3a),
232 // CHECK
: ('word-1', 0xe000004)),
233 // CHECK
: # Relocation 10
234 // CHECK
: (('word-0', 0x32),
235 // CHECK
: ('word-1', 0x5e000003)),
236 // CHECK
: # Relocation 11
237 // CHECK
: (('word-0', 0x32),
238 // CHECK
: ('word-1', 0xe000004)),
239 // CHECK
: # Relocation 12
240 // CHECK
: (('word-0', 0x22),
241 // CHECK
: ('word-1', 0xe000004)),
242 // CHECK
: # Relocation 13
243 // CHECK
: (('word-0', 0x1a),
244 // CHECK
: ('word-1', 0xe000004)),
245 // CHECK
: # Relocation 14
246 // CHECK
: (('word-0', 0x12),
247 // CHECK
: ('word-1', 0xe000003)),
248 // CHECK
: # Relocation 15
249 // CHECK
: (('word-0', 0xa),
250 // CHECK
: ('word-1', 0xe000003)),
254 // CHECK
: # Load Command 1
255 // CHECK
: (('command', 2)
256 // CHECK
: ('size', 24)
257 // CHECK
: ('symoff', 828)
258 // CHECK
: ('nsyms', 5)
259 // CHECK
: ('stroff', 908)
260 // CHECK
: ('strsize', 24)
261 // CHECK
: ('_string_data', '\x00_foo\x00_g0\x00_g1\x00_g2\x00_g3\x00\x00\x00')
262 // CHECK
: ('_symbols', [
264 // CHECK
: (('n_strx', 1)
265 // CHECK
: ('n_type', 0xe)
266 // CHECK
: ('n_sect', 1)
267 // CHECK
: ('n_desc', 0)
268 // CHECK
: ('n_value', 0)
269 // CHECK
: ('_string', '_foo')
272 // CHECK
: (('n_strx', 6)
273 // CHECK
: ('n_type', 0xe)
274 // CHECK
: ('n_sect', 1)
275 // CHECK
: ('n_desc', 0)
276 // CHECK
: ('n_value', 2)
277 // CHECK
: ('_string', '_g0')
280 // CHECK
: (('n_strx', 10)
281 // CHECK
: ('n_type', 0xe)
282 // CHECK
: ('n_sect', 1)
283 // CHECK
: ('n_desc', 0)
284 // CHECK
: ('n_value', 90)
285 // CHECK
: ('_string', '_g1')
288 // CHECK
: (('n_strx', 14)
289 // CHECK
: ('n_type', 0xe)
290 // CHECK
: ('n_sect', 2)
291 // CHECK
: ('n_desc', 0)
292 // CHECK
: ('n_value', 94)
293 // CHECK
: ('_string', '_g2')
296 // CHECK
: (('n_strx', 18)
297 // CHECK
: ('n_type', 0xe)
298 // CHECK
: ('n_sect', 2)
299 // CHECK
: ('n_desc', 0)
300 // CHECK
: ('n_value', 232)
301 // CHECK
: ('_string', '_g3')
305 // CHECK
: # Load Command 2
306 // CHECK
: (('command', 11)
307 // CHECK
: ('size', 80)
308 // CHECK
: ('ilocalsym', 0)
309 // CHECK
: ('nlocalsym', 5)
310 // CHECK
: ('iextdefsym', 5)
311 // CHECK
: ('nextdefsym', 0)
312 // CHECK
: ('iundefsym', 5)
313 // CHECK
: ('nundefsym', 0)
314 // CHECK
: ('tocoff', 0)
315 // CHECK
: ('ntoc', 0)
316 // CHECK
: ('modtaboff', 0)
317 // CHECK
: ('nmodtab', 0)
318 // CHECK
: ('extrefsymoff', 0)
319 // CHECK
: ('nextrefsyms', 0)
320 // CHECK
: ('indirectsymoff', 0)
321 // CHECK
: ('nindirectsyms', 0)
322 // CHECK
: ('extreloff', 0)
323 // CHECK
: ('nextrel', 0)
324 // CHECK
: ('locreloff', 0)
325 // CHECK
: ('nlocrel', 0)
326 // CHECK
: ('_indirect_symbols', [