1# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o - | \
2# RUN:  llvm-dwarfdump -debug-aranges - 2>&1 | \
3# RUN:  FileCheck %s
4
5    .section .debug_aranges,"",@progbits
6# CHECK: .debug_aranges contents:
7
8## Case 1: Check that an empty set of ranges is supported.
9    .long   .L1end - .L1version     # Length
10# CHECK: Address Range Header: length = 0x00000014,
11.L1version:
12    .short  2                       # Version
13    .long   0x3456789a              # Debug Info Offset
14    .byte   4                       # Address Size
15    .byte   0                       # Segment Selector Size
16# CHECK-SAME: version = 0x0002,
17# CHECK-SAME: cu_offset = 0x3456789a,
18# CHECK-SAME: addr_size = 0x04,
19# CHECK-SAME: seg_size = 0x00
20    .space 4                        # Padding
21.L1tuples:
22    .long   0, 0                    # Termination tuple
23# CHECK-NOT: [0x
24.L1end:
25
26## Case 2: Check that the address size of 4 is supported.
27    .long   .L2end - .L2version     # Length
28# CHECK: Address Range Header: length = 0x0000001c,
29.L2version:
30    .short  2                       # Version
31    .long   0x112233                # Debug Info Offset
32    .byte   4                       # Address Size
33    .byte   0                       # Segment Selector Size
34# CHECK-SAME: version = 0x0002,
35# CHECK-SAME: cu_offset = 0x00112233,
36# CHECK-SAME: addr_size = 0x04,
37# CHECK-SAME: seg_size = 0x00
38    .space  4                       # Padding
39.L2tuples:
40    .long   0x11223344, 0x01020304  # Address and length
41# CHECK-NEXT: [0x11223344,  0x12243648)
42    .long   0, 0                    # Termination tuple
43# CHECK-NOT: [0x
44.L2end:
45
46## Case 3: Check that the address size of 8 is also supported.
47    .long   .L3end - .L3version     # Length
48# CHECK: Address Range Header: length = 0x0000002c,
49.L3version:
50    .short  2                       # Version
51    .long   0x112233                # Debug Info Offset
52    .byte   8                       # Address Size
53    .byte   0                       # Segment Selector Size
54# CHECK-SAME: version = 0x0002,
55# CHECK-SAME: cu_offset = 0x00112233,
56# CHECK-SAME: addr_size = 0x08,
57# CHECK-SAME: seg_size = 0x00
58    .space  4                       # Padding
59.L3tuples:
60    .quad   0x1122334455667788      # Address
61    .quad   0x0102030405060708      # Length
62# CHECK-NEXT: [0x1122334455667788,  0x122436485a6c7e90)
63    .quad   0, 0                    # Termination tuple
64# CHECK-NOT: [0x
65.L3end:
66
67## Case 4: Check that 64-bit DWARF format is supported.
68    .long 0xffffffff                # DWARF64 mark
69    .quad   .L4end - .L4version     # Length
70# CHECK: Address Range Header: length = 0x000000000000001c,
71# CHECK-SAME: format = DWARF64,
72.L4version:
73    .short  2                       # Version
74    .quad   0x123456789abc          # Debug Info Offset
75    .byte   4                       # Address Size
76    .byte   0                       # Segment Selector Size
77# CHECK-SAME: version = 0x0002,
78# CHECK-SAME: cu_offset = 0x0000123456789abc,
79# CHECK-SAME: addr_size = 0x04,
80# CHECK-SAME: seg_size = 0x00
81                                    # No padding
82.L4tuples:
83    .long   0, 1                    # Address and length
84# CHECK-NEXT: [0x00000000,  0x00000001)
85    .long   0, 0                    # Termination tuple
86# CHECK-NOT: [0x
87.L4end:
88