1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
3# RUN: ld.lld --gdb-index %t1.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 2 entries:
8# CHECK-NEXT:  Low/High address = [0x201120, 0x201121) (Size: 0x1), CU id = 0
9# CHECK-NEXT:  Low/High address = [0x201123, 0x201126) (Size: 0x3), CU id = 0
10
11.text
12.globl foo
13.type foo,@function
14foo:
15.Lfunc_begin0:
16  nop
17.Ltmp0:
18  nop
19  nop
20.Ltmp1:
21  nop
22  nop
23  nop
24.Ltmp2:
25
26.section .debug_abbrev,"",@progbits
27.byte 1                       # Abbreviation Code
28.byte 17                      # DW_TAG_compile_unit
29.byte 0                       # DW_CHILDREN_no
30.byte 37                      # DW_AT_producer
31.byte 14                      # DW_FORM_strp
32.byte 19                      # DW_AT_language
33.byte 5                       # DW_FORM_data2
34.byte 3                       # DW_AT_name
35.byte 14                      # DW_FORM_strp
36.byte 16                      # DW_AT_stmt_list
37.byte 23                      # DW_FORM_sec_offset
38.byte 27                      # DW_AT_comp_dir
39.byte 14                      # DW_FORM_strp
40.byte 17                      # DW_AT_low_pc
41.byte 1                       # DW_FORM_addr
42.byte 85                      # DW_AT_ranges
43.byte 23                      # DW_FORM_sec_offset
44.byte 0                       # EOM(1)
45.byte 0                       # EOM(2)
46.byte 0                       # EOM(3)
47
48.section .debug_info,"",@progbits
49.Lcu_begin0:
50.long 38                      # Length of Unit
51.short 4                      # DWARF version number
52.long .debug_abbrev           # Offset Into Abbrev. Section
53.byte 8                       # Address Size (in bytes)
54.byte 1                       # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit
55.long 0                       # DW_AT_producer
56.short 4                      # DW_AT_language
57.long 0                       # DW_AT_name
58.long 0                       # DW_AT_stmt_list
59.long 0                       # DW_AT_comp_dir
60.quad .Lfunc_begin0           # DW_AT_low_pc
61.long .Ldebug_ranges0         # DW_AT_ranges
62
63.section .debug_ranges,"",@progbits
64.Ldebug_ranges0:
65 .quad .Lfunc_begin0-.Lfunc_begin0
66 .quad .Ltmp0-.Lfunc_begin0
67 .quad .Ltmp1-.Lfunc_begin0
68 .quad .Ltmp2-.Lfunc_begin0
69 .quad 0
70 .quad 0
71