[PATCH] D43819: [ELF] - Restrict section offsets that exceeds file size.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 7 04:31:23 PST 2018


grimar added inline comments.


================
Comment at: ELF/Writer.cpp:1906-1908
+  // It is possible to get file offset overlaps or overflows with linker
+  // scripts. We perform checks required in checkNoOverlappingSections() and
+  // want to prevent file size overflows here because it would crash the linker.
----------------
ruiu wrote:
> But why does this happen? If we detects all backward movements of '.', it shouldn't happen, no?
No, we don't. We detect the backward movements only inside the section declarations.
See: https://github.com/llvm-mirror/lld/blob/master/ELF/LinkerScript.cpp#L125
If we would detect all movements, we would be unable to link some software, 
for example - Linux kernel (see D34977).


https://reviews.llvm.org/D43819





More information about the llvm-commits mailing list