[PATCH] D94560: [ELF] report section sizes when output file too large

Bob Haarman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 14:11:39 PST 2021


inglorion updated this revision to Diff 317074.
inglorion added a comment.

also removed unused Format.h include


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94560/new/

https://reviews.llvm.org/D94560

Files:
  lld/ELF/Writer.cpp


Index: lld/ELF/Writer.cpp
===================================================================
--- lld/ELF/Writer.cpp
+++ lld/ELF/Writer.cpp
@@ -2872,7 +2872,13 @@
 template <class ELFT> void Writer<ELFT>::openFile() {
   uint64_t maxSize = config->is64 ? INT64_MAX : UINT32_MAX;
   if (fileSize != size_t(fileSize) || maxSize < fileSize) {
-    error("output file too large: " + Twine(fileSize) + " bytes");
+    std::string msg;
+    raw_string_ostream s(msg);
+    s << "output file too large: " << Twine(fileSize) << " bytes\n"
+      << "Section sizes:\n";
+    for (OutputSection *os : outputSections)
+      s << os->name << " " << os->size << "\n";
+    error(s.str());
     return;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94560.317074.patch
Type: text/x-patch
Size: 697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210115/4f20bb0a/attachment.bin>


More information about the llvm-commits mailing list