[PATCH] D38436: [llvm-objcopy] Fix major layout bugs in llvm-objcopy

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 2 01:31:42 PDT 2017


jhenderson added a comment.

I'm equally at a loss as to how the align bug wasn't picked up earlier. I think it would be wise to take a look and see which test(s) should be covering this case, and why they weren't failing before.



================
Comment at: test/tools/llvm-objcopy/segment-shift.test:56
+# CHECK-NEXT:    Offset: 0x2000
+# CHECK-NEXT:    VirtualAddress: 0x0
+# CHECK-NEXT:    PhysicalAddress: 0x0
----------------
This address looks wrong. Shouldn't it be 0x3000, i.e. the address of .text3?


================
Comment at: tools/llvm-objcopy/Object.cpp:33
 
-void Segment::finalize() {
-  auto FirstSec = firstSection();
-  if (FirstSec) {
-    // It is possible for a gap to be at the begining of a segment. Because of
-    // this we need to compute the new offset based on how large this gap was
-    // in the source file. Section layout should have already ensured that this
-    // space is not used for something else.
-    uint64_t OriginalOffset = Offset;
-    Offset = FirstSec->Offset - (FirstSec->OriginalOffset - OriginalOffset);
-  }
-}
+void Segment::finalize() {}
 
----------------
I don't think we need this function at all anymore.


Repository:
  rL LLVM

https://reviews.llvm.org/D38436





More information about the llvm-commits mailing list