[lld] r239235 - COFF: Inline a constant that is used only once.
Rui Ueyama
ruiu at google.com
Mon Jun 8 20:26:26 PDT 2015
I don't know how to name the constant -- the original name was wrong.
HeaderSize didn't actually include secion tables size. There's no clear
boundary between data directory and section table.
On Mon, Jun 8, 2015 at 7:25 PM, Sean Silva <chisophugis at gmail.com> wrote:
> It is probably still useful to keep the constant named, but just make it a
> local constant.
>
> On Sat, Jun 6, 2015 at 4:19 PM, Rui Ueyama <ruiu at google.com> wrote:
>
>> Author: ruiu
>> Date: Sat Jun 6 18:19:36 2015
>> New Revision: 239235
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=239235&view=rev
>> Log:
>> COFF: Inline a constant that is used only once.
>>
>> Modified:
>> lld/trunk/COFF/Writer.cpp
>>
>> Modified: lld/trunk/COFF/Writer.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=239235&r1=239234&r2=239235&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/COFF/Writer.cpp (original)
>> +++ lld/trunk/COFF/Writer.cpp Sat Jun 6 18:19:36 2015
>> @@ -33,9 +33,6 @@ static const int FileAlignment = 512;
>> static const int SectionAlignment = 4096;
>> static const int DOSStubSize = 64;
>> static const int NumberfOfDataDirectory = 16;
>> -static const int HeaderSize =
>> - DOSStubSize + sizeof(PEMagic) + sizeof(coff_file_header) +
>> - sizeof(pe32plus_header) + sizeof(data_directory) *
>> NumberfOfDataDirectory;
>>
>> namespace lld {
>> namespace coff {
>> @@ -166,7 +163,10 @@ void Writer::removeEmptySections() {
>> // file offsets.
>> void Writer::assignAddresses() {
>> SizeOfHeaders = RoundUpToAlignment(
>> - HeaderSize + sizeof(coff_section) * OutputSections.size(),
>> PageSize);
>> + DOSStubSize + sizeof(PEMagic) + sizeof(coff_file_header) +
>> + sizeof(pe32plus_header) +
>> + sizeof(data_directory) * NumberfOfDataDirectory +
>> + sizeof(coff_section) * OutputSections.size(), PageSize);
>> uint64_t RVA = 0x1000; // The first page is kept unmapped.
>> uint64_t FileOff = SizeOfHeaders;
>> for (OutputSection *Sec : OutputSections) {
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150608/b013cf5d/attachment.html>
More information about the llvm-commits
mailing list