[PATCH] D51117: lld-link: Separate 'undefined symbol' errors with just one newline, not two.
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 22 11:55:04 PDT 2018
thakis created this revision.
thakis added a reviewer: pcc.
newline() in ErrorHandler.cpp already tries to insert newlines between messages that contain embedded newlines, so getSymbolLocations() shouldn't return a string that ends in a newline -- else we end up with two newlines between error messages.
Makes lld-link's output look more like ld.lld output.
Before:
lld-link: error: undefined symbol: _f
>>> referenced by /Users/thakis/src/llvm-mono/test.c:4
>>> test.obj:(_main)
lld-link: error: undefined symbol: _g
>>> referenced by /Users/thakis/src/llvm-mono/test.c:4
>>> test.obj:(_main)
lld-link: error: undefined symbol: _h
>>> referenced by /Users/thakis/src/llvm-mono/test.c:4
>>> test.obj:(_main)
After:
lld-link: error: undefined symbol: _f
>>> referenced by /Users/thakis/src/llvm-mono/test.c:4
>>> test.obj:(_main)
lld-link: error: undefined symbol: _g
>>> referenced by /Users/thakis/src/llvm-mono/test.c:4
>>> test.obj:(_main)
lld-link: error: undefined symbol: _h
>>> referenced by /Users/thakis/src/llvm-mono/test.c:4
>>> test.obj:(_main)
https://reviews.llvm.org/D51117
Files:
lld/COFF/SymbolTable.cpp
lld/test/COFF/undefined-symbol-cv.s
lld/test/COFF/undefined-symbol.s
Index: lld/test/COFF/undefined-symbol.s
===================================================================
--- lld/test/COFF/undefined-symbol.s
+++ lld/test/COFF/undefined-symbol.s
@@ -5,12 +5,12 @@
# CHECK: error: undefined symbol: ?foo@@YAHXZ
# CHECK-NEXT: >>> referenced by {{.*}}.obj:(main)
# CHECK-NEXT: >>> referenced by {{.*}}.obj:(main)
-
-# CHECK: error: undefined symbol: ?bar@@YAHXZ
+# CHECK-EMPTY:
+# CHECK-NEXT: error: undefined symbol: ?bar@@YAHXZ
# CHECK-NEXT: >>> referenced by {{.*}}.obj:(main)
# CHECK-NEXT: >>> referenced by {{.*}}.obj:(f1)
-
-# CHECK: error: undefined symbol: ?baz@@YAHXZ
+# CHECK-EMPTY:
+# CHECK-NEXT: error: undefined symbol: ?baz@@YAHXZ
# CHECK-NEXT: >>> referenced by {{.*}}.obj:(f2)
.section .text,"xr",one_only,main
Index: lld/test/COFF/undefined-symbol-cv.s
===================================================================
--- lld/test/COFF/undefined-symbol-cv.s
+++ lld/test/COFF/undefined-symbol-cv.s
@@ -7,14 +7,14 @@
# CHECK-NEXT: >>> {{.*}}.obj:(main)
# CHECK-NEXT: >>> referenced by file1.cpp:2
# CHECK-NEXT: >>> {{.*}}.obj:(main)
-
-# CHECK: error: undefined symbol: ?bar@@YAHXZ
+# CHECK-EMPTY:
+# CHECK-NEXT: error: undefined symbol: ?bar@@YAHXZ
# CHECK-NEXT: >>> referenced by file2.cpp:3
# CHECK-NEXT: >>> {{.*}}.obj:(main)
# CHECK-NEXT: >>> referenced by file1.cpp:4
# CHECK-NEXT: >>> {{.*}}.obj:(f1)
-
-# CHECK: error: undefined symbol: ?baz@@YAHXZ
+# CHECK-EMPTY:
+# CHECK-NEXT: error: undefined symbol: ?baz@@YAHXZ
# CHECK-NEXT: >>> referenced by file1.cpp:5
# CHECK-NEXT: >>> {{.*}}.obj:(f2)
Index: lld/COFF/SymbolTable.cpp
===================================================================
--- lld/COFF/SymbolTable.cpp
+++ lld/COFF/SymbolTable.cpp
@@ -109,7 +109,7 @@
}
if (Locations.empty())
- return "\n>>> referenced by " + toString(File) + "\n";
+ return "\n>>> referenced by " + toString(File);
std::string Out;
llvm::raw_string_ostream OS(Out);
@@ -122,7 +122,6 @@
if (!Loc.SymName.empty())
OS << ":(" << Loc.SymName << ')';
}
- OS << '\n';
return OS.str();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51117.162013.patch
Type: text/x-patch
Size: 2180 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180822/d14dfc13/attachment.bin>
More information about the llvm-commits
mailing list