208 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o3# RUN: ld.lld --gdb-index %t1.o -o %t 2>&1 | FileCheck --check-prefix=LLD %s4# RUN: llvm-dwarfdump -gdb-index %t | FileCheck %s5 6# FIXME: Remove this once lld correctly returns non-zero on errors like this7# There's no other behavior to test hidden behind this error - lld only parses8# the CU for the address ranges, it doesn't need to decode any strings.9# LLD-NOT: error:10 11## The code contains DWARF v5 sections .debug_rnglists and .debug_addr.12## Check we are able to build the correct address13## area using address range lists.14 15# CHECK: .gdb_index contents:16# CHECK: Address area offset = 0x28, has 2 entries:17# CHECK-NEXT: Low/High address = [0x201120, 0x201121) (Size: 0x1), CU id = 018# CHECK-NEXT: Low/High address = [0x201121, 0x201123) (Size: 0x2), CU id = 019 20.text21.section .text._Z3zedv,"ax",@progbits22.Lfunc_begin0:23 retq24.Lfunc_end0:25 26.section .text.main,"ax",@progbits27.Lfunc_begin1:28 retq29 retq30.Lfunc_end1:31 32.section .debug_str_offsets,"",@progbits33.long 3234.short 535.short 036.Lstr_offsets_base0:37 .long .Linfo_string038 .long .Linfo_string039 .long .Linfo_string040 .long .Linfo_string041 .long .Linfo_string042 .long .Linfo_string043 .long .Linfo_string044 45.section .debug_str,"MS",@progbits,146.Linfo_string0:47 .asciz "stub"48 49.section .debug_abbrev,"",@progbits50 .byte 1 # Abbreviation Code51 .byte 17 # DW_TAG_compile_unit52 .byte 1 # DW_CHILDREN_yes53 .byte 37 # DW_AT_producer54 .byte 37 # DW_FORM_strx155 .byte 19 # DW_AT_language56 .byte 5 # DW_FORM_data257 .byte 3 # DW_AT_name58 .byte 37 # DW_FORM_strx159 .byte 114 # DW_AT_str_offsets_base60 .byte 23 # DW_FORM_sec_offset61 .byte 16 # DW_AT_stmt_list62 .byte 23 # DW_FORM_sec_offset63 .byte 27 # DW_AT_comp_dir64 .byte 37 # DW_FORM_strx165 .byte 115 # DW_AT_addr_base66 .byte 23 # DW_FORM_sec_offset67 .byte 17 # DW_AT_low_pc68 .byte 1 # DW_FORM_addr69 .byte 85 # DW_AT_ranges70 .byte 35 # DW_FORM_rnglistx71 .byte 116 # DW_AT_rnglists_base72 .byte 23 # DW_FORM_sec_offset73 .byte 0 # EOM(1)74 .byte 0 # EOM(2)75 .byte 2 # Abbreviation Code76 .byte 46 # DW_TAG_subprogram77 .byte 0 # DW_CHILDREN_no78 .byte 17 # DW_AT_low_pc79 .byte 27 # DW_FORM_addrx80 .byte 18 # DW_AT_high_pc81 .byte 6 # DW_FORM_data482 .byte 64 # DW_AT_frame_base83 .byte 24 # DW_FORM_exprloc84 .byte 110 # DW_AT_linkage_name85 .byte 37 # DW_FORM_strx186 .byte 3 # DW_AT_name87 .byte 37 # DW_FORM_strx188 .byte 58 # DW_AT_decl_file89 .byte 11 # DW_FORM_data190 .byte 59 # DW_AT_decl_line91 .byte 11 # DW_FORM_data192 .byte 73 # DW_AT_type93 .byte 19 # DW_FORM_ref494 .byte 63 # DW_AT_external95 .byte 25 # DW_FORM_flag_present96 .byte 0 # EOM(1)97 .byte 0 # EOM(2)98 .byte 3 # Abbreviation Code99 .byte 46 # DW_TAG_subprogram100 .byte 0 # DW_CHILDREN_no101 .byte 17 # DW_AT_low_pc102 .byte 27 # DW_FORM_addrx103 .byte 18 # DW_AT_high_pc104 .byte 6 # DW_FORM_data4105 .byte 64 # DW_AT_frame_base106 .byte 24 # DW_FORM_exprloc107 .byte 3 # DW_AT_name108 .byte 37 # DW_FORM_strx1109 .byte 58 # DW_AT_decl_file110 .byte 11 # DW_FORM_data1111 .byte 59 # DW_AT_decl_line112 .byte 11 # DW_FORM_data1113 .byte 73 # DW_AT_type114 .byte 19 # DW_FORM_ref4115 .byte 63 # DW_AT_external116 .byte 25 # DW_FORM_flag_present117 .byte 0 # EOM(1)118 .byte 0 # EOM(2)119 .byte 4 # Abbreviation Code120 .byte 36 # DW_TAG_base_type121 .byte 0 # DW_CHILDREN_no122 .byte 3 # DW_AT_name123 .byte 37 # DW_FORM_strx1124 .byte 62 # DW_AT_encoding125 .byte 11 # DW_FORM_data1126 .byte 11 # DW_AT_byte_size127 .byte 11 # DW_FORM_data1128 .byte 0 # EOM(1)129 .byte 0 # EOM(2)130 .byte 0 # EOM(3)131 132.section .debug_info,"",@progbits133.Lcu_begin0:134 .long 75 # Length of Unit135 .short 5 # DWARF version number136 .byte 1 # DWARF Unit Type137 .byte 8 # Address Size (in bytes)138 .long .debug_abbrev # Offset Into Abbrev. Section139 140 .byte 1 # Abbrev [1] 0xc:0x43 DW_TAG_compile_unit141 .byte 0 # DW_AT_producer142 .short 4 # DW_AT_language143 .byte 1 # DW_AT_name144 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base145 .long 0 # DW_AT_stmt_list146 .byte 2 # DW_AT_comp_dir147 .long .Laddr_table_base0 # DW_AT_addr_base148 .quad 0 # DW_AT_low_pc149 .byte 0 # DW_AT_ranges150 .long .Lrnglists_table_base0 # DW_AT_rnglists_base151 152 .byte 2 # Abbrev [2] 0x2b:0x10 DW_TAG_subprogram153 .byte 0 # DW_AT_low_pc154 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc155 .byte 1 # DW_AT_frame_base156 .byte 86157 .byte 3 # DW_AT_linkage_name158 .byte 4 # DW_AT_name159 .byte 1 # DW_AT_decl_file160 .byte 1 # DW_AT_decl_line161 .long 74 # DW_AT_type162 # DW_AT_external163 164 .byte 3 # Abbrev [3] 0x3b:0xf DW_TAG_subprogram165 .byte 1 # DW_AT_low_pc166 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc167 .byte 1 # DW_AT_frame_base168 .byte 86169 .byte 6 # DW_AT_name170 .byte 1 # DW_AT_decl_file171 .byte 5 # DW_AT_decl_line172 .long 74 # DW_AT_type173 # DW_AT_external174 175 .byte 4 # Abbrev [4] 0x4a:0x4 DW_TAG_base_type176 .byte 5 # DW_AT_name177 .byte 5 # DW_AT_encoding178 .byte 4 # DW_AT_byte_size179 .byte 0 # End Of Children Mark180 181.section .debug_rnglists,"",@progbits182.long .Ldebug_rnglist_table_end0-.Ldebug_rnglist_table_start0 # Length183.Ldebug_rnglist_table_start0: 184 .short 5 # Version185 .byte 8 # Address size186 .byte 0 # Segment selector size187 .long 1 # Offset entry count188.Lrnglists_table_base0:189 .long .Ldebug_ranges0-.Lrnglists_table_base0190.Ldebug_ranges0:191 .byte 3 # DW_RLE_startx_length192 .byte 0 # start index193 .uleb128 .Lfunc_end0-.Lfunc_begin0 # length194 .byte 3 # DW_RLE_startx_length195 .byte 1 # start index196 .uleb128 .Lfunc_end1-.Lfunc_begin1 # length197 .byte 0 # DW_RLE_end_of_list198.Ldebug_rnglist_table_end0:199 200.section .debug_addr,"",@progbits201 .long 20202 .short 5203 .byte 8204 .byte 0205.Laddr_table_base0:206 .quad .Lfunc_begin0207 .quad .Lfunc_begin1208