xref: /llvm-project/llvm/test/tools/llvm-readobj/MachO/stabs-sorted.yaml (revision 1ae449f9a33b9c8cc3bbf38013b24bd4e9e5bb27)
1## Verify that llvm-readobj can dump files with stabs symbols in a sorted order.
2
3# RUN: yaml2obj --docnum=1 %s -o %t
4
5# RUN: not llvm-readobj --syms --sort-symbols=foo %t 2>&1 | FileCheck %s --check-prefix ERR-KEY
6# RUN: not llvm-readobj --syms --sort-symbols=,, %t 2>&1 | FileCheck %s --check-prefix ERR-KEY-EMPT
7
8# RUN: llvm-readobj --syms --sort-symbols=type,name %t | FileCheck %s --check-prefix TYPE-NAME
9# RUN: llvm-readobj --syms --sort-symbols=name,type %t | FileCheck %s --check-prefix NAME-TYPE
10# RUN: llvm-readobj --syms --sort-symbols=type %t | FileCheck %s --check-prefix TYPE-ONLY
11
12# ERR-KEY: error: --sort-symbols value should be 'name' or 'type', but was 'foo'
13# ERR-KEY-EMPT: error: --sort-symbols value should be 'name' or 'type', but was ''
14
15# TYPE-NAME:      Name: _a (19)
16# TYPE-NAME-NEXT: Type: Section (0xE)
17# TYPE-NAME:      Name: _d (10)
18# TYPE-NAME-NEXT: Type: Section (0xE)
19# TYPE-NAME:      Name: _f (7)
20# TYPE-NAME-NEXT: Type: SymDebugTable (0x2E)
21# TYPE-NAME:      Name: _z (1)
22# TYPE-NAME-NEXT: Type: SymDebugTable (0x2E)
23# TYPE-NAME:      Name: _c (13)
24# TYPE-NAME-NEXT: Type: SymDebugTable (0x64)
25# TYPE-NAME:      Name: _g (4)
26# TYPE-NAME-NEXT: Type: SymDebugTable (0x64)
27# TYPE-NAME:      Name: _b (16)
28# TYPE-NAME-NEXT: Type: SymDebugTable (0x66)
29# TYPE-NAME:      Name: _d2 (22)
30# TYPE-NAME-NEXT: Type: SymDebugTable (0x66)
31
32# NAME-TYPE:         Name: _a (19)
33# NAME-TYPE-NEXT:    Type: Section (0xE)
34# NAME-TYPE:         Name: _b (16)
35# NAME-TYPE-NEXT:    Type: SymDebugTable (0x66)
36# NAME-TYPE:         Name: _c (13)
37# NAME-TYPE-NEXT:    Type: SymDebugTable (0x64)
38# NAME-TYPE:         Name: _d (10)
39# NAME-TYPE-NEXT:    Type: Section (0xE)
40# NAME-TYPE:         Name: _d2 (22)
41# NAME-TYPE-NEXT:    Type: SymDebugTable (0x66)
42# NAME-TYPE:         Name: _f (7)
43# NAME-TYPE-NEXT:    Type: SymDebugTable (0x2E)
44# NAME-TYPE:         Name: _g (4)
45# NAME-TYPE-NEXT:    Type: SymDebugTable (0x64)
46# NAME-TYPE:         Name: _z (1)
47# NAME-TYPE-NEXT:    Type: SymDebugTable (0x2E)
48
49# TYPE-ONLY:        Name: _d (10)
50# TYPE-ONLY-NEXT:   Type: Section (0xE)
51# TYPE-ONLY:        Name: _a (19)
52# TYPE-ONLY-NEXT:   Type: Section (0xE)
53# TYPE-ONLY:        Name: _f (7)
54# TYPE-ONLY-NEXT:   Type: SymDebugTable (0x2E)
55# TYPE-ONLY:        Name: _z (1)
56# TYPE-ONLY-NEXT:   Type: SymDebugTable (0x2E)
57# TYPE-ONLY:        Name: _g (4)
58# TYPE-ONLY-NEXT:   Type: SymDebugTable (0x64)
59# TYPE-ONLY:        Name: _c (13)
60# TYPE-ONLY-NEXT:   Type: SymDebugTable (0x64)
61# TYPE-ONLY:        Name: _d2 (22)
62# TYPE-ONLY-NEXT:   Type: SymDebugTable (0x66)
63# TYPE-ONLY:        Name: _b (16)
64# TYPE-ONLY-NEXT:   Type: SymDebugTable (0x66)
65
66--- !mach-o
67FileHeader:
68  magic:           0xFEEDFACF
69  cputype:         0x1000007
70  cpusubtype:      0x3
71  filetype:        0x1
72  ncmds:           3
73  sizeofcmds:      496
74  flags:           0x2000
75  reserved:        0x0
76LoadCommands:
77  - cmd:             LC_SEGMENT_64
78    cmdsize:         392
79    segname:         ''
80    vmaddr:          0
81    vmsize:          32
82    fileoff:         528
83    filesize:        28
84    maxprot:         7
85    initprot:        7
86    nsects:          4
87    flags:           0
88    Sections:
89      - sectname:        __text
90        segname:         __TEXT
91        addr:            0x0
92        size:            9
93        offset:          0x210
94        align:           0
95        reloff:          0x230
96        nreloc:          1
97        flags:           0x80000000
98        reserved1:       0x0
99        reserved2:       0x0
100        reserved3:       0x0
101        content:         '000000000000000000'
102        relocations:
103          - address:         0x0
104            symbolnum:       7
105            pcrel:           false
106            length:          3
107            extern:          true
108            type:            0
109            scattered:       false
110            value:           0
111      - sectname:        more_data
112        segname:         __DATA
113        addr:            0x9
114        size:            8
115        offset:          0x219
116        align:           0
117        reloff:          0x0
118        nreloc:          0
119        flags:           0x0
120        reserved1:       0x0
121        reserved2:       0x0
122        reserved3:       0x0
123        content:         7B00000000000000
124      - sectname:        __data
125        segname:         __DATA
126        addr:            0x11
127        size:            11
128        offset:          0x221
129        align:           0
130        reloff:          0x0
131        nreloc:          0
132        flags:           0x0
133        reserved1:       0x0
134        reserved2:       0x0
135        reserved3:       0x0
136        content:         7B00000000000000000000
137      - sectname:        __common
138        segname:         __DATA
139        addr:            0x1C
140        size:            4
141        offset:          0x0
142        align:           2
143        reloff:          0x0
144        nreloc:          0
145        flags:           0x1
146        reserved1:       0x0
147        reserved2:       0x0
148        reserved3:       0x0
149  - cmd:             LC_SYMTAB
150    cmdsize:         24
151    symoff:          568
152    nsyms:           8
153    stroff:          696
154    strsize:         32
155  - cmd:             LC_DYSYMTAB
156    cmdsize:         80
157    ilocalsym:       0
158    nlocalsym:       7
159    iextdefsym:      7
160    nextdefsym:      0
161    iundefsym:       7
162    nundefsym:       1
163    tocoff:          0
164    ntoc:            0
165    modtaboff:       0
166    nmodtab:         0
167    extrefsymoff:    0
168    nextrefsyms:     0
169    indirectsymoff:  0
170    nindirectsyms:   0
171    extreloff:       0
172    nextrel:         0
173    locreloff:       0
174    nlocrel:         0
175LinkEditData:
176  NameList:
177    - n_strx:          4
178      n_type:          0x64
179      n_sect:          1
180      n_desc:          0
181      n_value:         0
182    - n_strx:          10
183      n_type:          0xE
184      n_sect:          1
185      n_desc:          0
186      n_value:         8
187    - n_strx:          22
188      n_type:          0x66
189      n_sect:          1
190      n_desc:          0
191      n_value:         8
192    - n_strx:          16
193      n_type:          0x66
194      n_sect:          2
195      n_desc:          0
196      n_value:         9
197    - n_strx:          19
198      n_type:          0xE
199      n_sect:          3
200      n_desc:          0
201      n_value:         17
202    - n_strx:          13
203      n_type:          0x64
204      n_sect:          4
205      n_desc:          0
206      n_value:         28
207    - n_strx:          7
208      n_type:          0x2E
209      n_sect:          3
210      n_desc:          0
211      n_value:         25
212    - n_strx:          1
213      n_type:          0x2E
214      n_sect:          0
215      n_desc:          0
216      n_value:         0
217  StringTable:
218    - ''
219    - _z
220    - _g
221    - _f
222    - _d
223    - _c
224    - _b
225    - _a
226    - _d2
227    - ''
228    - ''
229    - ''
230    - ''
231    - ''
232    - ''
233...
234