[lld] r298346 - [ELF] - Detemplate InputSectionBase::getLinkOrderDep(). NFC.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 01:29:48 PDT 2017


Author: grimar
Date: Tue Mar 21 03:29:48 2017
New Revision: 298346

URL: http://llvm.org/viewvc/llvm-project?rev=298346&view=rev
Log:
[ELF] - Detemplate InputSectionBase::getLinkOrderDep(). NFC.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/InputSection.h
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/SyntheticSections.cpp

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=298346&r1=298345&r2=298346&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Tue Mar 21 03:29:48 2017
@@ -162,10 +162,9 @@ uint64_t SectionBase::getOffset(const De
   return getOffset(Sym.Value);
 }
 
-template <class ELFT>
 InputSectionBase *InputSectionBase::getLinkOrderDep() const {
   if ((Flags & SHF_LINK_ORDER) && Link != 0)
-    return getFile<ELFT>()->getSections()[Link];
+    return File->getSections()[Link];
   return nullptr;
 }
 
@@ -830,11 +829,6 @@ template void InputSectionBase::uncompre
 template void InputSectionBase::uncompress<ELF64LE>();
 template void InputSectionBase::uncompress<ELF64BE>();
 
-template InputSectionBase *InputSectionBase::getLinkOrderDep<ELF32LE>() const;
-template InputSectionBase *InputSectionBase::getLinkOrderDep<ELF32BE>() const;
-template InputSectionBase *InputSectionBase::getLinkOrderDep<ELF64LE>() const;
-template InputSectionBase *InputSectionBase::getLinkOrderDep<ELF64BE>() const;
-
 template InputSectionBase *InputSection::getRelocatedSection<ELF32LE>();
 template InputSectionBase *InputSection::getRelocatedSection<ELF32BE>();
 template InputSectionBase *InputSection::getRelocatedSection<ELF64LE>();

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=298346&r1=298345&r2=298346&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Tue Mar 21 03:29:48 2017
@@ -157,7 +157,7 @@ public:
     return getFile<ELFT>()->getObj();
   }
 
-  template <class ELFT> InputSectionBase *getLinkOrderDep() const;
+  InputSectionBase *getLinkOrderDep() const;
 
   template <class ELFT> void uncompress();
 

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=298346&r1=298345&r2=298346&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Tue Mar 21 03:29:48 2017
@@ -69,14 +69,13 @@ OutputSection::OutputSection(StringRef N
                   /*Info*/ 0,
                   /*Link*/ 0) {}
 
-template <typename ELFT>
 static bool compareByFilePosition(InputSection *A, InputSection *B) {
   // Synthetic doesn't have link order dependecy, stable_sort will keep it last
   if (A->kind() == InputSectionBase::Synthetic ||
       B->kind() == InputSectionBase::Synthetic)
     return false;
-  auto *LA = cast<InputSection>(A->template getLinkOrderDep<ELFT>());
-  auto *LB = cast<InputSection>(B->template getLinkOrderDep<ELFT>());
+  auto *LA = cast<InputSection>(A->getLinkOrderDep());
+  auto *LB = cast<InputSection>(B->getLinkOrderDep());
   OutputSection *AOut = LA->OutSec;
   OutputSection *BOut = LB->OutSec;
   if (AOut != BOut)
@@ -86,14 +85,14 @@ static bool compareByFilePosition(InputS
 
 template <class ELFT> void OutputSection::finalize() {
   if ((this->Flags & SHF_LINK_ORDER) && !this->Sections.empty()) {
-    std::sort(Sections.begin(), Sections.end(), compareByFilePosition<ELFT>);
+    std::sort(Sections.begin(), Sections.end(), compareByFilePosition);
     assignOffsets();
 
     // We must preserve the link order dependency of sections with the
     // SHF_LINK_ORDER flag. The dependency is indicated by the sh_link field. We
     // need to translate the InputSection sh_link to the OutputSection sh_link,
     // all InputSections in the OutputSection have the same dependency.
-    if (auto *D = this->Sections.front()->template getLinkOrderDep<ELFT>())
+    if (auto *D = this->Sections.front()->getLinkOrderDep())
       this->Link = D->OutSec->SectionIndex;
   }
 

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=298346&r1=298345&r2=298346&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Tue Mar 21 03:29:48 2017
@@ -2196,7 +2196,7 @@ void ARMExidxSentinelSection<ELFT>::writ
   // Get the InputSection before us, we are by definition last
   auto RI = cast<OutputSection>(this->OutSec)->Sections.rbegin();
   InputSection *LE = *(++RI);
-  InputSection *LC = cast<InputSection>(LE->template getLinkOrderDep<ELFT>());
+  InputSection *LC = cast<InputSection>(LE->getLinkOrderDep());
   uint64_t S = LC->OutSec->Addr + LC->getOffset(LC->getSize());
   uint64_t P = this->getVA();
   Target->relocateOne(Buf, R_ARM_PREL31, S - P);




More information about the llvm-commits mailing list