<div dir="ltr">Thanks. This is not a review comment to this particular change, but in LLD we are using both exponent and its shifted result, and that is confusing. We should probably use only power of twos.<div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 18, 2014 at 9:29 PM, Shankar Easwaran <span dir="ltr"><<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I will rename it to alignTo, which is what I really meant.<div><div><br>
<br>
On 11/18/2014 11:14 PM, Rui Ueyama wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Then "2" should be dropped from the name.<br>
<br>
On Tue, Nov 18, 2014 at 9:03 PM, Shankar Easwaran <<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>><br>
wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On 11/18/2014 10:42 PM, Rui Ueyama wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On Tue, Nov 18, 2014 at 7:51 PM, Shankar Easwaran <<br>
<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>><br>
wrote:<br>
<br>
  Author: shankare<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Date: Tue Nov 18 21:51:48 2014<br>
New Revision: 222312<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=222312&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=222312&view=rev</a><br>
Log:<br>
[ELF] Fix creation of segments.<br>
<br>
Linker was creating a separate output segment in some cases if input<br>
sections<br>
had huge alignments. This patch fixes the issue.<br>
<br>
Added:<br>
      lld/trunk/test/elf/X86_64/<u></u>outputsegments.test<br>
Modified:<br>
      lld/trunk/lib/ReaderWriter/<u></u>ELF/SegmentChunks.h<br>
      lld/trunk/test/elf/X86_64/<u></u>alignoffset.test<br>
      lld/trunk/test/elf/phdr.test<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/<u></u>ELF/SegmentChunks.h<br>
URL:<br>
<a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/lld/trunk/lib/<u></u>ReaderWriter/ELF/</a><br>
SegmentChunks.h?rev=222312&r1=<u></u>222311&r2=222312&view=diff<br>
<br>
==============================<u></u>==============================<br>
==================<br>
--- lld/trunk/lib/ReaderWriter/<u></u>ELF/SegmentChunks.h (original)<br>
+++ lld/trunk/lib/ReaderWriter/<u></u>ELF/SegmentChunks.h Tue Nov 18 21:51:48<br>
2014<br>
@@ -406,6 +406,8 @@ void Segment<ELFT>::<u></u>assignFileOffsets(ui<br>
     for (auto &slice : slices()) {<br>
       bool isFirstSection = true;<br>
       for (auto section : slice->sections()) {<br>
+      // Align fileoffset to the alignment of the section.<br>
+      fileOffset = llvm::RoundUpToAlignment(<u></u>fileOffset,<br>
section->align2());<br>
<br>
  Is this correct? align2 seems to imply that's an exponent. If so, it<br>
</blockquote>
had to<br>
be used as 1 << section->align2().<br>
<br>
</blockquote>
AtomSection::appendAtom handles it and sets the align2 value after<br>
shifting.<br>
<br>
Shankar Easwaran<br>
<br>
--<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted<br>
by the Linux Foundation<br>
<br>
<br>
</blockquote></blockquote>
<br>
<br>
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation<br>
<br>
</div></div></blockquote></div><br></div></div>