[PATCH] D94560: [ELF] report section sizes when output file too large
Bob Haarman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 21 11:47:33 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8e0b17931530: [ELF] report section sizes when output file too large (authored by inglorion).
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
lld/test/ELF/linkerscript/output-too-large.s
Index: lld/test/ELF/linkerscript/output-too-large.s
===================================================================
--- lld/test/ELF/linkerscript/output-too-large.s
+++ lld/test/ELF/linkerscript/output-too-large.s
@@ -21,14 +21,26 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t2.o
# RUN: echo "SECTIONS { .text : { . = 0x8fffffffffffffff; *(.text*); } }" > %t2.script
# RUN: not ld.lld -T %t2.script -M %t2.o -o /dev/null 2>&1 | \
-# RUN: FileCheck --check-prefixes=MAP2,CHECK %s
+# RUN: FileCheck --check-prefixes=MAP2,CHECK64 %s
# MAP2: VMA LMA Size Align Out In Symbol
# MAP2: 9000000000000000 9000000000000000 1 4 {{.*}}.o:(.text)
# MAP2-NEXT: 9000000000000000 9000000000000000 0 1 _start
# CHECK: error: output file too large
+# CHECK-NEXT: section sizes:
+# CHECK-NEXT: .text 4294967297
+# CHECK-NEXT: .data 1
+# CHECK64: error: output file too large
+# CHECK64-NEXT: section sizes:
+# CHECK64-NEXT: .text 10376293541461622785
+# CHECK64-NEXT: .data 1
+
+.data
+.byte 42
+
+.text
.global _start
_start:
nop
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.318275.patch
Type: text/x-patch
Size: 1840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210121/4eb19268/attachment.bin>
More information about the llvm-commits
mailing list