1# REQUIRES: x86 2# RUN: llvm-mc -triple=i686-windows-gnu -filetype=obj -o %t.o %s 3# RUN: cp %t.o %t.dupl.o 4# RUN: not lld-link -lldmingw -out:%t.exe %t.o %t.dupl.o -entry:_Z4funcv 2>&1 | FileCheck %s 5 6# CHECK: error: duplicate symbol: func() 7# CHECK-NEXT: >>> defined at /path/to/src{{[/\\]}}dupl.cpp:6 8# CHECK-NEXT: >>> {{.*}}.o 9# CHECK-NEXT: >>> defined at /path/to/src{{[/\\]}}dupl.cpp:6 10# CHECK-NEXT: >>> {{.*}}.o 11# CHECK-EMPTY: 12# CHECK-NEXT: error: duplicate symbol: _var 13# CHECK-NEXT: >>> defined at /path/to/src{{[/\\]}}dupl.cpp:1 14# CHECK-NEXT: >>> {{.*}}.o 15# CHECK-NEXT: >>> defined at /path/to/src{{[/\\]}}dupl.cpp:1 16# CHECK-NEXT: >>> {{.*}}.o 17# CHECK-EMPTY: 18# CHECK-NEXT: error: duplicate symbol: A::namespaceVar 19# CHECK-NEXT: >>> defined at /path/to/src{{[/\\]}}dupl.cpp:3 20# CHECK-NEXT: >>> {{.*}}.o 21# CHECK-NEXT: >>> defined at /path/to/src{{[/\\]}}dupl.cpp:3 22# CHECK-NEXT: >>> {{.*}}.o 23 24 .text 25 .file "dupl.cpp" 26 .file 1 "/path/to/src" "dupl.cpp" 27 .def __Z4funcv; 28 .globl __Z4funcv # -- Begin function _Z4funcv 29__Z4funcv: # @_Z4funcv 30Lfunc_begin0: 31 .loc 1 5 0 # dupl.cpp:5:0 32# %bb.0: # %entry 33 .loc 1 6 1 prologue_end # dupl.cpp:6:1 34 retl 35Lfunc_end0: 36 # -- End function 37 .bss 38 .globl _var # @var 39_var: 40 .long 0 # 0x0 41 42 .globl __ZN1A12namespaceVarE # @_ZN1A12namespaceVarE 43__ZN1A12namespaceVarE: 44 .long 0 # 0x0 45 46 .section .debug_str,"dr" 47Linfo_string: 48Linfo_string0: 49 .asciz "var" 50Linfo_string1: 51 .asciz "int" 52Linfo_string2: 53 .asciz "A" 54Linfo_string3: 55 .asciz "namespaceVar" 56Linfo_string4: 57 .asciz "_ZN1A12namespaceVarE" 58Linfo_string5: 59 .asciz "_Z4funcv" 60Linfo_string6: 61 .asciz "func" 62 .section .debug_abbrev,"dr" 63Lsection_abbrev: 64 .byte 1 # Abbreviation Code 65 .byte 17 # DW_TAG_compile_unit 66 .byte 1 # DW_CHILDREN_yes 67 .byte 37 # DW_AT_producer 68 .byte 37 # DW_FORM_strx1 69 .byte 19 # DW_AT_language 70 .byte 5 # DW_FORM_data2 71 .byte 3 # DW_AT_name 72 .byte 37 # DW_FORM_strx1 73 .byte 16 # DW_AT_stmt_list 74 .byte 23 # DW_FORM_sec_offset 75 .byte 17 # DW_AT_low_pc 76 .byte 1 # DW_FORM_addr 77 .byte 18 # DW_AT_high_pc 78 .byte 6 # DW_FORM_data4 79 .byte 0 # EOM(1) 80 .byte 0 # EOM(2) 81 .byte 2 # Abbreviation Code 82 .byte 52 # DW_TAG_variable 83 .byte 0 # DW_CHILDREN_no 84 .byte 3 # DW_AT_name 85 .byte 14 # DW_FORM_strp 86 .byte 73 # DW_AT_type 87 .byte 19 # DW_FORM_ref4 88 .byte 63 # DW_AT_external 89 .byte 25 # DW_FORM_flag_present 90 .byte 58 # DW_AT_decl_file 91 .byte 11 # DW_FORM_data1 92 .byte 59 # DW_AT_decl_line 93 .byte 11 # DW_FORM_data1 94 .byte 2 # DW_AT_location 95 .byte 24 # DW_FORM_exprloc 96 .byte 0 # EOM(1) 97 .byte 0 # EOM(2) 98 .byte 3 # Abbreviation Code 99 .byte 36 # DW_TAG_base_type 100 .byte 0 # DW_CHILDREN_no 101 .byte 3 # DW_AT_name 102 .byte 14 # DW_FORM_strp 103 .byte 62 # DW_AT_encoding 104 .byte 11 # DW_FORM_data1 105 .byte 11 # DW_AT_byte_size 106 .byte 11 # DW_FORM_data1 107 .byte 0 # EOM(1) 108 .byte 0 # EOM(2) 109 .byte 4 # Abbreviation Code 110 .byte 57 # DW_TAG_namespace 111 .byte 1 # DW_CHILDREN_yes 112 .byte 3 # DW_AT_name 113 .byte 14 # DW_FORM_strp 114 .byte 0 # EOM(1) 115 .byte 0 # EOM(2) 116 .byte 5 # Abbreviation Code 117 .byte 52 # DW_TAG_variable 118 .byte 0 # DW_CHILDREN_no 119 .byte 3 # DW_AT_name 120 .byte 14 # DW_FORM_strp 121 .byte 73 # DW_AT_type 122 .byte 19 # DW_FORM_ref4 123 .byte 63 # DW_AT_external 124 .byte 25 # DW_FORM_flag_present 125 .byte 58 # DW_AT_decl_file 126 .byte 11 # DW_FORM_data1 127 .byte 59 # DW_AT_decl_line 128 .byte 11 # DW_FORM_data1 129 .byte 2 # DW_AT_location 130 .byte 24 # DW_FORM_exprloc 131 .byte 110 # DW_AT_linkage_name 132 .byte 14 # DW_FORM_strp 133 .byte 0 # EOM(1) 134 .byte 0 # EOM(2) 135 .byte 6 # Abbreviation Code 136 .byte 46 # DW_TAG_subprogram 137 .byte 0 # DW_CHILDREN_no 138 .byte 17 # DW_AT_low_pc 139 .byte 1 # DW_FORM_addr 140 .byte 18 # DW_AT_high_pc 141 .byte 6 # DW_FORM_data4 142 .byte 64 # DW_AT_frame_base 143 .byte 24 # DW_FORM_exprloc 144 .byte 110 # DW_AT_linkage_name 145 .byte 14 # DW_FORM_strp 146 .byte 3 # DW_AT_name 147 .byte 14 # DW_FORM_strp 148 .byte 58 # DW_AT_decl_file 149 .byte 11 # DW_FORM_data1 150 .byte 59 # DW_AT_decl_line 151 .byte 11 # DW_FORM_data1 152 .byte 63 # DW_AT_external 153 .byte 25 # DW_FORM_flag_present 154 .byte 0 # EOM(1) 155 .byte 0 # EOM(2) 156 .byte 0 # EOM(3) 157 .section .debug_info,"dr" 158Lsection_info: 159Lcu_begin0: 160 .long Ldebug_info_end0-Ldebug_info_start0 # Length of Unit 161Ldebug_info_start0: 162 .short 4 # DWARF version number 163 .secrel32 Lsection_abbrev # Offset Into Abbrev. Section 164 .byte 4 # Address Size (in bytes) 165 .byte 1 # Abbrev [1] 0xb:0x64 DW_TAG_compile_unit 166 .byte 0 # DW_AT_producer 167 .short 33 # DW_AT_language 168 .byte 0 # DW_AT_name 169 .secrel32 Lline_table_start0 # DW_AT_stmt_list 170 .long Lfunc_begin0 # DW_AT_low_pc 171 .long Lfunc_end0-Lfunc_begin0 # DW_AT_high_pc 172 .byte 2 # Abbrev [2] 0x26:0x11 DW_TAG_variable 173 .secrel32 Linfo_string0 # DW_AT_name 174 .secrel32 Linfo_type_int # DW_AT_type 175 # DW_AT_external 176 .byte 1 # DW_AT_decl_file 177 .byte 1 # DW_AT_decl_line 178 .byte 5 # DW_AT_location 179 .byte 3 180 .long _var 181Linfo_type_int: 182 .byte 3 # Abbrev [3] 0x37:0x7 DW_TAG_base_type 183 .secrel32 Linfo_string1 # DW_AT_name 184 .byte 5 # DW_AT_encoding 185 .byte 4 # DW_AT_byte_size 186 .byte 4 # Abbrev [4] 0x3e:0x1b DW_TAG_namespace 187 .secrel32 Linfo_string2 # DW_AT_name 188 .byte 5 # Abbrev [5] 0x43:0x15 DW_TAG_variable 189 .secrel32 Linfo_string3 # DW_AT_name 190 .secrel32 Linfo_type_int # DW_AT_type 191 # DW_AT_external 192 .byte 1 # DW_AT_decl_file 193 .byte 3 # DW_AT_decl_line 194 .byte 5 # DW_AT_location 195 .byte 3 196 .long __ZN1A12namespaceVarE 197 .secrel32 Linfo_string4 # DW_AT_linkage_name 198 .byte 0 # End Of Children Mark 199 .byte 6 # Abbrev [6] 0x59:0x15 DW_TAG_subprogram 200 .long Lfunc_begin0 # DW_AT_low_pc 201 .long Lfunc_end0-Lfunc_begin0 # DW_AT_high_pc 202 .byte 1 # DW_AT_frame_base 203 .byte 84 204 .secrel32 Linfo_string5 # DW_AT_linkage_name 205 .secrel32 Linfo_string6 # DW_AT_name 206 .byte 1 # DW_AT_decl_file 207 .byte 5 # DW_AT_decl_line 208 # DW_AT_external 209 .byte 0 # End Of Children Mark 210Ldebug_info_end0: 211 212 .section .debug_line,"dr" 213Lline_table_start0: 214