176 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux -dwarf-version=5 %s -o %t.o3# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s4 5# When compiling with -ffunction-sections, .debug_line may contain descriptions6# of locations from the different text sections. Until relocated such7# descriptions might contain overlapping offsets. Check LLD is able to report8# the error locations correctly in this case.9 10# CHECK: error: undefined symbol: foo()11# CHECK-NEXT: >>> referenced by test.cpp:212# CHECK-NEXT: >>> {{.*}}.o:(bar())13# CHECK-NEXT: >>> referenced by test.cpp:314# CHECK-NEXT: >>> {{.*}}.o:(baz())15 16# The code below is the reduced version of the output17# from the following invocation and source:18#19# // test.cpp:20# int foo();21# int bar() { return foo(); }22# int baz() { return foo(); }23#24# clang -gdwarf-5 -ffunction-sections test.cpp -o test.s -S25 26.text27.file "test.cpp"28.section .text._Z3barv,"ax",@progbits29.globl _Z3barv30.type _Z3barv,@function31_Z3barv:32.Lfunc_begin0:33 .file 0 "/path" "test.cpp" md5 0x9ff11a8404ab4d032ee2dd4f5f8c414034 .loc 0 2 0 # test.cpp:2:035 .loc 0 2 20 prologue_end # test.cpp:2:2036 callq _Z3foov37 .loc 0 2 13 is_stmt 0 # test.cpp:2:1338.Lfunc_end0:39.size _Z3barv, .Lfunc_end0-_Z3barv40 # -- End function41.section .text._Z3bazv,"ax",@progbits42.globl _Z3bazv # -- Begin function _Z3bazv43 .type _Z3bazv,@function44_Z3bazv: # @_Z3bazv45.Lfunc_begin1:46 .loc 0 3 0 is_stmt 1 # test.cpp:3:047 .loc 0 3 20 prologue_end # test.cpp:3:2048 callq _Z3foov49 .loc 0 3 13 is_stmt 0 # test.cpp:3:1350.Lfunc_end1:51 .size _Z3bazv, .Lfunc_end1-_Z3bazv52 53.section .debug_str,"MS",@progbits,154.Linfo_string0:55 .asciz "stub"56 57.section .debug_str_offsets,"",@progbits58 .long 859 .short 560 .short 061.Lstr_offsets_base0:62 .long .Linfo_string063 64.section .debug_abbrev,"",@progbits65 .byte 1 # Abbreviation Code66 .byte 17 # DW_TAG_compile_unit67 .byte 1 # DW_CHILDREN_yes68 .byte 37 # DW_AT_producer69 .byte 37 # DW_FORM_strx170 .byte 19 # DW_AT_language71 .byte 5 # DW_FORM_data272 .byte 3 # DW_AT_name73 .byte 37 # DW_FORM_strx174 .byte 114 # DW_AT_str_offsets_base75 .byte 23 # DW_FORM_sec_offset76 .byte 16 # DW_AT_stmt_list77 .byte 23 # DW_FORM_sec_offset78 .byte 27 # DW_AT_comp_dir79 .byte 37 # DW_FORM_strx180 .byte 115 # DW_AT_addr_base81 .byte 23 # DW_FORM_sec_offset82 .byte 17 # DW_AT_low_pc83 .byte 1 # DW_FORM_addr84 .byte 85 # DW_AT_ranges85 .byte 35 # DW_FORM_rnglistx86 .byte 116 # DW_AT_rnglists_base87 .byte 23 # DW_FORM_sec_offset88 .byte 0 # EOM(1)89 .byte 0 # EOM(2)90 .byte 2 # Abbreviation Code91 .byte 46 # DW_TAG_subprogram92 .byte 0 # DW_CHILDREN_no93 .byte 17 # DW_AT_low_pc94 .byte 27 # DW_FORM_addrx95 .byte 18 # DW_AT_high_pc96 .byte 6 # DW_FORM_data497 .byte 64 # DW_AT_frame_base98 .byte 24 # DW_FORM_exprloc99 .byte 110 # DW_AT_linkage_name100 .byte 37 # DW_FORM_strx1101 .byte 3 # DW_AT_name102 .byte 37 # DW_FORM_strx1103 .byte 58 # DW_AT_decl_file104 .byte 11 # DW_FORM_data1105 .byte 59 # DW_AT_decl_line106 .byte 11 # DW_FORM_data1107 .byte 73 # DW_AT_type108 .byte 19 # DW_FORM_ref4109 .byte 63 # DW_AT_external110 .byte 25 # DW_FORM_flag_present111 .byte 0 # EOM(1)112 .byte 0 # EOM(2)113 .byte 3 # Abbreviation Code114 .byte 36 # DW_TAG_base_type115 .byte 0 # DW_CHILDREN_no116 .byte 3 # DW_AT_name117 .byte 37 # DW_FORM_strx1118 .byte 62 # DW_AT_encoding119 .byte 11 # DW_FORM_data1120 .byte 11 # DW_AT_byte_size121 .byte 11 # DW_FORM_data1122 .byte 0 # EOM(1)123 .byte 0 # EOM(2)124 .byte 0 # EOM(3)125 126.section .debug_info,"",@progbits127.Lcu_begin0:128 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit129.Ldebug_info_start0:130 .short 5 # DWARF version number131 .byte 1 # DWARF Unit Type132 .byte 8 # Address Size (in bytes)133 .long .debug_abbrev # Offset Into Abbrev. Section134 .byte 1 # Abbrev [1] 0xc:0x44 DW_TAG_compile_unit135 .byte 0 # DW_AT_producer136 .short 4 # DW_AT_language137 .byte 0 # DW_AT_name138 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base139 .long .Lline_table_start0 # DW_AT_stmt_list140 .byte 2 # DW_AT_comp_dir141 .long 0 # DW_AT_addr_base142 .quad 0 # DW_AT_low_pc143 .byte 0 # DW_AT_ranges144 .long 0 # DW_AT_rnglists_base145 .byte 2 # Abbrev [2] 0x2b:0x10 DW_TAG_subprogram146 .byte 0 # DW_AT_low_pc147 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc148 .byte 1 # DW_AT_frame_base149 .byte 86150 .byte 3 # DW_AT_linkage_name151 .byte 0 # DW_AT_name152 .byte 1 # DW_AT_decl_file153 .byte 2 # DW_AT_decl_line154 .long 75 # DW_AT_type155 # DW_AT_external156 .byte 2 # Abbrev [2] 0x3b:0x10 DW_TAG_subprogram157 .byte 1 # DW_AT_low_pc158 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc159 .byte 1 # DW_AT_frame_base160 .byte 86161 .byte 6 # DW_AT_linkage_name162 .byte 0 # DW_AT_name163 .byte 1 # DW_AT_decl_file164 .byte 3 # DW_AT_decl_line165 .long 75 # DW_AT_type166 # DW_AT_external167 .byte 3 # Abbrev [3] 0x4b:0x4 DW_TAG_base_type168 .byte 0 # DW_AT_name169 .byte 5 # DW_AT_encoding170 .byte 4 # DW_AT_byte_size171 .byte 0 # End Of Children Mark172.Ldebug_info_end0:173 174.section .debug_line,"",@progbits175.Lline_table_start0:176