[PATCH] D42872: Fix handling of zero-size segments in llvm-objcopy

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 20:10:39 PST 2018


jakehehrlich added inline comments.


================
Comment at: tools/llvm-objcopy/Object.cpp:915
+  for (auto &Segment : Obj.segments()) {
+    if (Segment.FileSize > 0)
+      OrderedSegments.push_back(&Segment);
----------------
Can you add a comment explaining the following

1) Explain why we need to remove such segments.
2) By not adding such a segment to OrderedSegments we are not going to tweak the Offset of the segment from the OriginalOffset.
3) Segments with FileSize == 0 will never be the ParentSegment of a section or other Segment so not tweaking their offset will never cause the offset of another section or segment to be invalid.


Repository:
  rL LLVM

https://reviews.llvm.org/D42872





More information about the llvm-commits mailing list