xref: /llvm-project/llvm/test/DebugInfo/X86/debug-cu-index-overlap.s (revision 0d8cb8b399adcd17e8bf17be7814d030308c8b82)
1# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o - | \
2# RUN:   not llvm-dwarfdump -debug-cu-index -debug-tu-index --verify - | FileCheck %s
3
4# FIXME: The verifier should probably be handled to verify the hash table
5# itself - in which case this test would need to be updated to have a correct
6# hash table (currently hand crafted with no attempt at correct allocation of
7# hashes to buckets) - and probably to verify that the section ranges apply to
8# sections that exist, which currently they don't
9
10# This tests that an index that describes units as being in overlapping
11# sections is invalid (this was observed in the wild due to overflow due to the
12# 32 bit limit of the indexes (a DWARF spec bug - there should be a 64 bit
13# version of the index format with 64 bit offsets/sizes)) - but Type Units will
14# generally share all the sections other than the info section with each other
15# (and with their originating CU) since the dwo format has no way to describe
16# which part of non-info-section contributions are used by which units, so
17# they're all shared. So demonstrate that the TU index ignores non-info overlap,
18# but the CU index diagnoses such overlap (in the abbrev section, in this case)
19
20# This doesn't currently check for info section overlap between the CU and TU
21# index, but that could be an extension of this work in the future.
22
23# CHECK: Verifying .debug_cu_index...
24# CHECK: error: overlapping index entries for entries 0x0000000000000001 and 0x0000000000000002 for column DW_SECT_ABBREV
25# CHECK: Verifying .debug_tu_index...
26# CHECK: error: overlapping index entries for entries 0x0000000000000001 and 0x0000000000000003 for column DW_SECT_INFO
27
28    .section .debug_cu_index, "", @progbits
29## Header:
30    .long 5             # Version
31    .long 2             # Section count
32    .long 3             # Unit count
33    .long 4             # Slot count
34## Hash Table of Signatures:
35    .quad 0x0000000000000001
36    .quad 0x0000000000000002
37    .quad 0x0000000000000003
38    .quad 0
39## Parallel Table of Indexes:
40    .long 1
41    .long 2
42    .long 3
43    .long 0
44## Table of Section Offsets:
45## Row 0:
46    .long 1             # DW_SECT_INFO
47    .long 3             # DW_SECT_ABBREV
48## Row 1:
49    .long 0x1           # Offset in .debug_info.dwo
50    .long 0x1           # Offset in .debug_abbrev.dwo
51## Row 2:
52    .long 0x2           # Offset in .debug_info.dwo
53    .long 0x1           # Offset in .debug_abbrev.dwo
54## Row 3:
55    .long 0x1           # Offset in .debug_info.dwo
56    .long 0x1           # Offset in .debug_abbrev.dwo
57## Table of Section Sizes:
58    .long 0x1          # Size in .debug_info.dwo
59    .long 0x1          # Size in .debug_abbrev.dwo
60    .long 0x1          # Size in .debug_info.dwo
61    .long 0x1          # Size in .debug_abbrev.dwo
62    .long 0x1          # Size in .debug_info.dwo
63    .long 0x1          # Size in .debug_abbrev.dwo
64
65    .section .debug_tu_index, "", @progbits
66## Header:
67    .long 5             # Version
68    .long 2             # Section count
69    .long 3             # Unit count
70    .long 4             # Slot count
71## Hash Table of Signatures:
72    .quad 0x0000000000000001
73    .quad 0x0000000000000002
74    .quad 0x0000000000000003
75    .quad 0
76## Parallel Table of Indexes:
77    .long 1
78    .long 2
79    .long 3
80    .long 0
81## Table of Section Offsets:
82## Row 0:
83    .long 1             # DW_SECT_INFO
84    .long 3             # DW_SECT_ABBREV
85## Row 1:
86    .long 0x1           # Offset in .debug_info.dwo
87    .long 0x1           # Offset in .debug_abbrev.dwo
88## Row 2:
89    .long 0x2           # Offset in .debug_info.dwo
90    .long 0x1           # Offset in .debug_abbrev.dwo
91## Row 3:
92    .long 0x1           # Offset in .debug_info.dwo
93    .long 0x1           # Offset in .debug_abbrev.dwo
94## Table of Section Sizes:
95    .long 0x1          # Size in .debug_info.dwo
96    .long 0x1          # Size in .debug_abbrev.dwo
97    .long 0x1          # Size in .debug_info.dwo
98    .long 0x1          # Size in .debug_abbrev.dwo
99    .long 0x1          # Size in .debug_info.dwo
100    .long 0x1          # Size in .debug_abbrev.dwo
101