[PATCH] D19416: [ELF] - Align sections file offsets correctly.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 09:28:41 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/Writer.cpp:1672-1679
@@ +1671,10 @@
+
+  uintX_t PageSize = Target->PageSize;
+  uintX_t VA = Sec->getVA();
+  uintX_t Mask = PageSize - 1;
+  if ((VA & Mask) != (Off & Mask)) {
+    uintX_t Val = ((Off & ~Mask) | (VA & Mask));
+    Off = Val < Off ? (Val + PageSize) : Val;
+  }
+  return Off;
+}
----------------
Can this be

  return alignTo(Off, PageSize, Sec->getVA())?


http://reviews.llvm.org/D19416





More information about the llvm-commits mailing list