77 lines · plain
1// REQUIRES: x862// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o3// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/vs-diagnostics-duplicate2.s -o %t2.o4// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/vs-diagnostics-duplicate3.s -o %t3.o5// RUN: not ld.lld --vs-diagnostics --threads=1 %t1.o %t2.o %t3.o -o /dev/null 2>&1 | FileCheck %s6 7// Case 1. The source locations are unknown for both symbols.8// CHECK: {{.*}}ld.lld{{.*}}: error: duplicate symbol: foo9// CHECK-NEXT: >>> defined at {{.*}}1.o:(.text+0x{{.+}})10// CHECK-NEXT: >>> defined at {{.*}}2.o:(.text+0x{{.+}})11 12// Case 2. Both symbols have full source location.13// CHECK: duplicate.s(15): error: duplicate symbol: bar14// CHECK-NEXT: >>> defined at duplicate.s:1515// CHECK-NEXT: >>>{{.*}}1.o:(.text+0x{{.+}})16// CHECK: duplicate2.s(20): error: duplicate symbol: bar17// CHECK-NEXT: >>> defined at duplicate2.s:2018// CHECK-NEXT: >>>{{.*}}2.o:(.text+0x{{.+}})19 20// Case 3. For the second definition of `baz` we know only the source file found in a STT_FILE symbol.21// CHECK: duplicate.s(30): error: duplicate symbol: baz22// CHECK-NEXT: >>> defined at duplicate.s:3023// CHECK-NEXT: >>> {{.*}}1.o:(.text+0x{{.+}})24// CHECK-NEXT: >>> defined at duplicate3.s25// CHECK-NEXT: >>> {{.*}}3.o:(.text+0x{{.+}})26 27// Check that we prefer using the full path of a source file.28// CHECK: /tmp{{/|\\}}duplicate.s(33): error: duplicate symbol: qux29// CHECK-NEXT: >>> defined at duplicate.s:33 (/tmp{{/|\\}}duplicate.s:33)30// CHECK-NEXT: >>> {{.*}}1.o:(.text+0x{{.+}})31// CHECK-NEXT: >>> defined at duplicate3.s32// CHECK-NEXT: >>> {{.*}}3.o:(.text+0x{{.+}})33 34.global _start, foo, bar, baz, qux35.text36_start:37 nop38 39foo:40 nop41 42.file 1 "duplicate.s"43.loc 1 1544 45bar:46 nop47 48.loc 1 3049baz:50 nop51 52.file 2 "/tmp" "duplicate.s"53.loc 2 3354qux:55 nop56 57.section .debug_abbrev,"",@progbits58 .byte 1 # Abbreviation Code59 .byte 17 # DW_TAG_compile_unit60 .byte 0 # DW_CHILDREN_no61 .byte 16 # DW_AT_stmt_list62 .byte 23 # DW_FORM_sec_offset63 .byte 0 # EOM(1)64 .byte 0 # EOM(2)65 .byte 0 # EOM(3)66 67.section .debug_info,"",@progbits68 .long .Lend0 - .Lbegin0 # Length of Unit69.Lbegin0:70 .short 4 # DWARF version number71 .long .debug_abbrev # Offset Into Abbrev. Section72 .byte 8 # Address Size (in bytes)73 .byte 1 # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit74 .long .debug_line # DW_AT_stmt_list75.Lend0:76 .section .debug_line,"",@progbits77