1# RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %s -o %t
2# RUN: llvm-dwarfdump -v %t | FileCheck %s
3
4# CHECK: .debug_info contents:
5# CHECK: DW_TAG_compile_unit
6# CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
7# CHECK-NEXT:  [0x0000000000000000, 0x0000000000000001) ".text.foo1"
8# CHECK-NEXT:  [0x0000000000000000, 0x0000000000000002) ".text.foo2" [4]
9# CHECK-NEXT:  [0x0000000000000000, 0x0000000000000003) ".text.foo2" [5])
10
11# CHECK: .debug_ranges contents:
12# CHECK:   00000000 0000000000000000 0000000000000001
13# CHECK:   00000000 0000000000000000 0000000000000002
14# CHECK:   00000000 0000000000000000 0000000000000003
15# CHECK:   00000000 <End of list>
16
17# RUN: llvm-dwarfdump %t | FileCheck %s --check-prefix=BRIEF
18# BRIEF: DW_TAG_compile_unit
19# BRIEF: DW_AT_ranges         (0x00000000
20# BRIEF-NEXT:  [0x0000000000000000, 0x0000000000000001)
21# BRIEF-NEXT:  [0x0000000000000000, 0x0000000000000002)
22# BRIEF-NEXT:  [0x0000000000000000, 0x0000000000000003))
23
24## Asm code for testcase is a reduced and modified output from next
25## invocation and source:
26# clang test.cpp -S -o test.s -gmlt -ffunction-sections
27# test.cpp:
28#   void foo1() { }
29#   void foo2() { }
30
31.section .text.foo1,"ax",@progbits
32.Lfunc_begin0:
33 nop
34.Lfunc_end0:
35
36.section .text.foo2,"ax",@progbits, unique, 1
37.Lfunc_begin1:
38 nop
39 nop
40.Lfunc_end1:
41
42.section .text.foo2,"ax",@progbits, unique, 2
43.Lfunc_begin2:
44 nop
45 nop
46 nop
47.Lfunc_end2:
48
49.section .debug_abbrev,"",@progbits
50.byte 1                       # Abbreviation Code
51.byte 17                      # DW_TAG_compile_unit
52.byte 0                       # DW_CHILDREN_no
53.byte 37                      # DW_AT_producer
54.byte 14                      # DW_FORM_strp
55.byte 19                      # DW_AT_language
56.byte 5                       # DW_FORM_data2
57.byte 3                       # DW_AT_name
58.byte 14                      # DW_FORM_strp
59.byte 16                      # DW_AT_stmt_list
60.byte 23                      # DW_FORM_sec_offset
61.byte 27                      # DW_AT_comp_dir
62.byte 14                      # DW_FORM_strp
63.byte 17                      # DW_AT_low_pc
64.byte 1                       # DW_FORM_addr
65.byte 85                      # DW_AT_ranges
66.byte 23                      # DW_FORM_sec_offset
67.byte 0                       # EOM(1)
68.byte 0                       # EOM(2)
69.byte 0                       # EOM(3)
70
71.section .debug_info,"",@progbits
72.Lcu_begin0:
73.long 38                      # Length of Unit
74.short 4                      # DWARF version number
75.long .debug_abbrev           # Offset Into Abbrev. Section
76.byte 8                       # Address Size (in bytes)
77.byte 1                       # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit
78.long 0                       # DW_AT_producer
79.short 4                      # DW_AT_language
80.long 0                       # DW_AT_name
81.long 0                       # DW_AT_stmt_list
82.long 0                       # DW_AT_comp_dir
83.quad 0                       # DW_AT_low_pc
84.long .Ldebug_ranges0         # DW_AT_ranges
85
86.section .debug_ranges,"",@progbits
87.Ldebug_ranges0:
88.quad .Lfunc_begin0
89.quad .Lfunc_end0
90.quad .Lfunc_begin1
91.quad .Lfunc_end1
92.quad .Lfunc_begin2
93.quad .Lfunc_end2
94.quad 0
95.quad 0
96