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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 7 13:57:41 PST 2018


ruiu 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.
----------------
grimar wrote:
> 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).
Please explain that. At least I couldn't get that from the current comment.


https://reviews.llvm.org/D43819





More information about the llvm-commits mailing list