[lld] r239235 - COFF: Inline a constant that is used only once.
    Rui Ueyama 
    ruiu at google.com
       
    Sat Jun  6 16:19:36 PDT 2015
    
    
  
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) {
    
    
More information about the llvm-commits
mailing list