summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/Common/ErrorHandler.cpp11
-rw-r--r--lld/test/ELF/Inputs/vs-diagnostics-duplicate3.s4
-rw-r--r--lld/test/ELF/vs-diagnostics-duplicate-split.s4
-rw-r--r--lld/test/ELF/vs-diagnostics-duplicate.s14
-rw-r--r--lld/test/ELF/vs-diagnostics-dynamic-relocation.s11
-rw-r--r--lld/test/ELF/vs-diagnostics-undefined-hidden.s8
-rw-r--r--lld/test/ELF/vs-diagnostics-undefined-symbol-3.s10
7 files changed, 54 insertions, 8 deletions
diff --git a/lld/Common/ErrorHandler.cpp b/lld/Common/ErrorHandler.cpp
index ce7d2531478..b91854c51ce 100644
--- a/lld/Common/ErrorHandler.cpp
+++ b/lld/Common/ErrorHandler.cpp
@@ -114,11 +114,18 @@ std::string ErrorHandler::getLocation(const Twine &msg) {
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)"),
};
diff --git a/lld/test/ELF/Inputs/vs-diagnostics-duplicate3.s b/lld/test/ELF/Inputs/vs-diagnostics-duplicate3.s
index 81829c82bf5..dcc458a6c5c 100644
--- a/lld/test/ELF/Inputs/vs-diagnostics-duplicate3.s
+++ b/lld/test/ELF/Inputs/vs-diagnostics-duplicate3.s
@@ -1,6 +1,8 @@
.file "duplicate3.s"
-.global baz
+.global baz, qux
.text
baz:
nop
+qux:
+ nop
diff --git a/lld/test/ELF/vs-diagnostics-duplicate-split.s b/lld/test/ELF/vs-diagnostics-duplicate-split.s
index d8f4ac2f812..b3b4eae1ce2 100644
--- a/lld/test/ELF/vs-diagnostics-duplicate-split.s
+++ b/lld/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{{.+}})
diff --git a/lld/test/ELF/vs-diagnostics-duplicate.s b/lld/test/ELF/vs-diagnostics-duplicate.s
index 198847e5dd2..11425df9db0 100644
--- a/lld/test/ELF/vs-diagnostics-duplicate.s
+++ b/lld/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 @@ bar:
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
diff --git a/lld/test/ELF/vs-diagnostics-dynamic-relocation.s b/lld/test/ELF/vs-diagnostics-dynamic-relocation.s
index 6575133eca1..dec9c7b9b2a 100644
--- a/lld/test/ELF/vs-diagnostics-dynamic-relocation.s
+++ b/lld/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
diff --git a/lld/test/ELF/vs-diagnostics-undefined-hidden.s b/lld/test/ELF/vs-diagnostics-undefined-hidden.s
index 798ca0fc08e..b562e360ccf 100644
--- a/lld/test/ELF/vs-diagnostics-undefined-hidden.s
+++ b/lld/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
diff --git a/lld/test/ELF/vs-diagnostics-undefined-symbol-3.s b/lld/test/ELF/vs-diagnostics-undefined-symbol-3.s
index 3ff9885b740..f2295b7c332 100644
--- a/lld/test/ELF/vs-diagnostics-undefined-symbol-3.s
+++ b/lld/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
OpenPOWER on IntegriCloud