[lld] r297061 - Detemplate merge (input and synthetic) sections. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 6 12:23:57 PST 2017


Author: rafael
Date: Mon Mar  6 14:23:56 2017
New Revision: 297061

URL: http://llvm.org/viewvc/llvm-project?rev=297061&view=rev
Log:
Detemplate merge (input and synthetic) sections. NFC.

Modified:
    lld/trunk/ELF/Driver.cpp
    lld/trunk/ELF/InputFiles.cpp
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/InputSection.h
    lld/trunk/ELF/MarkLive.cpp
    lld/trunk/ELF/OutputSections.h
    lld/trunk/ELF/SyntheticSections.cpp
    lld/trunk/ELF/SyntheticSections.h
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=297061&r1=297060&r2=297061&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Mon Mar  6 14:23:56 2017
@@ -876,7 +876,7 @@ template <class ELFT> void LinkerDriver:
       return;
     if (Decompressor::isCompressedELFSection(S->Flags, S->Name))
       S->uncompress<ELFT>();
-    if (auto *MS = dyn_cast<MergeInputSection<ELFT>>(S))
+    if (auto *MS = dyn_cast<MergeInputSection>(S))
       MS->splitIntoPieces();
   });
 

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=297061&r1=297060&r2=297061&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Mon Mar  6 14:23:56 2017
@@ -381,7 +381,7 @@ elf::ObjectFile<ELFT>::createInputSectio
     if (Target->FirstRelocation)
       fatal(toString(this) +
             ": multiple relocation sections to one section are not supported");
-    if (isa<MergeInputSection<ELFT>>(Target))
+    if (isa<MergeInputSection>(Target))
       fatal(toString(this) +
             ": relocations pointing to SHF_MERGE are not supported");
 
@@ -458,7 +458,7 @@ elf::ObjectFile<ELFT>::createInputSectio
     return make<EhInputSection<ELFT>>(this, &Sec, Name);
 
   if (shouldMerge(Sec))
-    return make<MergeInputSection<ELFT>>(this, &Sec, Name);
+    return make<MergeInputSection>(this, &Sec, Name);
   return make<InputSection>(this, &Sec, Name);
 }
 

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=297061&r1=297060&r2=297061&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Mon Mar  6 14:23:56 2017
@@ -111,7 +111,7 @@ uint64_t InputSectionBase::getOffset(uin
     // identify the start of the output .eh_frame.
     return Offset;
   case Merge:
-    const MergeInputSection<ELFT> *MS = cast<MergeInputSection<ELFT>>(this);
+    const MergeInputSection *MS = cast<MergeInputSection>(this);
     if (MS->MergeSec)
       return MS->MergeSec->OutSecOff + MS->getOffset(Offset);
     return MS->getOffset(Offset);
@@ -121,7 +121,7 @@ uint64_t InputSectionBase::getOffset(uin
 
 template <class ELFT>
 OutputSection *InputSectionBase::getOutputSection() const {
-  if (auto *MS = dyn_cast<MergeInputSection<ELFT>>(this))
+  if (auto *MS = dyn_cast<MergeInputSection>(this))
     return MS->MergeSec ? MS->MergeSec->OutSec : nullptr;
   if (auto *EH = dyn_cast<EhInputSection<ELFT>>(this))
     return EH->EHSec->OutSec;
@@ -660,9 +660,7 @@ static size_t findNull(ArrayRef<uint8_t>
 
 // Split SHF_STRINGS section. Such section is a sequence of
 // null-terminated strings.
-template <class ELFT>
-void MergeInputSection<ELFT>::splitStrings(ArrayRef<uint8_t> Data,
-                                           size_t EntSize) {
+void MergeInputSection::splitStrings(ArrayRef<uint8_t> Data, size_t EntSize) {
   size_t Off = 0;
   bool IsAlloc = this->Flags & SHF_ALLOC;
   while (!Data.empty()) {
@@ -679,9 +677,8 @@ void MergeInputSection<ELFT>::splitStrin
 
 // Split non-SHF_STRINGS section. Such section is a sequence of
 // fixed size records.
-template <class ELFT>
-void MergeInputSection<ELFT>::splitNonStrings(ArrayRef<uint8_t> Data,
-                                              size_t EntSize) {
+void MergeInputSection::splitNonStrings(ArrayRef<uint8_t> Data,
+                                        size_t EntSize) {
   size_t Size = Data.size();
   assert((Size % EntSize) == 0);
   bool IsAlloc = this->Flags & SHF_ALLOC;
@@ -692,9 +689,9 @@ void MergeInputSection<ELFT>::splitNonSt
 }
 
 template <class ELFT>
-MergeInputSection<ELFT>::MergeInputSection(elf::ObjectFile<ELFT> *F,
-                                           const Elf_Shdr *Header,
-                                           StringRef Name)
+MergeInputSection::MergeInputSection(elf::ObjectFile<ELFT> *F,
+                                     const typename ELFT::Shdr *Header,
+                                     StringRef Name)
     : InputSectionBase(F, Header, Name, InputSectionBase::Merge) {}
 
 // This function is called after we obtain a complete list of input sections
@@ -703,28 +700,26 @@ MergeInputSection<ELFT>::MergeInputSecti
 //
 // Note that this function is called from parallel_for_each. This must be
 // thread-safe (i.e. no memory allocation from the pools).
-template <class ELFT> void MergeInputSection<ELFT>::splitIntoPieces() {
+void MergeInputSection::splitIntoPieces() {
   ArrayRef<uint8_t> Data = this->Data;
-  uintX_t EntSize = this->Entsize;
+  uint64_t EntSize = this->Entsize;
   if (this->Flags & SHF_STRINGS)
     splitStrings(Data, EntSize);
   else
     splitNonStrings(Data, EntSize);
 
   if (Config->GcSections && (this->Flags & SHF_ALLOC))
-    for (uintX_t Off : LiveOffsets)
+    for (uint64_t Off : LiveOffsets)
       this->getSectionPiece(Off)->Live = true;
 }
 
-template <class ELFT>
-bool MergeInputSection<ELFT>::classof(const InputSectionBase *S) {
+bool MergeInputSection::classof(const InputSectionBase *S) {
   return S->kind() == InputSectionBase::Merge;
 }
 
 // Do binary search to get a section piece at a given input offset.
-template <class ELFT>
-SectionPiece *MergeInputSection<ELFT>::getSectionPiece(uintX_t Offset) {
-  auto *This = static_cast<const MergeInputSection<ELFT> *>(this);
+SectionPiece *MergeInputSection::getSectionPiece(uint64_t Offset) {
+  auto *This = static_cast<const MergeInputSection *>(this);
   return const_cast<SectionPiece *>(This->getSectionPiece(Offset));
 }
 
@@ -741,17 +736,15 @@ static It fastUpperBound(It First, It La
   return Comp(Value, *First) ? First : First + 1;
 }
 
-template <class ELFT>
-const SectionPiece *
-MergeInputSection<ELFT>::getSectionPiece(uintX_t Offset) const {
-  uintX_t Size = this->Data.size();
+const SectionPiece *MergeInputSection::getSectionPiece(uint64_t Offset) const {
+  uint64_t Size = this->Data.size();
   if (Offset >= Size)
     fatal(toString(this) + ": entry is past the end of the section");
 
   // Find the element this offset points to.
   auto I = fastUpperBound(
       Pieces.begin(), Pieces.end(), Offset,
-      [](const uintX_t &A, const SectionPiece &B) { return A < B.InputOff; });
+      [](const uint64_t &A, const SectionPiece &B) { return A < B.InputOff; });
   --I;
   return &*I;
 }
@@ -759,8 +752,7 @@ MergeInputSection<ELFT>::getSectionPiece
 // Returns the offset in an output section for a given input offset.
 // Because contents of a mergeable section is not contiguous in output,
 // it is not just an addition to a base output offset.
-template <class ELFT>
-typename ELFT::uint MergeInputSection<ELFT>::getOffset(uintX_t Offset) const {
+uint64_t MergeInputSection::getOffset(uint64_t Offset) const {
   // Initialize OffsetMap lazily.
   std::call_once(InitOffsetMap, [&] {
     OffsetMap.reserve(Pieces.size());
@@ -782,7 +774,7 @@ typename ELFT::uint MergeInputSection<EL
   if (!Piece.Live)
     return 0;
 
-  uintX_t Addend = Offset - Piece.InputOff;
+  uint64_t Addend = Offset - Piece.InputOff;
   return Piece.OutputOff + Addend;
 }
 
@@ -814,11 +806,6 @@ template class elf::EhInputSection<ELF32
 template class elf::EhInputSection<ELF64LE>;
 template class elf::EhInputSection<ELF64BE>;
 
-template class elf::MergeInputSection<ELF32LE>;
-template class elf::MergeInputSection<ELF32BE>;
-template class elf::MergeInputSection<ELF64LE>;
-template class elf::MergeInputSection<ELF64BE>;
-
 template void InputSectionBase::uncompress<ELF32LE>();
 template void InputSectionBase::uncompress<ELF32BE>();
 template void InputSectionBase::uncompress<ELF64LE>();
@@ -862,3 +849,16 @@ template elf::ObjectFile<ELF32LE> *Input
 template elf::ObjectFile<ELF32BE> *InputSectionBase::getFile<ELF32BE>() const;
 template elf::ObjectFile<ELF64LE> *InputSectionBase::getFile<ELF64LE>() const;
 template elf::ObjectFile<ELF64BE> *InputSectionBase::getFile<ELF64BE>() const;
+
+template MergeInputSection::MergeInputSection(elf::ObjectFile<ELF32LE> *F,
+                                              const ELF32LE::Shdr *Header,
+                                              StringRef Name);
+template MergeInputSection::MergeInputSection(elf::ObjectFile<ELF32BE> *F,
+                                              const ELF32BE::Shdr *Header,
+                                              StringRef Name);
+template MergeInputSection::MergeInputSection(elf::ObjectFile<ELF64LE> *F,
+                                              const ELF64LE::Shdr *Header,
+                                              StringRef Name);
+template MergeInputSection::MergeInputSection(elf::ObjectFile<ELF64BE> *F,
+                                              const ELF64BE::Shdr *Header,
+                                              StringRef Name);

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=297061&r1=297060&r2=297061&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Mon Mar  6 14:23:56 2017
@@ -29,7 +29,7 @@ struct SectionPiece;
 
 class DefinedRegular;
 template <class ELFT> class EhFrameSection;
-template <class ELFT> class MergeSyntheticSection;
+class MergeSyntheticSection;
 template <class ELFT> class ObjectFile;
 class OutputSection;
 
@@ -156,26 +156,23 @@ static_assert(sizeof(SectionPiece) == 2
               "SectionPiece is too big");
 
 // This corresponds to a SHF_MERGE section of an input file.
-template <class ELFT> class MergeInputSection : public InputSectionBase {
-  typedef typename ELFT::uint uintX_t;
-  typedef typename ELFT::Sym Elf_Sym;
-  typedef typename ELFT::Shdr Elf_Shdr;
-
+class MergeInputSection : public InputSectionBase {
 public:
-  MergeInputSection(ObjectFile<ELFT> *F, const Elf_Shdr *Header,
+  template <class ELFT>
+  MergeInputSection(ObjectFile<ELFT> *F, const typename ELFT::Shdr *Header,
                     StringRef Name);
   static bool classof(const InputSectionBase *S);
   void splitIntoPieces();
 
   // Mark the piece at a given offset live. Used by GC.
-  void markLiveAt(uintX_t Offset) {
+  void markLiveAt(uint64_t Offset) {
     assert(this->Flags & llvm::ELF::SHF_ALLOC);
     LiveOffsets.insert(Offset);
   }
 
   // Translate an offset in the input section to an offset
   // in the output section.
-  uintX_t getOffset(uintX_t Offset) const;
+  uint64_t getOffset(uint64_t Offset) const;
 
   // Splittable sections are handled as a sequence of data
   // rather than a single large blob of data.
@@ -197,13 +194,13 @@ public:
   }
 
   // Returns the SectionPiece at a given input section offset.
-  SectionPiece *getSectionPiece(uintX_t Offset);
-  const SectionPiece *getSectionPiece(uintX_t Offset) const;
+  SectionPiece *getSectionPiece(uint64_t Offset);
+  const SectionPiece *getSectionPiece(uint64_t Offset) const;
 
   // MergeInputSections are aggregated to a synthetic input sections,
   // and then added to an OutputSection. This pointer points to a
   // synthetic MergeSyntheticSection which this section belongs to.
-  MergeSyntheticSection<ELFT> *MergeSec = nullptr;
+  MergeSyntheticSection *MergeSec = nullptr;
 
 private:
   void splitStrings(ArrayRef<uint8_t> A, size_t Size);
@@ -211,10 +208,10 @@ private:
 
   std::vector<uint32_t> Hashes;
 
-  mutable llvm::DenseMap<uintX_t, uintX_t> OffsetMap;
+  mutable llvm::DenseMap<uint64_t, uint64_t> OffsetMap;
   mutable std::once_flag InitOffsetMap;
 
-  llvm::DenseSet<uintX_t> LiveOffsets;
+  llvm::DenseSet<uint64_t> LiveOffsets;
 };
 
 struct EhSectionPiece : public SectionPiece {

Modified: lld/trunk/ELF/MarkLive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MarkLive.cpp?rev=297061&r1=297060&r2=297061&view=diff
==============================================================================
--- lld/trunk/ELF/MarkLive.cpp (original)
+++ lld/trunk/ELF/MarkLive.cpp Mon Mar  6 14:23:56 2017
@@ -210,7 +210,7 @@ template <class ELFT> void elf::markLive
     // Usually, a whole section is marked as live or dead, but in mergeable
     // (splittable) sections, each piece of data has independent liveness bit.
     // So we explicitly tell it which offset is in use.
-    if (auto *MS = dyn_cast<MergeInputSection<ELFT>>(R.Sec))
+    if (auto *MS = dyn_cast<MergeInputSection>(R.Sec))
       MS->markLiveAt(R.Offset);
 
     if (R.Sec->Live)

Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=297061&r1=297060&r2=297061&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Mon Mar  6 14:23:56 2017
@@ -26,7 +26,7 @@ struct EhSectionPiece;
 template <class ELFT> class EhInputSection;
 class InputSection;
 class InputSectionBase;
-template <class ELFT> class MergeInputSection;
+class MergeInputSection;
 class OutputSection;
 template <class ELFT> class ObjectFile;
 template <class ELFT> class SharedFile;

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=297061&r1=297060&r2=297061&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Mon Mar  6 14:23:56 2017
@@ -110,14 +110,15 @@ static ArrayRef<uint8_t> getVersion() {
 // With this feature, you can identify LLD-generated binaries easily
 // by "objdump -s -j .comment <file>".
 // The returned object is a mergeable string section.
-template <class ELFT> MergeInputSection<ELFT> *elf::createCommentSection() {
+template <class ELFT> MergeInputSection *elf::createCommentSection() {
   typename ELFT::Shdr Hdr = {};
   Hdr.sh_flags = SHF_MERGE | SHF_STRINGS;
   Hdr.sh_type = SHT_PROGBITS;
   Hdr.sh_entsize = 1;
   Hdr.sh_addralign = 1;
 
-  auto *Ret = make<MergeInputSection<ELFT>>(/*file=*/nullptr, &Hdr, ".comment");
+  auto *Ret =
+      make<MergeInputSection>((ObjectFile<ELFT> *)nullptr, &Hdr, ".comment");
   Ret->Data = getVersion();
   Ret->splitIntoPieces();
   return Ret;
@@ -2134,34 +2135,27 @@ template <class ELFT> bool VersionNeedSe
   return getNeedNum() == 0;
 }
 
-template <class ELFT>
-MergeSyntheticSection<ELFT>::MergeSyntheticSection(StringRef Name,
-                                                   uint32_t Type,
-                                                   uint64_t Flags,
-                                                   uint64_t Alignment)
+MergeSyntheticSection::MergeSyntheticSection(StringRef Name, uint32_t Type,
+                                             uint64_t Flags, uint64_t Alignment)
     : SyntheticSection(Flags, Type, Alignment, Name),
       Builder(StringTableBuilder::RAW, Alignment) {}
 
-template <class ELFT>
-void MergeSyntheticSection<ELFT>::addSection(MergeInputSection<ELFT> *MS) {
+void MergeSyntheticSection::addSection(MergeInputSection *MS) {
   assert(!Finalized);
   MS->MergeSec = this;
   Sections.push_back(MS);
 }
 
-template <class ELFT> void MergeSyntheticSection<ELFT>::writeTo(uint8_t *Buf) {
-  Builder.write(Buf);
-}
+void MergeSyntheticSection::writeTo(uint8_t *Buf) { Builder.write(Buf); }
 
-template <class ELFT>
-bool MergeSyntheticSection<ELFT>::shouldTailMerge() const {
+bool MergeSyntheticSection::shouldTailMerge() const {
   return (this->Flags & SHF_STRINGS) && Config->Optimize >= 2;
 }
 
-template <class ELFT> void MergeSyntheticSection<ELFT>::finalizeTailMerge() {
+void MergeSyntheticSection::finalizeTailMerge() {
   // Add all string pieces to the string table builder to create section
   // contents.
-  for (MergeInputSection<ELFT> *Sec : Sections)
+  for (MergeInputSection *Sec : Sections)
     for (size_t I = 0, E = Sec->Pieces.size(); I != E; ++I)
       if (Sec->Pieces[I].Live)
         Builder.add(Sec->getData(I));
@@ -2172,18 +2166,18 @@ template <class ELFT> void MergeSyntheti
   // finalize() fixed tail-optimized strings, so we can now get
   // offsets of strings. Get an offset for each string and save it
   // to a corresponding StringPiece for easy access.
-  for (MergeInputSection<ELFT> *Sec : Sections)
+  for (MergeInputSection *Sec : Sections)
     for (size_t I = 0, E = Sec->Pieces.size(); I != E; ++I)
       if (Sec->Pieces[I].Live)
         Sec->Pieces[I].OutputOff = Builder.getOffset(Sec->getData(I));
 }
 
-template <class ELFT> void MergeSyntheticSection<ELFT>::finalizeNoTailMerge() {
+void MergeSyntheticSection::finalizeNoTailMerge() {
   // Add all string pieces to the string table builder to create section
   // contents. Because we are not tail-optimizing, offsets of strings are
   // fixed when they are added to the builder (string table builder contains
   // a hash table from strings to offsets).
-  for (MergeInputSection<ELFT> *Sec : Sections)
+  for (MergeInputSection *Sec : Sections)
     for (size_t I = 0, E = Sec->Pieces.size(); I != E; ++I)
       if (Sec->Pieces[I].Live)
         Sec->Pieces[I].OutputOff = Builder.add(Sec->getData(I));
@@ -2191,7 +2185,7 @@ template <class ELFT> void MergeSyntheti
   Builder.finalizeInOrder();
 }
 
-template <class ELFT> void MergeSyntheticSection<ELFT>::finalizeContents() {
+void MergeSyntheticSection::finalizeContents() {
   if (Finalized)
     return;
   Finalized = true;
@@ -2201,9 +2195,9 @@ template <class ELFT> void MergeSyntheti
     finalizeNoTailMerge();
 }
 
-template <class ELFT> size_t MergeSyntheticSection<ELFT>::getSize() const {
+size_t MergeSyntheticSection::getSize() const {
   // We should finalize string builder to know the size.
-  const_cast<MergeSyntheticSection<ELFT> *>(this)->finalizeContents();
+  const_cast<MergeSyntheticSection *>(this)->finalizeContents();
   return Builder.getSize();
 }
 
@@ -2273,10 +2267,10 @@ template InputSection *elf::createCommon
 template InputSection *elf::createCommonSection<ELF64LE>();
 template InputSection *elf::createCommonSection<ELF64BE>();
 
-template MergeInputSection<ELF32LE> *elf::createCommentSection();
-template MergeInputSection<ELF32BE> *elf::createCommentSection();
-template MergeInputSection<ELF64LE> *elf::createCommentSection();
-template MergeInputSection<ELF64BE> *elf::createCommentSection();
+template MergeInputSection *elf::createCommentSection<ELF32LE>();
+template MergeInputSection *elf::createCommentSection<ELF32BE>();
+template MergeInputSection *elf::createCommentSection<ELF64LE>();
+template MergeInputSection *elf::createCommentSection<ELF64BE>();
 
 template SymbolBody *elf::addSyntheticLocal<ELF32LE>(StringRef, uint8_t,
                                                      uint64_t, uint64_t,
@@ -2396,11 +2390,6 @@ template class elf::VersionDefinitionSec
 template class elf::VersionDefinitionSection<ELF64LE>;
 template class elf::VersionDefinitionSection<ELF64BE>;
 
-template class elf::MergeSyntheticSection<ELF32LE>;
-template class elf::MergeSyntheticSection<ELF32BE>;
-template class elf::MergeSyntheticSection<ELF64LE>;
-template class elf::MergeSyntheticSection<ELF64BE>;
-
 template class elf::MipsRldMapSection<ELF32LE>;
 template class elf::MipsRldMapSection<ELF32BE>;
 template class elf::MipsRldMapSection<ELF64LE>;

Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=297061&r1=297060&r2=297061&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Mon Mar  6 14:23:56 2017
@@ -640,12 +640,11 @@ public:
 // with different attributes in a single output sections. To do that
 // we put them into MergeSyntheticSection synthetic input sections which are
 // attached to regular output sections.
-template <class ELFT>
 class MergeSyntheticSection final : public SyntheticSection {
 public:
   MergeSyntheticSection(StringRef Name, uint32_t Type, uint64_t Flags,
                         uint64_t Alignment);
-  void addSection(MergeInputSection<ELFT> *MS);
+  void addSection(MergeInputSection *MS);
   void writeTo(uint8_t *Buf) override;
   void finalizeContents() override;
   bool shouldTailMerge() const;
@@ -657,7 +656,7 @@ private:
 
   bool Finalized = false;
   llvm::StringTableBuilder Builder;
-  std::vector<MergeInputSection<ELFT> *> Sections;
+  std::vector<MergeInputSection *> Sections;
 };
 
 // .MIPS.abiflags section.
@@ -751,7 +750,7 @@ private:
 
 template <class ELFT> InputSection *createCommonSection();
 InputSection *createInterpSection();
-template <class ELFT> MergeInputSection<ELFT> *createCommentSection();
+template <class ELFT> MergeInputSection *createCommentSection();
 template <class ELFT>
 SymbolBody *addSyntheticLocal(StringRef Name, uint8_t Type, uint64_t Value,
                               uint64_t Size, InputSectionBase *Section);

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=297061&r1=297060&r2=297061&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Mar  6 14:23:56 2017
@@ -163,9 +163,9 @@ static typename ELFT::uint getOutFlags(I
 template <class ELFT> static void combineMergableSections() {
   typedef typename ELFT::uint uintX_t;
 
-  std::vector<MergeSyntheticSection<ELFT> *> MergeSections;
+  std::vector<MergeSyntheticSection *> MergeSections;
   for (InputSectionBase *&S : InputSections) {
-    MergeInputSection<ELFT> *MS = dyn_cast<MergeInputSection<ELFT>>(S);
+    MergeInputSection *MS = dyn_cast<MergeInputSection>(S);
     if (!MS)
       continue;
 
@@ -179,13 +179,13 @@ template <class ELFT> static void combin
     uintX_t Alignment = std::max<uintX_t>(MS->Alignment, MS->Entsize);
 
     auto I =
-        llvm::find_if(MergeSections, [=](MergeSyntheticSection<ELFT> *Sec) {
+        llvm::find_if(MergeSections, [=](MergeSyntheticSection *Sec) {
           return Sec->Name == OutsecName && Sec->Flags == Flags &&
                  Sec->Alignment == Alignment;
         });
     if (I == MergeSections.end()) {
-      MergeSyntheticSection<ELFT> *Syn = make<MergeSyntheticSection<ELFT>>(
-          OutsecName, MS->Type, Flags, Alignment);
+      MergeSyntheticSection *Syn =
+          make<MergeSyntheticSection>(OutsecName, MS->Type, Flags, Alignment);
       MergeSections.push_back(Syn);
       I = std::prev(MergeSections.end());
       S = Syn;
@@ -491,7 +491,7 @@ template <class ELFT> static bool includ
     // Exclude symbols pointing to garbage-collected sections.
     if (!D->Section->Live)
       return false;
-    if (auto *S = dyn_cast<MergeInputSection<ELFT>>(D->Section))
+    if (auto *S = dyn_cast<MergeInputSection>(D->Section))
       if (!S->getSectionPiece(D->Value)->Live)
         return false;
   }




More information about the llvm-commits mailing list