[PATCH] D39132: [llvm-objcopy] Fix bug in how segment alignment was being handled

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 1 03:38:54 PDT 2017


jhenderson accepted this revision.
jhenderson added a comment.
This revision is now accepted and ready to land.

LGTM with the comment nits fixed.



================
Comment at: tools/llvm-objcopy/Object.cpp:673
+static uint64_t alignToAddr(uint64_t Offset, uint64_t Addr, uint64_t Align) {
+  // Calculate Diff such that  (Offset + Diff) & -Align == Addr & -Align.
+  if (Align == 0)
----------------
There's an extra space here between "that" and "(Offset + ...".


================
Comment at: tools/llvm-objcopy/Object.cpp:678
+      static_cast<int64_t>(Addr % Align) - static_cast<int64_t>(Offset % Align);
+  // We only want to add to Offset however so if Diff < 0 we can add Align and
+  // (Offset + Diff) & -Align == Addr & -Align will still hold.
----------------
"...Offset however so..." -> "...Offset, however, so..."


Repository:
  rL LLVM

https://reviews.llvm.org/D39132





More information about the llvm-commits mailing list