[lld] r228377 - [ELF] Speedup creating program headers.
Shankar Easwaran
shankare at codeaurora.org
Thu Feb 5 20:47:42 PST 2015
On 2/5/2015 10:44 PM, Rui Ueyama wrote:
> On Thu, Feb 5, 2015 at 8:15 PM, Shankar Easwaran <shankare at codeaurora.org>
> wrote:
>
>> Author: shankare
>> Date: Thu Feb 5 22:15:04 2015
>> New Revision: 228377
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=228377&view=rev
>> Log:
>> [ELF] Speedup creating program headers.
>>
>> After the total number of program headers are determined, virtual addresses
>> and file offsets need not be reassigned for sections whose virtual
>> addresses and
>> fileoffsets remained the same.
>>
>> This doesnot change any functionality.
>>
>> Modified:
>> lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
>>
>> Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=228377&r1=228376&r2=228377&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
>> +++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Thu Feb 5 22:15:04 2015
>> @@ -755,7 +755,7 @@ DefaultLayout<ELFT>::assignVirtualAddres
>>
>> std::sort(_segments.begin(), _segments.end(),
>> Segment<ELFT>::compareSegments);
>>
>> - uint64_t virtualAddress = _context.getBaseAddress();
>> + uint64_t baseAddress = _context.getBaseAddress();
>>
>> // HACK: This is a super dirty hack. The elf header and program header
>> are
>> // not part of a section, but we need them to be loaded at the base
>> address
>> @@ -774,6 +774,7 @@ DefaultLayout<ELFT>::assignVirtualAddres
>> firstLoadSegment->prepend(_elfHeader);
>> bool newSegmentHeaderAdded = true;
>> bool virtualAddressAssigned = false;
>> + bool fileOffsetAssigned = false;
>> while (true) {
>> for (auto si : _segments) {
>> si->finalize();
>> @@ -783,8 +784,8 @@ DefaultLayout<ELFT>::assignVirtualAddres
>> }
>> if (!newSegmentHeaderAdded && virtualAddressAssigned)
>> break;
>> - virtualAddressAssigned = true;
>> - uint64_t address = virtualAddress;
>> + uint64_t address = baseAddress;
>> + ;
>>
> Stray ';' here.
Swear this was not there before clang-format, Will clean this up.
Thanks for reviewing.
Shankar Easwaran
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation
More information about the llvm-commits
mailing list