[PATCH] [lld][PECOFF] Take into account all sections when setting size fields in the PE header

Rui Ueyama ruiu at google.com
Fri Sep 13 11:03:47 PDT 2013



================
Comment at: lib/ReaderWriter/PECOFF/WriterPECOFF.cpp:472
@@ +471,3 @@
+  
+  virtual bool isCodeSection() {
+    return _sectionHeader.Characteristics & llvm::COFF::IMAGE_SCN_CNT_CODE;
----------------
Why virtual?

================
Comment at: lib/ReaderWriter/PECOFF/WriterPECOFF.cpp:923
@@ +922,3 @@
+  
+  uint64_t calcSizeOfInitializedData() {
+    uint64_t ret = 0;
----------------
I'd define a helper function calculateSectionSize(SectionCharacteristics) containing the for loop and use it in the following three functions, rather than repeating the same loop three times.


http://llvm-reviews.chandlerc.com/D1616



More information about the llvm-commits mailing list