ld: Handle extended-length data structures in PDB types
[platform/upstream/binutils.git] / ld / testsuite / ld-pe / pdb-types1b.s
1 .equ CV_SIGNATURE_C13, 4
2
3 .equ T_CHAR, 0x0010
4 .equ T_LONG, 0x0012
5 .equ T_ULONG, 0x0022
6 .equ T_INT4, 0x0074
7 .equ T_UINT4, 0x0075
8 .equ T_UQUAD, 0x0023
9
10 .equ LF_VTSHAPE, 0x000a
11 .equ LF_MODIFIER, 0x1001
12 .equ LF_POINTER, 0x1002
13 .equ LF_PROCEDURE, 0x1008
14 .equ LF_MFUNCTION, 0x1009
15 .equ LF_ARGLIST, 0x1201
16 .equ LF_FIELDLIST, 0x1203
17 .equ LF_BITFIELD, 0x1205
18 .equ LF_METHODLIST, 0x1206
19 .equ LF_BCLASS, 0x1400
20 .equ LF_VBCLASS, 0x1401
21 .equ LF_INDEX, 0x1404
22 .equ LF_VFUNCTAB, 0x1409
23 .equ LF_ENUMERATE, 0x1502
24 .equ LF_ARRAY, 0x1503
25 .equ LF_STRUCTURE, 0x1505
26 .equ LF_UNION, 0x1506
27 .equ LF_ENUM, 0x1507
28 .equ LF_MEMBER, 0x150d
29 .equ LF_STMEMBER, 0x150e
30 .equ LF_METHOD, 0x150f
31 .equ LF_NESTTYPE, 0x1510
32 .equ LF_ONEMETHOD, 0x1511
33
34 .equ LF_USHORT, 0x8002
35 .equ LF_LONG, 0x8003
36 .equ LF_ULONG, 0x8004
37 .equ LF_UQUADWORD, 0x800a
38
39 .equ CV_PTR_NEAR32, 0xa
40 .equ CV_PTR_64, 0xc
41
42 .section ".debug$T", "rn"
43
44 .long CV_SIGNATURE_C13
45
46 # Type 1000, const long
47 .mod1:
48 .short .mod2 - .mod1 - 2
49 .short LF_MODIFIER
50 .long T_LONG
51 .short 1 # const
52 .p2align 2
53
54 # Type 1001, volatile unsigned long
55 .mod2:
56 .short .mod3 - .mod2 - 2
57 .short LF_MODIFIER
58 .long T_ULONG
59 .short 2 # volatile
60 .p2align 2
61
62 # Type 1002, const volatile int
63 .mod3:
64 .short .ptr1 - .mod3 - 2
65 .short LF_MODIFIER
66 .long T_INT4
67 .short 3 # const volatile
68 .p2align 2
69
70 # Type 1003, const long * (64-bit pointer)
71 .ptr1:
72 .short .ptr2 - .ptr1 - 2
73 .short LF_POINTER
74 .long 0x1000
75 .long (8 << 13) | CV_PTR_64
76
77 # Type 1004, volatile unsigned long * (32-bit pointer)
78 .ptr2:
79 .short .arglist1 - .ptr2 - 2
80 .short LF_POINTER
81 .long 0x1001
82 .long (4 << 13) | CV_PTR_NEAR32
83
84 # Type 1005, arg list of types 1000, 1001, 1002
85 .arglist1:
86 .short .proc1 - .arglist1 - 2
87 .short LF_ARGLIST
88 .long 3 # no. entries
89 .long 0x1000
90 .long 0x1001
91 .long 0x1002
92
93 # Type 1006, procedure, return type 1001, arg list 1005
94 .proc1:
95 .short .arr1 - .proc1 - 2
96 .short LF_PROCEDURE
97 .long 0x1001
98 .byte 0 # calling convention
99 .byte 0 # attributes
100 .short 3 # no. parameters
101 .long 0x1005
102
103 # Type 1007, array[3] of const long *
104 .arr1:
105 .short .bitfield1 - .arr1 - 2
106 .short LF_ARRAY
107 .long 0x1003 # element type
108 .long T_INT4 # index type
109 .short 24 # length in bytes
110 .byte 0 # name
111 .byte 0xf1 # padding
112
113 # Type 1008, bitfield of uint32_t, position 0, length 1
114 .bitfield1:
115 .short .bitfield2 - .bitfield1 - 2
116 .short LF_BITFIELD
117 .long T_UINT4
118 .byte 1
119 .byte 0
120 .byte 0xf2 # padding
121 .byte 0xf1 # padding
122
123 # Type 1009, bitfield of uint32_t, position 1, length 31
124 .bitfield2:
125 .short .fieldlist1 - .bitfield2 - 2
126 .short LF_BITFIELD
127 .long T_UINT4
128 .byte 31
129 .byte 1
130 .byte 0xf2 # padding
131 .byte 0xf1 # padding
132
133 # Type 100a, field list (1008 as num1, 1009 as num2)
134 .fieldlist1:
135 .short .struct1 - .fieldlist1 - 2
136 .short LF_FIELDLIST
137 .short LF_MEMBER
138 .short 3 # public
139 .long 0x1008
140 .short 0 # offset
141 .asciz "num1"
142 .byte 0xf1 # padding
143 .short LF_MEMBER
144 .short 3 # public
145 .long 0x1009
146 .short 0 # offset
147 .asciz "num2"
148 .byte 0xf1 # padding
149
150 # Type 100b, anonymous struct, field list 100a
151 .struct1:
152 .short .struct2 - .struct1 - 2
153 .short LF_STRUCTURE
154 .short 2 # no. members
155 .short 0 # property
156 .long 0x100a # field list
157 .long 0 # type derived from
158 .long 0 # type of vshape table
159 .short 4 # size
160 .asciz "<unnamed-tag>"
161
162 # Type 100c, forward declaration of struct foo
163 .struct2:
164 .short .ptr3 - .struct2 - 2
165 .short LF_STRUCTURE
166 .short 0 # no. members
167 .short 0x280 # property (has unique name, forward declaration)
168 .long 0 # field list
169 .long 0 # type derived from
170 .long 0 # type of vshape table
171 .short 0 # size
172 .asciz "foo" # name
173 .asciz "bar" # unique name
174 .byte 0xf2 # padding
175 .byte 0xf1 # padding
176
177 # Type 100d, pointer to 100c
178 .ptr3:
179 .short .arglist2 - .ptr3 - 2
180 .short LF_POINTER
181 .long 0x100c
182 .long (8 << 13) | CV_PTR_64
183
184 # Type 100e, empty arg list
185 .arglist2:
186 .short .mfunc1 - .arglist2 - 2
187 .short LF_ARGLIST
188 .long 0 # no. entries
189
190 # Type 100f, member function of 100c, return type 1001
191 .mfunc1:
192 .short .mfunc2 - .mfunc1 - 2
193 .short LF_MFUNCTION
194 .long 0x1001
195 .long 0x100c
196 .long 0x100d # type of "this" pointer
197 .byte 0 # calling convention
198 .byte 0 # attributes
199 .short 0 # no. parameters
200 .long 0x100e # arg list
201 .long 0 # "this" adjustment
202
203 # Type 1010, member function of 100c, return type 1001, arg list 1005
204 .mfunc2:
205 .short .methodlist1 - .mfunc2 - 2
206 .short LF_MFUNCTION
207 .long 0x1001
208 .long 0x100c
209 .long 0x100d # type of "this" pointer
210 .byte 0 # calling convention
211 .byte 0 # attributes
212 .short 3 # no. parameters
213 .long 0x1005 # arg list
214 .long 0 # "this" adjustment
215
216 # Type 1011, method list for both member functions 100f and 1010
217 .methodlist1:
218 .short .fieldlist2 - .methodlist1 - 2
219 .short LF_METHODLIST
220 .short 0 # attributes
221 .short 0 # padding
222 .long 0x100f
223 .short 0 # attributes
224 .short 0 # padding
225 .long 0x1010
226
227 # Type 1012, field list (uint32_t as num1)
228 .fieldlist2:
229 .short .struct3 - .fieldlist2 - 2
230 .short LF_FIELDLIST
231 .short LF_MEMBER
232 .short 3 # public
233 .long T_UINT4
234 .short 0 # offset
235 .asciz "num"
236 .byte 0xf2 # padding
237 .byte 0xf1 # padding
238 .short LF_ONEMETHOD
239 .short 0 # method attribute
240 .long 0x100f # method type
241 .asciz "method"
242 .byte 0xf1
243 .short LF_METHOD
244 .short 2 # no. overloads
245 .long 0x1011 # method list
246 .asciz "method2"
247
248 # Type 1013, struct foo, field list 1012
249 .struct3:
250 .short .fieldlist3 - .struct3 - 2
251 .short LF_STRUCTURE
252 .short 2 # no. members
253 .short 0x200 # property (has unique name)
254 .long 0x1012 # field list
255 .long 0 # type derived from
256 .long 0 # type of vshape table
257 .short 4 # size
258 .asciz "foo" # name
259 .asciz "bar" # unique name
260 .byte 0xf2 # padding
261 .byte 0xf1 # padding
262
263 # Type 1014, field list (uint32_t as num1, char as num2)
264 .fieldlist3:
265 .short .union1 - .fieldlist3 - 2
266 .short LF_FIELDLIST
267 .short LF_MEMBER
268 .short 3 # public
269 .long T_UINT4
270 .short 0 # offset
271 .asciz "num1"
272 .byte 0xf1 # padding
273 .short LF_MEMBER
274 .short 3 # public
275 .long T_CHAR
276 .short 0 # offset
277 .asciz "num2"
278 .byte 0xf1 # padding
279
280 # Type 1015, anonymous union (field list 1014)
281 .union1:
282 .short .union2 - .union1 - 2
283 .short LF_UNION
284 .short 2 # no. members
285 .short 0 # property
286 .long 0x1014
287 .short 4 # size
288 .asciz "<unnamed-tag>"
289
290 # Type 1016, forward declaration of union baz
291 .union2:
292 .short .union3 - .union2 - 2
293 .short LF_UNION
294 .short 0 # no. members
295 .short 0x280 # property (has unique name, forward declaration)
296 .long 0 # field list
297 .short 0 # size
298 .asciz "baz"
299 .asciz "qux"
300 .byte 0xf2 # padding
301 .byte 0xf1 # padding
302
303 # Type 1017, union baz (field list 1014)
304 .union3:
305 .short .fieldlist4 - .union3 - 2
306 .short LF_UNION
307 .short 2 # no. members
308 .short 0x200 # property (has unique name, forward declaration)
309 .long 0x1014 # field list
310 .short 4 # size
311 .asciz "baz"
312 .asciz "qux"
313 .byte 0xf2 # padding
314 .byte 0xf1 # padding
315
316 # Type 1018, field list for enum (red = 0, green = 1, blue = -1, yellow = 0x8000, purple = 0x100000000)
317 .fieldlist4:
318 .short .enum1 - .fieldlist4 - 2
319 .short LF_FIELDLIST
320 .short LF_ENUMERATE
321 .short 3 # public
322 .short 0 # value
323 .asciz "red"
324 .byte 0xf2 # padding
325 .byte 0xf1 # padding
326 .short LF_ENUMERATE
327 .short 3 # public
328 .short 1 # value
329 .asciz "green"
330 .short LF_ENUMERATE
331 .short 3 # public
332 .short LF_LONG
333 .long 0xffffffff # value
334 .asciz "blue"
335 .byte 0xf1 # padding
336 .short LF_ENUMERATE
337 .short 3 # public
338 .short LF_USHORT
339 .short 0x8000 # value
340 .asciz "yellow"
341 .byte 0xf1 # padding
342 .short LF_ENUMERATE
343 .short 3 # public
344 .short LF_UQUADWORD
345 .quad 0x100000000 # value
346 .asciz "purple"
347 .byte 0xf3 # padding
348 .byte 0xf2 # padding
349 .byte 0xf1 # padding
350
351 # Type 1019, forward reference to enum
352 .enum1:
353 .short .enum2 - .enum1 - 2
354 .short LF_ENUM
355 .short 0 # no. elements
356 .short 0x280 # property (has unique name, forward ref)
357 .long T_UQUAD # underlying type
358 .long 0 # field list
359 .asciz "colour"
360 .asciz "colour2"
361 .byte 0xf1 # padding
362
363 # Type 101a, enum (field list 1018)
364 .enum2:
365 .short .fieldlist5 - .enum2 - 2
366 .short LF_ENUM
367 .short 5 # no. elements
368 .short 0x200 # property (has unique name)
369 .long T_UQUAD # underlying type
370 .long 0x1018 # field list
371 .asciz "colour"
372 .asciz "colour2"
373 .byte 0xf1 # padding
374
375 # Type 101b, field list referencing other field list 1018
376 .fieldlist5:
377 .short .vtshape1 - .fieldlist5 - 2
378 .short LF_FIELDLIST
379 .short LF_INDEX
380 .short 0 # padding
381 .long 0x1018
382
383 # Type 101c, virtual function table shape
384 .vtshape1:
385 .short .ptr4 - .vtshape1 - 2
386 .short LF_VTSHAPE
387 .short 1 # no. descriptors
388 .byte 0 # descriptor (CV_VTS_near)
389 .byte 0xf1 # padding
390
391 # Type 101d, pointer to 101c
392 .ptr4:
393 .short .fieldlist6 - .ptr4 - 2
394 .short LF_POINTER
395 .long 0x101c
396 .long (8 << 13) | CV_PTR_64
397
398 # Type 101e, fieldlist for enum
399 .fieldlist6:
400 .short .enum3 - .fieldlist6 - 2
401 .short LF_FIELDLIST
402 .short LF_ENUMERATE
403 .short 3 # public
404 .short 0 # value
405 .asciz "a"
406
407 # Type 101f, nested enum
408 .enum3:
409 .short .fieldlist7 - .enum3 - 2
410 .short LF_ENUM
411 .short 1 # no. elements
412 .short 0x8 # property (is nested)
413 .long T_UINT4 # underlying type
414 .long 0x101e # field list
415 .asciz "quux::nested_enum"
416 .byte 0xf2 # padding
417 .byte 0xf1 # padding
418
419 # Type 1020, field list for struct quux
420 .fieldlist7:
421 .short .struct4 - .fieldlist7 - 2
422 .short LF_FIELDLIST
423 .short LF_BCLASS
424 .short 0 # attributes
425 .long 0x1013 # base class
426 .short 4 # offset within class
427 .byte 0xf2 # padding
428 .byte 0xf1 # padding
429 .short LF_VFUNCTAB
430 .short 0 # padding
431 .long 0x101d # pointer to vtshape
432 .short LF_VBCLASS
433 .short 0 # attribute
434 .long 0x1013 # type index of direct virtual base class
435 .long 0x101d # type index of virtual base pointer
436 .short 0 # virtual base pointer offset
437 .short 0 # virtual base offset from vbtable
438 .short LF_STMEMBER
439 .short 0 # attribute
440 .long 0x1001 # volatile unsigned long
441 .asciz "static_member"
442 .byte 0xf2 # padding
443 .byte 0xf1 # padding
444 .short LF_NESTTYPE
445 .short 0 # padding
446 .long 0x101f # enum type
447 .asciz "nested_enum"
448
449 # Type 1021, struct quux, field list 1020
450 .struct4:
451 .short .arr2 - .struct4 - 2
452 .short LF_STRUCTURE
453 .short 1 # no. members
454 .short 0 # property
455 .long 0x1020 # field list
456 .long 0 # type derived from
457 .long 0 # type of vshape table
458 .short 4 # size
459 .asciz "quux" # name
460 .byte 0xf1 # padding
461
462 # Type 1022, array[60000] of char
463 .arr2:
464 .short .fieldlist8 - .arr2 - 2
465 .short LF_ARRAY
466 .long T_CHAR # element type
467 .long T_INT4 # index type
468 .short LF_USHORT
469 .short 60000 # size in bytes
470 .byte 0 # name
471 .byte 0xf3 # padding
472 .byte 0xf2 # padding
473 .byte 0xf1 # padding
474
475 # Type 1023, field list for struct longstruct
476 .fieldlist8:
477 .short .struct5 - .fieldlist8 - 2
478 .short LF_FIELDLIST
479 .short LF_MEMBER
480 .short 3 # public
481 .long 0x1022
482 .short 0 # offset
483 .asciz "a"
484 .short LF_MEMBER
485 .short 3 # public
486 .long 0x1022
487 .short LF_USHORT
488 .short 60000 # offset
489 .asciz "b"
490 .byte 0xf2 # padding
491 .byte 0xf1 # padding
492 .short LF_MEMBER
493 .short 3 # public
494 .long 0x1022
495 .short LF_ULONG
496 .long 120000 # offset
497 .asciz "c"
498
499 # Type 1024, struct longstruct
500 .struct5:
501 .short .fieldlist9 - .struct5 - 2
502 .short LF_STRUCTURE
503 .short 3 # no. members
504 .short 0 # property
505 .long 0x1023 # field list
506 .long 0 # type derived from
507 .long 0 # type of vshape table
508 .short LF_ULONG
509 .long 180000 # size
510 .asciz "longstruct" # name
511 .byte 0xf3 # padding
512 .byte 0xf2 # padding
513 .byte 0xf1 # padding
514
515 # Type 1025, field list for union longunion
516 .fieldlist9:
517 .short .union4 - .fieldlist9 - 2
518 .short LF_FIELDLIST
519 .short LF_MEMBER
520 .short 3 # public
521 .long 0x1022
522 .short 0 # offset
523 .asciz "a"
524 .short LF_MEMBER
525 .short 3 # public
526 .long 0x1022
527 .short 0 # offset
528 .asciz "b"
529
530 # Type 1026, union longunion (field list 1025)
531 .union4:
532 .short .fieldlist10 - .union4 - 2
533 .short LF_UNION
534 .short 2 # no. members
535 .short 0 # property
536 .long 0x1025 # field list
537 .short LF_USHORT
538 .short 60000 # size
539 .asciz "longunion"
540 .byte 0xf2 # padding
541 .byte 0xf1 # padding
542
543 # Type 1027, field list with base class longstruct
544 .fieldlist10:
545 .short .fieldlist11 - .fieldlist10 - 2
546 .short LF_FIELDLIST
547 .short LF_BCLASS
548 .short 0 # attributes
549 .long 0x1024 # base class
550 .short LF_ULONG
551 .long 120000 # offset within class
552 .byte 0xf2 # padding
553 .byte 0xf1 # padding
554 .short LF_MEMBER
555 .short 3 # public
556 .long 0x1022
557 .short 0 # offset
558 .asciz "d"
559
560 # Type 1028, field list with virtual base class longstruct
561 .fieldlist11:
562 .short .types_end - .fieldlist11 - 2
563 .short LF_FIELDLIST
564 .short LF_VBCLASS
565 .short 0 # attributes
566 .long 0x1024 # type index of direct virtual base class
567 .long 0 # type index of virtual base pointer
568 .short LF_USHORT
569 .short 60000 # virtual base pointer offset
570 .short LF_ULONG
571 .long 120000 # virtual base offset from vbtable
572 .byte 0xf2 # padding
573 .byte 0xf1 # padding
574 .short LF_MEMBER
575 .short 3 # public
576 .long 0x1022
577 .short 0 # offset
578 .asciz "d"
579
580 .types_end: