[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:09:43 PST 2021


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

removed now unused <algorithm>


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94560

Files:
  lld/ELF/OutputSections.cpp
  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;
   }
 
Index: lld/ELF/OutputSections.cpp
===================================================================
--- lld/ELF/OutputSections.cpp
+++ lld/ELF/OutputSections.cpp
@@ -16,6 +16,7 @@
 #include "lld/Common/Strings.h"
 #include "llvm/BinaryFormat/Dwarf.h"
 #include "llvm/Support/Compression.h"
+#include "llvm/Support/Format.h"
 #include "llvm/Support/MD5.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Parallel.h"


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


More information about the llvm-commits mailing list