1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o 3# RUN: not ld.lld %t.o %t.o -o /dev/null 2>&1 | FileCheck %s 4 5## Check we can report the locations of 2 different "bar" variables. 6# CHECK: duplicate symbol: A::bar 7# CHECK-NEXT: >>> defined at 1.cpp:2 8# CHECK-NEXT: >>> {{.*}}:(A::bar) 9# CHECK-NEXT: >>> defined at 1.cpp:2 10# CHECK-NEXT: >>> {{.*}}:(.bss+0x0) 11# CHECK: duplicate symbol: Z::bar 12# CHECK-NEXT: >>> defined at 1.cpp:6 13# CHECK-NEXT: >>> {{.*}}:(Z::bar) 14# CHECK-NEXT: >>> defined at 1.cpp:6 15# 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.cpp 28 29.text 30.file "1.cpp" 31.file 1 "/path" "1.cpp" 32 33.type _ZN1A3barE,@object 34.bss 35.globl _ZN1A3barE 36_ZN1A3barE: 37 .long 0 38 .size _ZN1A3barE, 4 39 40.type _ZN1Z3barE,@object 41.data 42.globl _ZN1Z3barE 43_ZN1Z3barE: 44 .long 1 45 .size _ZN1Z3barE, 4 46 47.section .debug_str,"MS",@progbits,1 48.Linfo_string0: 49 .asciz "clang version 7.0.0 (trunk 332701)" # string offset=0 50.Linfo_string1: 51 .asciz "1.cpp" # string offset=35 52.Linfo_string2: 53 .asciz "/path" # string offset=41 54.Linfo_string3: 55 .asciz "A" # string offset=87 56.Linfo_string4: 57 .asciz "bar" # string offset=89 58.Linfo_string5: 59 .asciz "int" # string offset=93 60.Linfo_string6: 61 .asciz "_ZN1A3barE" # string offset=97 62.Linfo_string7: 63 .asciz "Z" # string offset=108 64.Linfo_string8: 65 .asciz "_ZN1Z3barE" # string offset=110 66 67.section .debug_abbrev,"",@progbits 68 .byte 1 # Abbreviation Code 69 .byte 17 # DW_TAG_compile_unit 70 .byte 1 # DW_CHILDREN_yes 71 .byte 37 # DW_AT_producer 72 .byte 14 # DW_FORM_strp 73 .byte 19 # DW_AT_language 74 .byte 5 # DW_FORM_data2 75 .byte 3 # DW_AT_name 76 .byte 14 # DW_FORM_strp 77 .byte 16 # DW_AT_stmt_list 78 .byte 23 # DW_FORM_sec_offset 79 .byte 27 # DW_AT_comp_dir 80 .byte 14 # DW_FORM_strp 81 .ascii "\264B" # DW_AT_GNU_pubnames 82 .byte 25 # DW_FORM_flag_present 83 .byte 0 # EOM(1) 84 .byte 0 # EOM(2) 85 86 .byte 2 # Abbreviation Code 87 .byte 57 # DW_TAG_namespace 88 .byte 1 # DW_CHILDREN_yes 89 .byte 3 # DW_AT_name 90 .byte 14 # DW_FORM_strp 91 .byte 0 # EOM(1) 92 .byte 0 # EOM(2) 93 94 .byte 3 # Abbreviation Code 95 .byte 52 # DW_TAG_variable 96 .byte 0 # DW_CHILDREN_no 97 .byte 3 # DW_AT_name 98 .byte 14 # DW_FORM_strp 99 .byte 73 # DW_AT_type 100 .byte 19 # DW_FORM_ref4 101 .byte 63 # DW_AT_external 102 .byte 25 # DW_FORM_flag_present 103 .byte 58 # DW_AT_decl_file 104 .byte 11 # DW_FORM_data1 105 .byte 59 # DW_AT_decl_line 106 .byte 11 # DW_FORM_data1 107 .byte 2 # DW_AT_location 108 .byte 24 # DW_FORM_exprloc 109 .byte 110 # DW_AT_linkage_name 110 .byte 14 # DW_FORM_strp 111 .byte 0 # EOM(1) 112 .byte 0 # EOM(2) 113 114 .byte 4 # Abbreviation Code 115 .byte 36 # DW_TAG_base_type 116 .byte 0 # DW_CHILDREN_no 117 .byte 3 # DW_AT_name 118 .byte 14 # DW_FORM_strp 119 .byte 62 # DW_AT_encoding 120 .byte 11 # DW_FORM_data1 121 .byte 11 # DW_AT_byte_size 122 .byte 11 # DW_FORM_data1 123 .byte 0 # EOM(1) 124 .byte 0 # EOM(2) 125 .byte 0 # EOM(3) 126 127 .section .debug_info,"",@progbits 128 .long 96 # Length of Unit 129 .short 4 # DWARF version number 130 .long .debug_abbrev # Offset Into Abbrev. Section 131 .byte 8 # Address Size (in bytes) 132 133 .byte 1 # Abbrev [1] 0xb:0x59 DW_TAG_compile_unit 134 .long .Linfo_string0 # DW_AT_producer 135 .short 4 # DW_AT_language 136 .long .Linfo_string1 # DW_AT_name 137 .long 0 # DW_AT_stmt_list 138 .long .Linfo_string2 # DW_AT_comp_dir 139 # DW_AT_GNU_pubnames 140 141 .byte 2 # Abbrev [2] 0x1e:0x1f DW_TAG_namespace 142 .long .Linfo_string3 # DW_AT_name 143 144 .byte 3 # Abbrev [3] 0x23:0x19 DW_TAG_variable 145 .long .Linfo_string4 # DW_AT_name 146 .long 61 # DW_AT_type 147 # DW_AT_external 148 .byte 1 # DW_AT_decl_file 149 .byte 2 # DW_AT_decl_line 150 .byte 9 # DW_AT_location 151 .byte 3 152 .quad _ZN1A3barE 153 .long .Linfo_string6 # DW_AT_linkage_name 154 .byte 0 # End Of Children Mark 155 156 .byte 4 # Abbrev [4] 0x3d:0x7 DW_TAG_base_type 157 .long .Linfo_string5 # DW_AT_name 158 .byte 5 # DW_AT_encoding 159 .byte 4 # DW_AT_byte_size 160 161 .byte 2 # Abbrev [2] 0x44:0x1f DW_TAG_namespace 162 .long .Linfo_string7 # DW_AT_name 163 164 .byte 3 # Abbrev [3] 0x49:0x19 DW_TAG_variable 165 .long .Linfo_string4 # DW_AT_name 166 .long 61 # DW_AT_type 167 # DW_AT_external 168 .byte 1 # DW_AT_decl_file 169 .byte 6 # DW_AT_decl_line 170 .byte 9 # DW_AT_location 171 .byte 3 172 .quad _ZN1Z3barE 173 .long .Linfo_string8 # DW_AT_linkage_name 174 175 .byte 0 # End Of Children Mark 176 .byte 0 # End Of Children Mark 177