[PATCH] D46090: [COFF] more informative "broken object file" diagnostics
Bob Haarman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 25 15:34:49 PDT 2018
inglorion created this revision.
inglorion added reviewers: pcc, ruiu.
When a symbol refers to a special section or a section that doesn't
exist, lld would fatal with "broken object file". This change gives a
different message for each scenario, and includes the name of the
file, name of the symbol, and the section being referred to.
https://reviews.llvm.org/D46090
Files:
lld/COFF/InputFiles.cpp
Index: lld/COFF/InputFiles.cpp
===================================================================
--- lld/COFF/InputFiles.cpp
+++ lld/COFF/InputFiles.cpp
@@ -326,14 +326,13 @@
if (SectionNumber == llvm::COFF::IMAGE_SYM_DEBUG)
return nullptr;
- // Reserved sections numbers don't have contents.
if (llvm::COFF::isReservedSectionNumber(SectionNumber))
- fatal("broken object file: " + toString(this));
+ fatal(toString(this) + ": " + Name +
+ " should not refer to special section " + Twine(SectionNumber));
- // This symbol references a section which is not present in the section
- // header.
if ((uint32_t)SectionNumber >= SparseChunks.size())
- fatal("broken object file: " + toString(this));
+ fatal(toString(this) + ": " + Name +
+ " should not refer to non-existant section " + Twine(SectionNumber));
// Handle comdat leader symbols.
if (const coff_aux_section_definition *Def = ComdatDefs[SectionNumber]) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46090.144024.patch
Type: text/x-patch
Size: 973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180425/08841f06/attachment.bin>
More information about the llvm-commits
mailing list