[PATCH] D19416: [ELF] - Align sections file offsets correctly.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 25 01:41:58 PDT 2016
grimar added inline comments.
================
Comment at: ELF/Writer.cpp:1646
@@ +1645,3 @@
+template <class ELFT, class uintX_t>
+static uintX_t alignOffset(uintX_t Off, uintX_t Align,
+ OutputSectionBase<ELFT> *Sec) {
----------------
ruiu wrote:
> Rename this getFileAlignment.
Done.
================
Comment at: ELF/Writer.cpp:1658
@@ +1657,3 @@
+ if ((VA % PageSize) != (Off % PageSize)) {
+ uintX_t Val = ((Off & ~(PageSize - 1)) | (VA % PageSize));
+ Off = Val < Off ? (Val + PageSize) : Val;
----------------
Added Mask variable to simplify.
================
Comment at: ELF/Writer.cpp:1674-1676
@@ -1650,4 +1673,5 @@
}
uintX_t Align = Sec->getAlign();
if (Sec->PageAlign)
Align = std::max<uintX_t>(Align, Target->PageSize);
+ Off = alignOffset<ELFT>(Off, Align, Sec);
----------------
ruiu wrote:
> You want to move these three lines of code to the new function because it handles alignment as well. Then you can remove `Align` parameter from the function.
Done.
http://reviews.llvm.org/D19416
More information about the llvm-commits
mailing list