[PATCH] D59351: [llvm-objcopy] Add --update-section

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 12:00:35 PDT 2019


jakehehrlich added inline comments.


================
Comment at: tools/llvm-objcopy/ELF/Object.cpp:783
+         Segment.Offset <= Section.OriginalOffset &&
+         Segment.Offset + Segment.MemSize >= Section.OriginalOffset + SecSize;
 }
----------------
We need to be *very* careful here. Can you explain why you did this?


================
Comment at: tools/llvm-objcopy/ELF/Object.cpp:1489
+// layoutSections based on segment virtual address and previous segment size.
+void Segment::fixupSectionOffsets() {
+  SectionBase *Prev = nullptr;
----------------
We should not be changing segment layout. This is a huge bag of worms and this function does not correctly handle this. You basically have to re-link an executable to do this. Changing the size of a section that's within a segment should just simply be an error. I'm highly skeptical of use cases that require this.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59351/new/

https://reviews.llvm.org/D59351





More information about the llvm-commits mailing list