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
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)
17 # Used reduced output from following code and clang version 7.0.0 (trunk 332701)
18 # to produce this input file:
27 # Invocation: clang-7 -g -S 1.cpp
31 .file 1 "/path" "1.cpp"
33 .type _ZN1A3barE,@object
40 .type _ZN1Z3barE,@object
47 .section .debug_str,"MS",@progbits,1
49 .asciz "clang version 7.0.0 (trunk 332701)" # string offset=0
51 .asciz "1.cpp" # string offset=35
53 .asciz "/path" # string offset=41
55 .asciz "A" # string offset=87
57 .asciz "bar" # string offset=89
59 .asciz "int" # string offset=93
61 .asciz "_ZN1A3barE" # string offset=97
63 .asciz "Z" # string offset=108
65 .asciz "_ZN1Z3barE" # string offset=110
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
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
86 .byte 2 # Abbreviation Code
87 .byte 57 # DW_TAG_namespace
88 .byte 1 # DW_CHILDREN_yes
90 .byte 14 # DW_FORM_strp
94 .byte 3 # Abbreviation Code
95 .byte 52 # DW_TAG_variable
96 .byte 0 # DW_CHILDREN_no
98 .byte 14 # DW_FORM_strp
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
114 .byte 4 # Abbreviation Code
115 .byte 36 # DW_TAG_base_type
116 .byte 0 # DW_CHILDREN_no
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
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)
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
141 .byte 2 # Abbrev [2] 0x1e:0x1f DW_TAG_namespace
142 .long .Linfo_string3 # DW_AT_name
144 .byte 3 # Abbrev [3] 0x23:0x19 DW_TAG_variable
145 .long .Linfo_string4 # DW_AT_name
146 .long 61 # DW_AT_type
148 .byte 1 # DW_AT_decl_file
149 .byte 2 # DW_AT_decl_line
150 .byte 9 # DW_AT_location
153 .long .Linfo_string6 # DW_AT_linkage_name
154 .byte 0 # End Of Children Mark
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
161 .byte 2 # Abbrev [2] 0x44:0x1f DW_TAG_namespace
162 .long .Linfo_string7 # DW_AT_name
164 .byte 3 # Abbrev [3] 0x49:0x19 DW_TAG_variable
165 .long .Linfo_string4 # DW_AT_name
166 .long 61 # DW_AT_type
168 .byte 1 # DW_AT_decl_file
169 .byte 6 # DW_AT_decl_line
170 .byte 9 # DW_AT_location
173 .long .Linfo_string8 # DW_AT_linkage_name
175 .byte 0 # End Of Children Mark
176 .byte 0 # End Of Children Mark