diff options
| author | Bob Haarman <llvm@inglorion.net> | 2018-04-25 23:33:19 +0000 |
|---|---|---|
| committer | Bob Haarman <llvm@inglorion.net> | 2018-04-25 23:33:19 +0000 |
| commit | 947647d0c1fd9557f2dd8ddda3a15622da2c7f77 (patch) | |
| tree | 203956a0cca4f0b043ca9efcac764b5ec6b122b4 | |
| parent | 310bca01781bff0d71c2d69a952b3a7bd6b6ef2a (diff) | |
| download | bcm5719-llvm-947647d0c1fd9557f2dd8ddda3a15622da2c7f77.tar.gz bcm5719-llvm-947647d0c1fd9557f2dd8ddda3a15622da2c7f77.zip | |
[COFF] more informative "broken object file" diagnostics
Summary:
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.
Reviewers: pcc, ruiu
Reviewed By: ruiu
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D46090
llvm-svn: 330883
| -rw-r--r-- | lld/COFF/InputFiles.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp index b310fce5fd4..8f18910617b 100644 --- a/lld/COFF/InputFiles.cpp +++ b/lld/COFF/InputFiles.cpp @@ -326,14 +326,13 @@ Optional<Symbol *> ObjFile::createDefined( 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-existent section " + Twine(SectionNumber)); // Handle comdat leader symbols. if (const coff_aux_section_definition *Def = ComdatDefs[SectionNumber]) { |

