[PATCH] D25729: [ELF] Add "warning", "error" and "fatal error" prefixes to linker messages
Eugene Leviant via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 18 07:51:34 PDT 2016
evgeny777 created this revision.
evgeny777 added reviewers: ruiu, rafael.
evgeny777 added subscribers: ikudrin, grimar, llvm-commits.
evgeny777 set the repository for this revision to rL LLVM.
evgeny777 added a project: lld.
The primary goal is integration with MS visual studio. Also this makes possible distinguishing warnings from errors when lld is invoked from command line.
Repository:
rL LLVM
https://reviews.llvm.org/D25729
Files:
ELF/Error.cpp
test/ELF/copy-rel-corrupted.s
test/ELF/entry.s
test/ELF/linkerscript/diagnostic.s
Index: test/ELF/linkerscript/diagnostic.s
===================================================================
--- test/ELF/linkerscript/diagnostic.s
+++ test/ELF/linkerscript/diagnostic.s
@@ -52,7 +52,7 @@
# RUN: FileCheck -check-prefix=ERR6 %s < %t.log
# ERR6: line 1:
# ERR6-NEXT: UNKNOWN_TAG {
-# RUN: grep '^^' %t.log
+# RUN: grep '^error: ^' %t.log
## One more check that text of lines and pointer to 'bad' token are working ok.
# RUN: echo "SECTIONS {" > %t.script
@@ -63,4 +63,4 @@
# RUN: FileCheck -check-prefix=ERR7 %s < %t.log
# ERR7: line 4: malformed number: .temp
# ERR7-NEXT: boom .temp : { *(.temp) } }
-# RUN: grep '^ ^' %t.log
+# RUN: grep '^error: ^' %t.log
Index: test/ELF/entry.s
===================================================================
--- test/ELF/entry.s
+++ test/ELF/entry.s
@@ -2,9 +2,9 @@
# RUN: ld.lld -e foobar %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN %s
# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=NOENTRY %s
-# RUN: ld.lld %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN2 %s
+# RUN: ld.lld %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN2 %s --match-full-lines
-# RUN: ld.lld -shared -e foobar %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN %s
+# RUN: ld.lld -shared -e foobar %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN --match-full-lines %s
# RUN: ld.lld -shared --fatal-warnings -e entry %t1 -o %t2
# RUN: ld.lld -shared --fatal-warnings %t1 -o %t2
@@ -19,8 +19,8 @@
# RUN: ld.lld %t1 -o %t2 -e 0777
# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=OCT %s
-# WARN: entry symbol foobar not found, assuming 0
-# WARN2: entry symbol _start not found, assuming 0
+# WARN: warning: entry symbol foobar not found, assuming 0
+# WARN2: warning: entry symbol _start not found, assuming 0
# NOENTRY: Entry: 0x0
# SYM: Entry: 0x11000
Index: test/ELF/copy-rel-corrupted.s
===================================================================
--- test/ELF/copy-rel-corrupted.s
+++ test/ELF/copy-rel-corrupted.s
@@ -1,9 +1,9 @@
// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
// RUN: llvm-mc %p/Inputs/copy-rel-corrupted.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux
// RUN: ld.lld %t2.o -o %t2.so -shared
-// RUN: not ld.lld %t.o %t2.so -o %t.exe 2>&1 | FileCheck %s
+// RUN: not ld.lld %t.o %t2.so -o %t.exe 2>&1 | FileCheck %s --match-full-lines
-// CHECK: cannot create a copy relocation for symbol x
+// CHECK: fatal error: cannot create a copy relocation for symbol x
.global _start
_start:
Index: ELF/Error.cpp
===================================================================
--- ELF/Error.cpp
+++ ELF/Error.cpp
@@ -30,20 +30,20 @@
if (Config->FatalWarnings)
error(Msg);
else
- *ErrorOS << Msg << "\n";
+ *ErrorOS << "warning: " << Msg << "\n";
}
void elf::error(const Twine &Msg) {
- *ErrorOS << Msg << "\n";
+ *ErrorOS << "error: " << Msg << "\n";
HasError = true;
}
void elf::error(std::error_code EC, const Twine &Prefix) {
error(Prefix + ": " + EC.message());
}
void elf::fatal(const Twine &Msg) {
- *ErrorOS << Msg << "\n";
+ *ErrorOS << "fatal error: " << Msg << "\n";
exit(1);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25729.75002.patch
Type: text/x-patch
Size: 3189 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161018/a0a92566/attachment.bin>
More information about the llvm-commits
mailing list