Index: Common/ErrorHandler.cpp =================================================================== --- Common/ErrorHandler.cpp +++ Common/ErrorHandler.cpp @@ -114,11 +114,18 @@ static std::regex regexes[] = { std::regex( - R"(^undefined (?:\S+ )?symbol:.*\n>>> referenced by (\S+):(\d+)\n.*)"), + R"(^undefined (?:\S+ )?symbol:.*\n)" + R"(>>> referenced by .+\((\S+):(\d+)\))"), + std::regex( + R"(^undefined (?:\S+ )?symbol:.*\n>>> referenced by (\S+):(\d+))"), std::regex(R"(^undefined symbol:.*\n>>> referenced by (.*):)"), std::regex( R"(^duplicate symbol: .*\n>>> defined in (\S+)\n>>> defined in.*)"), - std::regex(R"(^duplicate symbol: .*\n>>> defined at (\S+):(\d+).*)"), + std::regex( + R"(^duplicate symbol: .*\n>>> defined at .+\((\S+):(\d+)\))"), + std::regex(R"(^duplicate symbol: .*\n>>> defined at (\S+):(\d+))"), + std::regex( + R"(.*\n>>> defined in .*\n>>> referenced by .+\((\S+):(\d+)\))"), std::regex(R"(.*\n>>> defined in .*\n>>> referenced by (\S+):(\d+))"), std::regex(R"((\S+):(\d+): unclosed quote)"), }; Index: test/ELF/Inputs/vs-diagnostics-duplicate3.s =================================================================== --- test/ELF/Inputs/vs-diagnostics-duplicate3.s +++ test/ELF/Inputs/vs-diagnostics-duplicate3.s @@ -1,6 +1,8 @@ .file "duplicate3.s" -.global baz +.global baz, qux .text baz: nop +qux: + nop Index: test/ELF/vs-diagnostics-duplicate-split.s =================================================================== --- test/ELF/vs-diagnostics-duplicate-split.s +++ test/ELF/vs-diagnostics-duplicate-split.s @@ -2,10 +2,10 @@ // RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o // RUN: not ld.lld --vs-diagnostics --shared %t.o %t.o -o /dev/null 2>&1 | FileCheck %s -// CHECK: duplicate.s(15): error: duplicate symbol: foo +// CHECK: /tmp{{/|\\}}duplicate.s(15): error: duplicate symbol: foo // CHECK-NEXT: >>> defined at duplicate.s:15 (/tmp{{/|\\}}duplicate.s:15) // CHECK-NEXT: >>>{{.*}}.o:(.text+0x{{.+}}) -// CHECK: duplicate.s(15): error: duplicate symbol: foo +// CHECK: /tmp{{/|\\}}duplicate.s(15): error: duplicate symbol: foo // CHECK-NEXT: >>> defined at duplicate.s:15 (/tmp{{/|\\}}duplicate.s:15) // CHECK-NEXT: >>>{{.*}}.o:(.text+0x{{.+}}) Index: test/ELF/vs-diagnostics-duplicate.s =================================================================== --- test/ELF/vs-diagnostics-duplicate.s +++ test/ELF/vs-diagnostics-duplicate.s @@ -24,7 +24,14 @@ // CHECK-NEXT: >>> defined at duplicate3.s // CHECK-NEXT: >>> {{.*}}3.o:(.text+0x{{.+}}) -.global _start, foo, bar, baz +// Check that we prefer using the full path of a source file. +// CHECK: /tmp{{/|\\}}duplicate.s(33): error: duplicate symbol: qux +// CHECK-NEXT: >>> defined at duplicate.s:33 (/tmp{{/|\\}}duplicate.s:33) +// CHECK-NEXT: >>> {{.*}}1.o:(.text+0x{{.+}}) +// CHECK-NEXT: >>> defined at duplicate3.s +// CHECK-NEXT: >>> {{.*}}3.o:(.text+0x{{.+}}) + +.global _start, foo, bar, baz, qux .text _start: nop @@ -42,6 +49,11 @@ baz: nop +.file 2 "/tmp" "duplicate.s" +.loc 2 33 +qux: + nop + .section .debug_abbrev,"",@progbits .byte 1 # Abbreviation Code .byte 17 # DW_TAG_compile_unit Index: test/ELF/vs-diagnostics-dynamic-relocation.s =================================================================== --- test/ELF/vs-diagnostics-dynamic-relocation.s +++ test/ELF/vs-diagnostics-dynamic-relocation.s @@ -7,12 +7,23 @@ // CHECK-NEXT: >>> referenced by dyn.s:15 // CHECK-NEXT: >>>{{.*}}.o:(.text+0x{{.+}}) +// CHECK: /tmp{{/|\\}}dyn.s(20): error: can't create dynamic relocation {{.*}} +// CHECK-NEXT: >>> defined in {{.*}}.o +// CHECK-NEXT: >>> referenced by dyn.s:20 (/tmp{{/|\\}}dyn.s:20) +// CHECK-NEXT: >>>{{.*}}.o:(.text+0x{{.+}}) + .file 1 "dyn.s" .loc 1 15 foo: .quad foo +.file 2 "/tmp" "dyn.s" +.loc 2 20 + +bar: +.quad bar + .section .debug_abbrev,"",@progbits .byte 1 # Abbreviation Code .byte 17 # DW_TAG_compile_unit Index: test/ELF/vs-diagnostics-undefined-hidden.s =================================================================== --- test/ELF/vs-diagnostics-undefined-hidden.s +++ test/ELF/vs-diagnostics-undefined-hidden.s @@ -9,16 +9,22 @@ // CHECK: undef.s(27): error: undefined protected symbol: bar // CHECK-NEXT: >>> referenced by undef.s:27 +// CHECK: /tmp{{/|\\}}undef.s(13): error: undefined protected symbol: baz +// CHECK-NEXT: >>> referenced by undef.s:13 (/tmp{{/|\\}}undef.s:13) + .file 1 "undef.s" +.file 2 "/tmp" "undef.s" .hidden foo -.protected bar +.protected bar, baz .text _start: .loc 1 15 jmp foo .loc 1 27 jmp bar +.loc 2 13 + jmp baz .section .debug_abbrev,"",@progbits .byte 1 # Abbreviation Code Index: test/ELF/vs-diagnostics-undefined-symbol-3.s =================================================================== --- test/ELF/vs-diagnostics-undefined-symbol-3.s +++ test/ELF/vs-diagnostics-undefined-symbol-3.s @@ -10,13 +10,21 @@ // CHECK: >>> referenced by undef3.s:15 // CHECK-NEXT: >>> {{.*}}1.o:(.text+0x{{.+}}) +// ERR: /tmp{{/|\\}}undef3.s(20): error: undefined symbol: bar +// WARN: /tmp{{/|\\}}undef3.s(20): warning: undefined symbol: bar +// CHECK: >>> referenced by undef3.s:20 (/tmp{{/|\\}}undef3.s:20) +// CHECK-NEXT: >>> {{.*}}1.o:(.text+0x{{.+}}) + .file 1 "undef3.s" +.file 2 "/tmp" "undef3.s" -.global _start, foo +.global _start, foo, bar .text _start: .loc 1 15 jmp foo +.loc 2 20 + jmp bar .section .debug_abbrev,"",@progbits .byte 1 # Abbreviation Code