1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
3# RUN: ld.lld --gdb-index -e main %t.o -o %t
4# RUN: llvm-dwarfdump -gdb-index %t | FileCheck %s
5
6# CHECK:      .gdb_index contents:
7# CHECK:       Address area offset = 0x28, has 1 entries:
8# CHECK-NEXT:    Low/High address = [0x201120, 0x201121) (Size: 0x1), CU id = 0
9
10## .debug_ranges contains 2 entries. .Lfunc_end0 is defined in the discarded
11## .text.foo. Test we resolve it to a non-zero value, otherwise the address area
12## of .gdb_index will not included [.Lfunc_begin1, .Lfunc_end1).
13
14.section .text.foo,"aex",@progbits
15.Lfunc_begin0:
16  ret
17.Lfunc_end0:
18
19.section .text.bar,"ax",@progbits
20.Lfunc_begin1:
21  ret
22.Lfunc_end1:
23
24.section .debug_abbrev,"",@progbits
25  .byte 1         # Abbreviation Code
26  .byte 17        # DW_TAG_compile_unit
27  .byte 0         # DW_CHILDREN_no
28  .byte 85        # DW_AT_ranges
29  .byte 23        # DW_FORM_sec_offset
30  .byte 0         # EOM(1)
31  .byte 0         # EOM(2)
32  .byte 0
33
34.section .debug_info,"",@progbits
35.Lcu_begin0:
36  .long .Lcu_end0 - .Lcu_begin0 - 4
37  .short 4        # DWARF version number
38  .long  0        # Offset Into Abbrev. Section
39  .byte  8        # Address Size
40.Ldie0:
41  .byte  1        # Abbrev [1] DW_TAG_compile_unit
42  .long  0        # DW_AT_ranges
43.Lcu_end0:
44
45.section .debug_ranges,"",@progbits
46  .quad .Lfunc_begin0
47  .quad .Lfunc_end0
48  .quad .Lfunc_begin1
49  .quad .Lfunc_end1
50  .quad 0
51  .quad 0
52