1## The test checks that ranges for compile units in package files are read
2## correctly, i.e. the base offset in the index section is taken into account.
3
4# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o - | \
5# RUN:   llvm-dwarfdump -v -debug-info -debug-rnglists - | \
6# RUN:   FileCheck %s
7
8# CHECK:      .debug_info.dwo contents:
9# CHECK:      Compile Unit:
10# CHECK:      DW_TAG_compile_unit [1]
11# CHECK-NEXT:   DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1) rangelist = 0x00000022
12# CHECK-NEXT:     [0x00000005, 0x0000000f))
13
14# CHECK:      .debug_rnglists.dwo contents:
15# CHECK:      0x00000000: range list header:
16# CHECK:      0x0000000d: range list header:
17# CHECK-NEXT: offsets: [
18# CHECK-NEXT: 0x00000008 => 0x00000021
19# CHECK-NEXT: 0x00000009 => 0x00000022
20# CHECK-NEXT: ]
21# CHECK-NEXT: ranges:
22# CHECK-NEXT: 0x00000021: [DW_RLE_end_of_list]
23# CHECK-NEXT: 0x00000022: [DW_RLE_offset_pair]:  0x00000005, 0x0000000f => [0x00000005, 0x0000000f)
24# CHECK-NEXT: 0x00000025: [DW_RLE_end_of_list]
25
26    .section .debug_abbrev.dwo, "e", @progbits
27.LAbbrev:
28    .byte 0x01                          # Abbrev code
29    .byte 0x11                          # DW_TAG_compile_unit
30    .byte 0x00                          # DW_CHILDREN_no
31    .byte 0x55                          # DW_AT_ranges
32    .byte 0x23                          # DW_FORM_rnglistx
33    .byte 0x00                          # EOM(1)
34    .byte 0x00                          # EOM(2)
35    .byte 0x00                          # EOM(3)
36.LAbbrevEnd:
37
38    .section .debug_info.dwo, "e", @progbits
39.LCU:
40    .long .LCUEnd-.LCUVersion           # Length
41.LCUVersion:
42    .short 5                            # Version
43    .byte 5                             # DW_UT_split_compile
44    .byte 4                             # Address Size (in bytes)
45    .long 0                             # Offset Into Abbrev Section
46    .quad 0x1100001122222222            # DWO id
47    .uleb128 1                          # Abbrev [1] DW_TAG_compile_unit
48    .uleb128 1                          # DW_AT_ranges (DW_FORM_rnglistx)
49.LCUEnd:
50
51    .section .debug_rnglists.dwo,"e",@progbits
52.LRLT0:
53    .long .LRLT0End-.LRLT0Version       # Length
54.LRLT0Version:
55    .short 5
56    .byte 4
57    .byte 0
58    .long 0
59.LRLT0List0:
60    .byte 0                             # DW_RLE_end_of_list
61.LRLT0End:
62
63.LRLT1:
64    .long .LRLT1End-.LRLT1Version
65.LRLT1Version:
66    .short 5                            # Version
67    .byte 4                             # Address size
68    .byte 0                             # Segment selector size
69    .long 2                             # Offset entry count
70.LRLT1Base:
71    .long .LRLT1List0-.LRLT1Base
72    .long .LRLT1List1-.LRLT1Base
73.LRLT1List0:
74    .byte 0                             # DW_RLE_end_of_list
75.LRLT1List1:
76    .byte 4                             # DW_RLE_offset_pair
77    .uleb128 5                          # Starting offset
78    .uleb128 15                         # Ending offset
79    .byte 0                             # DW_RLE_end_of_list
80.LRLT1End:
81
82    .section .debug_cu_index, "", @progbits
83## Header:
84    .short 5                            # Version
85    .space 2                            # Padding
86    .long 3                             # Section count
87    .long 1                             # Unit count
88    .long 2                             # Slot count
89## Hash Table of Signatures:
90    .quad 0x1100001122222222
91    .quad 0
92## Parallel Table of Indexes:
93    .long 1
94    .long 0
95## Table of Section Offsets:
96## Row 0:
97    .long 1                             # DW_SECT_INFO
98    .long 3                             # DW_SECT_ABBREV
99    .long 8                             # DW_SECT_RNGLISTS
100## Row 1:
101    .long 0                             # Offset in .debug_info.dwo
102    .long 0                             # Offset in .debug_abbrev.dwo
103    .long .LRLT1-.debug_rnglists.dwo    # Offset in .debug_rnglists.dwo
104## Table of Section Sizes:
105    .long .LCUEnd-.LCU                  # Size in .debug_info.dwo
106    .long .LAbbrevEnd-.LAbbrev          # Size in .debug_abbrev.dwo
107    .long .LRLT1End-.LRLT1              # Size in .debug_rnglists.dwo
108