177 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o3# RUN: not ld.lld %t.o %t.o -o /dev/null 2>&1 | FileCheck %s4 5## Check we can report the locations of 2 different "bar" variables.6# CHECK: duplicate symbol: A::bar7# CHECK-NEXT: >>> defined at 1.cpp:28# CHECK-NEXT: >>> {{.*}}:(A::bar)9# CHECK-NEXT: >>> defined at 1.cpp:210# CHECK-NEXT: >>> {{.*}}:(.bss+0x0)11# CHECK: duplicate symbol: Z::bar12# CHECK-NEXT: >>> defined at 1.cpp:613# CHECK-NEXT: >>> {{.*}}:(Z::bar)14# CHECK-NEXT: >>> defined at 1.cpp:615# CHECK-NEXT: >>> {{.*}}:(.data+0x0)16 17# Used reduced output from following code and clang version 7.0.0 (trunk 332701)18# to produce this input file:19# Source (1.cpp):20# namespace A {21# int bar;22# }23# 24# namespace Z {25# int bar;26# }27# Invocation: clang-7 -g -S 1.cpp28 29.text30.file "1.cpp"31.file 1 "/path" "1.cpp"32 33.type _ZN1A3barE,@object34.bss35.globl _ZN1A3barE36_ZN1A3barE:37 .long 038 .size _ZN1A3barE, 439 40.type _ZN1Z3barE,@object41.data42.globl _ZN1Z3barE43_ZN1Z3barE:44 .long 145 .size _ZN1Z3barE, 446 47.section .debug_str,"MS",@progbits,148.Linfo_string0:49 .asciz "clang version 7.0.0 (trunk 332701)" # string offset=050.Linfo_string1:51 .asciz "1.cpp" # string offset=3552.Linfo_string2:53 .asciz "/path" # string offset=4154.Linfo_string3:55 .asciz "A" # string offset=8756.Linfo_string4:57 .asciz "bar" # string offset=8958.Linfo_string5:59 .asciz "int" # string offset=9360.Linfo_string6:61 .asciz "_ZN1A3barE" # string offset=9762.Linfo_string7:63 .asciz "Z" # string offset=10864.Linfo_string8:65 .asciz "_ZN1Z3barE" # string offset=11066 67.section .debug_abbrev,"",@progbits68 .byte 1 # Abbreviation Code69 .byte 17 # DW_TAG_compile_unit70 .byte 1 # DW_CHILDREN_yes71 .byte 37 # DW_AT_producer72 .byte 14 # DW_FORM_strp73 .byte 19 # DW_AT_language74 .byte 5 # DW_FORM_data275 .byte 3 # DW_AT_name76 .byte 14 # DW_FORM_strp77 .byte 16 # DW_AT_stmt_list78 .byte 23 # DW_FORM_sec_offset79 .byte 27 # DW_AT_comp_dir80 .byte 14 # DW_FORM_strp81 .ascii "\264B" # DW_AT_GNU_pubnames82 .byte 25 # DW_FORM_flag_present83 .byte 0 # EOM(1)84 .byte 0 # EOM(2)85 86 .byte 2 # Abbreviation Code87 .byte 57 # DW_TAG_namespace88 .byte 1 # DW_CHILDREN_yes89 .byte 3 # DW_AT_name90 .byte 14 # DW_FORM_strp91 .byte 0 # EOM(1)92 .byte 0 # EOM(2)93 94 .byte 3 # Abbreviation Code95 .byte 52 # DW_TAG_variable96 .byte 0 # DW_CHILDREN_no97 .byte 3 # DW_AT_name98 .byte 14 # DW_FORM_strp99 .byte 73 # DW_AT_type100 .byte 19 # DW_FORM_ref4101 .byte 63 # DW_AT_external102 .byte 25 # DW_FORM_flag_present103 .byte 58 # DW_AT_decl_file104 .byte 11 # DW_FORM_data1105 .byte 59 # DW_AT_decl_line106 .byte 11 # DW_FORM_data1107 .byte 2 # DW_AT_location108 .byte 24 # DW_FORM_exprloc109 .byte 110 # DW_AT_linkage_name110 .byte 14 # DW_FORM_strp111 .byte 0 # EOM(1)112 .byte 0 # EOM(2)113 114 .byte 4 # Abbreviation Code115 .byte 36 # DW_TAG_base_type116 .byte 0 # DW_CHILDREN_no117 .byte 3 # DW_AT_name118 .byte 14 # DW_FORM_strp119 .byte 62 # DW_AT_encoding120 .byte 11 # DW_FORM_data1121 .byte 11 # DW_AT_byte_size122 .byte 11 # DW_FORM_data1123 .byte 0 # EOM(1)124 .byte 0 # EOM(2)125 .byte 0 # EOM(3)126 127 .section .debug_info,"",@progbits128 .long 96 # Length of Unit129 .short 4 # DWARF version number130 .long .debug_abbrev # Offset Into Abbrev. Section131 .byte 8 # Address Size (in bytes)132 133 .byte 1 # Abbrev [1] 0xb:0x59 DW_TAG_compile_unit134 .long .Linfo_string0 # DW_AT_producer135 .short 4 # DW_AT_language136 .long .Linfo_string1 # DW_AT_name137 .long 0 # DW_AT_stmt_list138 .long .Linfo_string2 # DW_AT_comp_dir139 # DW_AT_GNU_pubnames140 141 .byte 2 # Abbrev [2] 0x1e:0x1f DW_TAG_namespace142 .long .Linfo_string3 # DW_AT_name143 144 .byte 3 # Abbrev [3] 0x23:0x19 DW_TAG_variable145 .long .Linfo_string4 # DW_AT_name146 .long 61 # DW_AT_type147 # DW_AT_external148 .byte 1 # DW_AT_decl_file149 .byte 2 # DW_AT_decl_line150 .byte 9 # DW_AT_location151 .byte 3152 .quad _ZN1A3barE153 .long .Linfo_string6 # DW_AT_linkage_name154 .byte 0 # End Of Children Mark155 156 .byte 4 # Abbrev [4] 0x3d:0x7 DW_TAG_base_type157 .long .Linfo_string5 # DW_AT_name158 .byte 5 # DW_AT_encoding159 .byte 4 # DW_AT_byte_size160 161 .byte 2 # Abbrev [2] 0x44:0x1f DW_TAG_namespace162 .long .Linfo_string7 # DW_AT_name163 164 .byte 3 # Abbrev [3] 0x49:0x19 DW_TAG_variable165 .long .Linfo_string4 # DW_AT_name166 .long 61 # DW_AT_type167 # DW_AT_external168 .byte 1 # DW_AT_decl_file169 .byte 6 # DW_AT_decl_line170 .byte 9 # DW_AT_location171 .byte 3172 .quad _ZN1Z3barE173 .long .Linfo_string8 # DW_AT_linkage_name174 175 .byte 0 # End Of Children Mark176 .byte 0 # End Of Children Mark177