ELF: Have __rela_iplt_{start,end} surround .rela.iplt with --pack-dyn-relocs=android.
[llvm-project.git] / llvm / test / ObjectYAML / MachO / DWARF-pubsections.yaml
blob6638f2f74dd424f0faf0653f26c40ea98fe752e7
1 ## This file contains test cases for generating .debug_pubnames/.debug_pubtypes
2 ## section in object files from the DWARF entry of Mach-O YAML inputs
4 ## a) Test that yaml2obj emits the .debug_pubnames and .debug_pubtypes sections and
5 ## obj2yaml converts them back.
7 # RUN: yaml2obj %s | obj2yaml | FileCheck %s
9 --- !mach-o
10 FileHeader:      
11   magic:           0xFEEDFACF
12   cputype:         0x01000007
13   cpusubtype:      0x00000003
14   filetype:        0x0000000A
15   ncmds:           1
16   sizeofcmds:      1800
17   flags:           0x00000000
18   reserved:        0x00000000
19 LoadCommands:    
20   - cmd:             LC_SEGMENT_64
21     cmdsize:         232
22     segname:         __DWARF
23     vmaddr:          0
24     vmsize:          0
25     fileoff:         152
26     filesize:        0xffff
27     maxprot:         0
28     initprot:        0
29     nsects:          2
30     flags:           0
31     Sections:        
32       - sectname:  __debug_pubnames
33         segname:   __DWARF
34         addr:      0x0000000000000000
35         size:      27
36         offset:    0x00000152
37         align:     0
38         reloff:    0x00000000
39         nreloc:    0
40         flags:     0x00000000
41         reserved1: 0x00000000
42         reserved2: 0x00000000
43         reserved3: 0x00000000
44       - sectname:  __debug_pubtypes
45         segname:   __DWARF
46         addr:      0x0000000000000000
47         size:      35
48         offset:    0x00000720
49         align:     0
50         reloff:    0x00000000
51         nreloc:    0
52         flags:     0x00000000
53         reserved1: 0x00000000
54         reserved2: 0x00000000
55         reserved3: 0x00000000
56 DWARF:           
57   debug_pubnames:  
58     Length:          23
59     Version:         2
60     UnitOffset:      0
61     UnitSize:        121
62     Entries:         
63       - DieOffset:       0x0000002A
64         Name:            main
65   debug_pubtypes:  
66     Length:          31
67     Version:         2
68     UnitOffset:      0
69     UnitSize:        121
70     Entries:         
71       - DieOffset:       0x00000060
72         Name:            int
73       - DieOffset:       0x00000071
74         Name:            char
76 #      CHECK: DWARF:
77 #      CHECK:   debug_pubnames:
78 # CHECK-NEXT:     Length:          0x17
79 # CHECK-NEXT:     Version:         2
80 # CHECK-NEXT:     UnitOffset:      0
81 # CHECK-NEXT:     UnitSize:        121
82 # CHECK-NEXT:     Entries:
83 # CHECK-NEXT:       - DieOffset:       0x2A
84 # CHECK-NEXT:         Name:            main
85 # CHECK-NEXT:   debug_pubtypes:
86 # CHECK-NEXT:     Length:          0x1F
87 # CHECK-NEXT:     Version:         2
88 # CHECK-NEXT:     UnitOffset:      0
89 # CHECK-NEXT:     UnitSize:        121
90 # CHECK-NEXT:     Entries:
91 # CHECK-NEXT:       - DieOffset:       0x60
92 # CHECK-NEXT:         Name:            int
93 # CHECK-NEXT:       - DieOffset:       0x71
94 # CHECK-NEXT:         Name:            char
95 # CHECK-NEXT: ...
97 ## b) Test that yaml2obj will not emit the .debug_pubnames/.debug_pubtypes section's
98 ## contents, if the "debug_pubnames"/"debug_pubtypes" entry doesn't exist in the
99 ## "DWARF" entry.
101 # RUN: yaml2obj --docnum=2 %s -o %t2
102 # RUN: obj2yaml %t2 | FileCheck %s --check-prefix=EMPTY
104 #      EMPTY: Sections:
105 # EMPTY-NEXT:   - sectname:        __debug_pubnames
106 # EMPTY-NEXT:     segname:         __DWARF
107 # EMPTY-NEXT:     addr:            0x0
108 # EMPTY-NEXT:     size:            0
109 # EMPTY-NEXT:     offset:          0x0
110 # EMPTY-NEXT:     align:           0
111 # EMPTY-NEXT:     reloff:          0x0
112 # EMPTY-NEXT:     nreloc:          0
113 # EMPTY-NEXT:     flags:           0x0
114 # EMPTY-NEXT:     reserved1:       0x0
115 # EMPTY-NEXT:     reserved2:       0x0
116 # EMPTY-NEXT:     reserved3:       0x0
117 # EMPTY-NEXT:   - sectname:        __debug_pubtypes
118 # EMPTY-NEXT:     segname:         __DWARF
119 # EMPTY-NEXT:     addr:            0x0
120 # EMPTY-NEXT:     size:            0
121 # EMPTY-NEXT:     offset:          0x720
122 # EMPTY-NEXT:     align:           0
123 # EMPTY-NEXT:     reloff:          0x0
124 # EMPTY-NEXT:     nreloc:          0
125 # EMPTY-NEXT:     flags:           0x0
126 # EMPTY-NEXT:     reserved1:       0x0
127 # EMPTY-NEXT:     reserved2:       0x0
128 # EMPTY-NEXT:     reserved3:       0x0
129 # EMPTY-NEXT: ...
131 --- !mach-o
132 FileHeader:
133   magic:      0xFEEDFACF
134   cputype:    0x01000007
135   cpusubtype: 0x00000003
136   filetype:   0x0000000A
137   ncmds:      1
138   sizeofcmds: 1772
139   flags:      0x00000000
140   reserved:   0x00000000
141 LoadCommands:
142   - cmd:      LC_SEGMENT_64
143     cmdsize:  232
144     segname:  __DWARF
145     vmaddr:   0x00000000
146     vmsize:   0x00000000
147     fileoff:  0
148     filesize: 0
149     maxprot:  0
150     initprot: 0
151     nsects:   2
152     flags:    0
153     Sections:
154       - sectname:  __debug_pubnames
155         segname:   __DWARF
156         addr:      0x0000000000000000
157         size:      0
158         offset:    0x00000000
159         align:     0
160         reloff:    0x00000000
161         nreloc:    0
162         flags:     0x00000000
163         reserved1: 0x00000000
164         reserved2: 0x00000000
165         reserved3: 0x00000000
166       - sectname:  __debug_pubtypes
167         segname:   __DWARF
168         addr:      0x0000000000000000
169         size:      0
170         offset:    0x00000720
171         align:     0
172         reloff:    0x00000000
173         nreloc:    0
174         flags:     0x00000000
175         reserved1: 0x00000000
176         reserved2: 0x00000000
177         reserved3: 0x00000000
178 DWARF:
180 ## c) Test that obj2yaml is able to dump a __debug_pubnames section whose length field is greater than the section size.
182 # RUN: yaml2obj --docnum=3 %s | obj2yaml | FileCheck %s --check-prefix=INVALID-LENGTH
184 #      INVALID-LENGTH: DWARF:
185 # INVALID-LENGTH-NEXT:   debug_pubnames:
186 # INVALID-LENGTH-NEXT:     Length:          0xDEADBEEF
187 # INVALID-LENGTH-NEXT:     Version:         2
188 # INVALID-LENGTH-NEXT:     UnitOffset:      0
189 # INVALID-LENGTH-NEXT:     UnitSize:        121
190 # INVALID-LENGTH-NEXT:     Entries:
191 # INVALID-LENGTH-NEXT:       - DieOffset:       0x2A
192 # INVALID-LENGTH-NEXT:         Name:            main
194 --- !mach-o
195 FileHeader:
196   magic:      0xFEEDFACF
197   cputype:    0x01000007
198   cpusubtype: 0x00000003
199   filetype:   0x0000000A
200   ncmds:      1
201   sizeofcmds: 1888
202   flags:      0x00000000
203   reserved:   0x00000000
204 LoadCommands:
205   - cmd:      LC_SEGMENT_64
206     cmdsize:  152
207     segname:  __DWARF
208     vmaddr:   0x00000000
209     vmsize:   0x00000000
210     fileoff:  0
211     filesize: 0xffff
212     maxprot:  0
213     initprot: 0
214     nsects:   1
215     flags:    0
216     Sections:
217       - sectname:  __debug_pubnames
218         segname:   __DWARF
219         addr:      0x0000000000000000
220         size:      24
221         offset:    0x000000b8
222         align:     0
223         reloff:    0x00000000
224         nreloc:    0
225         flags:     0x00000000
226         reserved1: 0x00000000
227         reserved2: 0x00000000
228         reserved3: 0x00000000
229 DWARF:
230   debug_pubnames:
231     Length:     0xdeadbeef
232     Version:    2
233     UnitOffset: 0
234     UnitSize:   121
235     Entries:
236       - DieOffset: 0x0000002A
237         Name:      main