[PATCH] D10951: [LinkerScript] Fix bug in Segment::assignVirtualAddress()
Rafael EspĂndola
rafael.espindola at gmail.com
Mon Jul 6 05:37:38 PDT 2015
testcase?
On 6 July 2015 at 01:35, Rafael Auler <rafaelauler at gmail.com> wrote:
> rafaelauler created this revision.
> rafaelauler added reviewers: shankar.easwaran, denis-protivensky.
> rafaelauler added a subscriber: llvm-commits.
>
> When calculating the start address and size of a segment, lld mistakenly
> attributes the start address of the last segment slice to the whole segment
> when it should consider the start address of the first slice. In this case, in a
> multi-slice segment, Segment::assignVirtualAddress() will return a wrong
> segment start address to TargetLayout::assignVirtualAddress(). The effect of
> this miscalculation is to allocate some program headers in unnecessarily far
> away addresses.
>
> This will be tested in my next patch.
>
> http://reviews.llvm.org/D10951
>
> Files:
> lib/ReaderWriter/ELF/SegmentChunks.cpp
>
> Index: lib/ReaderWriter/ELF/SegmentChunks.cpp
> ===================================================================
> --- lib/ReaderWriter/ELF/SegmentChunks.cpp
> +++ lib/ReaderWriter/ELF/SegmentChunks.cpp
> @@ -362,7 +362,7 @@
>
> // Set the segment memory size and the virtual address.
> this->setMemSize(curSliceAddress - startAddr + curSliceSize);
> - this->setVirtualAddr(curSliceAddress);
> + this->setVirtualAddr(startAddr);
> std::stable_sort(_segmentSlices.begin(), _segmentSlices.end(),
> SegmentSlice<ELFT>::compare_slices);
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list