[lld] r222312 - [ELF] Fix creation of segments.

Shankar Easwaran shankare at codeaurora.org
Tue Nov 18 21:29:40 PST 2014


I will rename it to alignTo, which is what I really meant.

On 11/18/2014 11:14 PM, Rui Ueyama wrote:
> Then "2" should be dropped from the name.
>
> On Tue, Nov 18, 2014 at 9:03 PM, Shankar Easwaran <shankare at codeaurora.org>
> wrote:
>
>> On 11/18/2014 10:42 PM, Rui Ueyama wrote:
>>
>>> On Tue, Nov 18, 2014 at 7:51 PM, Shankar Easwaran <
>>> shankare at codeaurora.org>
>>> wrote:
>>>
>>>   Author: shankare
>>>> Date: Tue Nov 18 21:51:48 2014
>>>> New Revision: 222312
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=222312&view=rev
>>>> Log:
>>>> [ELF] Fix creation of segments.
>>>>
>>>> Linker was creating a separate output segment in some cases if input
>>>> sections
>>>> had huge alignments. This patch fixes the issue.
>>>>
>>>> Added:
>>>>       lld/trunk/test/elf/X86_64/outputsegments.test
>>>> Modified:
>>>>       lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h
>>>>       lld/trunk/test/elf/X86_64/alignoffset.test
>>>>       lld/trunk/test/elf/phdr.test
>>>>
>>>> Modified: lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h
>>>> URL:
>>>> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/
>>>> SegmentChunks.h?rev=222312&r1=222311&r2=222312&view=diff
>>>>
>>>> ============================================================
>>>> ==================
>>>> --- lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h (original)
>>>> +++ lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h Tue Nov 18 21:51:48
>>>> 2014
>>>> @@ -406,6 +406,8 @@ void Segment<ELFT>::assignFileOffsets(ui
>>>>      for (auto &slice : slices()) {
>>>>        bool isFirstSection = true;
>>>>        for (auto section : slice->sections()) {
>>>> +      // Align fileoffset to the alignment of the section.
>>>> +      fileOffset = llvm::RoundUpToAlignment(fileOffset,
>>>> section->align2());
>>>>
>>>>   Is this correct? align2 seems to imply that's an exponent. If so, it
>>> had to
>>> be used as 1 << section->align2().
>>>
>> AtomSection::appendAtom handles it and sets the align2 value after
>> shifting.
>>
>> Shankar Easwaran
>>
>> --
>> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
>> by the Linux Foundation
>>
>>


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation




More information about the llvm-commits mailing list