1@ RUN: llvm-mc -n -triple armv7-apple-darwin10 %s -filetype=obj -o %t.obj
2@ RUN: llvm-readobj --file-headers -S --sd -r --symbols --macho-segment --macho-dysymtab --macho-indirect-symbols < %t.obj - > %t.dump
3@ RUN: FileCheck < %t.dump %s
4
5	.syntax unified
6        .text
7_f0:
8        bl _printf
9
10_f1:
11        bl _f0
12
13        .data
14_d0:
15Ld0_0:
16        .long Lsc0_0 - Ld0_0
17
18	.section	__TEXT,__cstring,cstring_literals
19Lsc0_0:
20        .long 0
21
22        .subsections_via_symbols
23
24@ CHECK: File: <stdin>
25@ CHECK: Format: Mach-O arm
26@ CHECK: Arch: arm
27@ CHECK: AddressSize: 32bit
28@ CHECK: MachHeader {
29@ CHECK:   Magic: Magic (0xFEEDFACE)
30@ CHECK:   CpuType: Arm (0xC)
31@ CHECK:   CpuSubType: CPU_SUBTYPE_ARM_V7 (0x9)
32@ CHECK:   FileType: Relocatable (0x1)
33@ CHECK:   NumOfLoadCommands: 4
34@ CHECK:   SizeOfLoadCommands: 380
35@ CHECK:   Flags [ (0x2000)
36@ CHECK:     MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
37@ CHECK:   ]
38@ CHECK: }
39@ CHECK: Sections [
40@ CHECK:   Section {
41@ CHECK:     Index: 0
42@ CHECK:     Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
43@ CHECK:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
44@ CHECK:     Address: 0x0
45@ CHECK:     Size: 0x8
46@ CHECK:     Offset: 408
47@ CHECK:     Alignment: 0
48@ CHECK:     RelocationOffset: 0x1A8
49@ CHECK:     RelocationCount: 2
50@ CHECK:     Type: Regular (0x0)
51@ CHECK:     Attributes [ (0x800004)
52@ CHECK:       PureInstructions (0x800000)
53@ CHECK:       SomeInstructions (0x4)
54@ CHECK:     ]
55@ CHECK:     Reserved1: 0x0
56@ CHECK:     Reserved2: 0x0
57@ CHECK:     SectionData (
58@ CHECK:       0000: FEFFFFEB FDFFFFEB                    |........|
59@ CHECK:     )
60@ CHECK:   }
61@ CHECK:   Section {
62@ CHECK:     Index: 1
63@ CHECK:     Name: __data (5F 5F 64 61 74 61 00 00 00 00 00 00 00 00 00 00)
64@ CHECK:     Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)
65@ CHECK:     Address: 0x8
66@ CHECK:     Size: 0x4
67@ CHECK:     Offset: 416
68@ CHECK:     Alignment: 0
69@ CHECK:     RelocationOffset: 0x1B8
70@ CHECK:     RelocationCount: 2
71@ CHECK:     Type: Regular (0x0)
72@ CHECK:     Attributes [ (0x0)
73@ CHECK:     ]
74@ CHECK:     Reserved1: 0x0
75@ CHECK:     Reserved2: 0x0
76@ CHECK:     SectionData (
77@ CHECK:       0000: 04000000                             |....|
78@ CHECK:     )
79@ CHECK:   }
80@ CHECK:   Section {
81@ CHECK:     Index: 2
82@ CHECK:     Name: __cstring (5F 5F 63 73 74 72 69 6E 67 00 00 00 00 00 00 00)
83@ CHECK:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
84@ CHECK:     Address: 0xC
85@ CHECK:     Size: 0x4
86@ CHECK:     Offset: 420
87@ CHECK:     Alignment: 0
88@ CHECK:     RelocationOffset: 0x0
89@ CHECK:     RelocationCount: 0
90@ CHECK:     Type: CStringLiterals (0x2)
91@ CHECK:     Attributes [ (0x0)
92@ CHECK:     ]
93@ CHECK:     Reserved1: 0x0
94@ CHECK:     Reserved2: 0x0
95@ CHECK:     SectionData (
96@ CHECK:       0000: 00000000                             |....|
97@ CHECK:     )
98@ CHECK:   }
99@ CHECK: ]
100@ CHECK: Relocations [
101@ CHECK:   Section __text {
102@ CHECK:     0x4 1 2 1 ARM_RELOC_BR24 0 _f0
103@ CHECK:     0x0 1 2 1 ARM_RELOC_BR24 0 _printf
104@ CHECK:   }
105@ CHECK:   Section __data {
106@ CHECK:     0x0 0 2 n/a ARM_RELOC_SECTDIFF 1 0xC
107@ CHECK:     0x0 0 2 n/a ARM_RELOC_PAIR 1 0x8
108@ CHECK:   }
109@ CHECK: ]
110@ CHECK: Symbols [
111@ CHECK:   Symbol {
112@ CHECK:     Name: _f0 (13)
113@ CHECK:     Type: Section (0xE)
114@ CHECK:     Section: __text (0x1)
115@ CHECK:     RefType: UndefinedNonLazy (0x0)
116@ CHECK:     Flags [ (0x0)
117@ CHECK:     ]
118@ CHECK:     Value: 0x0
119@ CHECK:   }
120@ CHECK:   Symbol {
121@ CHECK:     Name: _f1 (9)
122@ CHECK:     Type: Section (0xE)
123@ CHECK:     Section: __text (0x1)
124@ CHECK:     RefType: UndefinedNonLazy (0x0)
125@ CHECK:     Flags [ (0x0)
126@ CHECK:     ]
127@ CHECK:     Value: 0x4
128@ CHECK:   }
129@ CHECK:   Symbol {
130@ CHECK:     Name: _d0 (17)
131@ CHECK:     Type: Section (0xE)
132@ CHECK:     Section: __data (0x2)
133@ CHECK:     RefType: UndefinedNonLazy (0x0)
134@ CHECK:     Flags [ (0x0)
135@ CHECK:     ]
136@ CHECK:     Value: 0x8
137@ CHECK:   }
138@ CHECK:   Symbol {
139@ CHECK:     Name: _printf (1)
140@ CHECK:     Extern
141@ CHECK:     Type: Undef (0x0)
142@ CHECK:     Section:  (0x0)
143@ CHECK:     RefType: UndefinedNonLazy (0x0)
144@ CHECK:     Flags [ (0x0)
145@ CHECK:     ]
146@ CHECK:     Value: 0x0
147@ CHECK:   }
148@ CHECK: ]
149@ CHECK: Indirect Symbols {
150@ CHECK:   Number: 0
151@ CHECK:   Symbols [
152@ CHECK:   ]
153@ CHECK: }
154@ CHECK: Segment {
155@ CHECK:   Cmd: LC_SEGMENT
156@ CHECK:   Name:
157@ CHECK:   Size: 260
158@ CHECK:   vmaddr: 0x0
159@ CHECK:   vmsize: 0x10
160@ CHECK:   fileoff: 408
161@ CHECK:   filesize: 16
162@ CHECK:   maxprot: rwx
163@ CHECK:   initprot: rwx
164@ CHECK:   nsects: 3
165@ CHECK:   flags: 0x0
166@ CHECK: }
167@ CHECK: Dysymtab {
168@ CHECK:   ilocalsym: 0
169@ CHECK:   nlocalsym: 3
170@ CHECK:   iextdefsym: 3
171@ CHECK:   nextdefsym: 0
172@ CHECK:   iundefsym: 3
173@ CHECK:   nundefsym: 1
174@ CHECK:   tocoff: 0
175@ CHECK:   ntoc: 0
176@ CHECK:   modtaboff: 0
177@ CHECK:   nmodtab: 0
178@ CHECK:   extrefsymoff: 0
179@ CHECK:   nextrefsyms: 0
180@ CHECK:   indirectsymoff: 0
181@ CHECK:   nindirectsyms: 0
182@ CHECK:   extreloff: 0
183@ CHECK:   nextrel: 0
184@ CHECK:   locreloff: 0
185@ CHECK:   nlocrel: 0
186@ CHECK: }
187