<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - "Failed to parse object file" diagnostic doesn't list object file; diagnostics pretty inconsistent in general"
href="https://llvm.org/bugs/show_bug.cgi?id=28553">28553</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>"Failed to parse object file" diagnostic doesn't list object file; diagnostics pretty inconsistent in general
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>COFF
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nicolasweber@gmx.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>I was playing with cross-linking chrome/win on Linux again. At some point, lld
failed with
Failed to parse object file: The file was not recognized as a valid object file
which is not a very useful error message. It tells me that things didn't work
twice, but doesn't tell me which file the problem was with. So I did:
Index: COFF/InputFiles.cpp
===================================================================
--- COFF/InputFiles.cpp (revision 275409)
+++ COFF/InputFiles.cpp (working copy)
@@ -105,8 +104,7 @@
// Parse a memory buffer as a COFF file.
auto BinOrErr = createBinary(MB);
if (!BinOrErr)
- error(errorToErrorCode(BinOrErr.takeError()),
- "Failed to parse object file");
+ error(errorToErrorCode(BinOrErr.takeError()), getShortName());
std::unique_ptr<Binary> Bin = std::move(*BinOrErr);
if (auto *Obj = dyn_cast<COFFObjectFile>(Bin.get())) {
Then I realized that InputFiles has the same problem in a few other places, so
I made the same change in a few other places. Then I noticed that the warnings
I changed now have the format "dynamic string: fixed error string" while a few
other diagnostics follow the pattern "fixed error string: dynamic string"
(where "dynamic string" is the name of an object file, a symbol, etc), so I
started changing these to the other format as well.
Punctuation, capitalization, etc are also inconsistent.
And then I realized that it's probably best if Rui makes some decision on how
diagnostic messages should look like :-)
I think for greppability (and scanability by users) it'd also be helpful if
each error message started with "error: ", e.g.
error: obj/third_party/angle/libglesv2/libglesv2.res: The file was not
recognized as a valid object file
Here's where I was at before I realized I should instead file a bug before I
get in too deep.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>