[llvm] r319090 - COFF: Do not create SectionChunks for discarded comdat sections.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 12:42:34 PST 2017


Author: pcc
Date: Mon Nov 27 12:42:34 2017
New Revision: 319090

URL: http://llvm.org/viewvc/llvm-project?rev=319090&view=rev
Log:
COFF: Do not create SectionChunks for discarded comdat sections.

With this change, instead of creating a SectionChunk for each section
in the object file, we only create them when we encounter a prevailing
comdat section.

Also change how symbol resolution occurs between comdat symbols. Now
only the comdat leader participates in comdat resolution, and not any
other external associated symbols. This is more in line with how COFF
semantics are defined, and should allow for a more straightforward
implementation of non-ANY comdat types.

On my machine, this change reduces our runtime linking a release
build of chrome_child.dll with /nopdb from 5.65s to 4.54s (median of
50 runs).

Differential Revision: https://reviews.llvm.org/D40238

Modified:
    llvm/trunk/include/llvm/Object/COFF.h

Modified: llvm/trunk/include/llvm/Object/COFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFF.h?rev=319090&r1=319089&r2=319090&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/COFF.h (original)
+++ llvm/trunk/include/llvm/Object/COFF.h Mon Nov 27 12:42:34 2017
@@ -275,6 +275,8 @@ struct coff_symbol_generic {
   support::ulittle32_t Value;
 };
 
+struct coff_aux_section_definition;
+
 class COFFSymbolRef {
 public:
   COFFSymbolRef() = default;
@@ -346,6 +348,18 @@ public:
     return (getType() & 0xF0) >> COFF::SCT_COMPLEX_TYPE_SHIFT;
   }
 
+  template <typename T> const T *getAux() const {
+    return CS16 ? reinterpret_cast<const T *>(CS16 + 1)
+                : reinterpret_cast<const T *>(CS32 + 1);
+  }
+
+  const coff_aux_section_definition *getSectionDefinition() const {
+    if (!getNumberOfAuxSymbols() ||
+        getStorageClass() != COFF::IMAGE_SYM_CLASS_STATIC)
+      return nullptr;
+    return getAux<coff_aux_section_definition>();
+  }
+
   bool isAbsolute() const {
     return getSectionNumber() == -1;
   }




More information about the llvm-commits mailing list