[PATCH] D42872: Fix handling of zero-size segments in llvm-objcopy
vit9696 via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 8 01:46:34 PST 2018
vit9696 added a comment.
I am personally not sure if it is the correct solution, because I do not understand why a segment with 0 filesize and a 0 offset should corrupt an ELF while copying regardless of its type.
I would personally prefer special-casing two segments to writing a check against both MemSize and FileSize, but it does not feel nice to me.
More importantly, if you have a PT_LOAD "marker" segment with all zero values:
- will gnu binutils objcopy also corrupt such an ELF?
- will a Linux/BSD-based system load such an ELF?
If in both cases the answer is no, then we should probably just special-case indeed, but I still cannot say that silently overwriting the header is any good. Perhaps we should print an error and abort?
Repository:
rL LLVM
https://reviews.llvm.org/D42872
More information about the llvm-commits
mailing list