[lld] r256348 - Move function to the file where it is used.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 23 12:37:52 PST 2015


Author: rafael
Date: Wed Dec 23 14:37:51 2015
New Revision: 256348

URL: http://llvm.org/viewvc/llvm-project?rev=256348&view=rev
Log:
Move function to the file where it is used.

Modified:
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/OutputSections.h
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=256348&r1=256347&r2=256348&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Wed Dec 23 14:37:51 2015
@@ -1166,18 +1166,6 @@ template <class ELFT> void StringTableSe
   memcpy(Buf, Data.data(), Data.size());
 }
 
-template <class ELFT> bool lld::elf2::includeInSymtab(const SymbolBody &B) {
-  if (!B.isUsedInRegularObj())
-    return false;
-
-  // Don't include synthetic symbols like __init_array_start in every output.
-  if (auto *U = dyn_cast<DefinedAbsolute<ELFT>>(&B))
-    if (&U->Sym == &DefinedAbsolute<ELFT>::IgnoreUndef)
-      return false;
-
-  return true;
-}
-
 bool lld::elf2::includeInDynamicSymtab(const SymbolBody &B) {
   uint8_t V = B.getVisibility();
   if (V != STV_DEFAULT && V != STV_PROTECTED)
@@ -1527,11 +1515,6 @@ getLocalRelTarget(const ObjectFile<ELF64
                   const ELFFile<ELF64BE>::Elf_Rel &,
                   ELFFile<ELF64BE>::uintX_t Addend);
 
-template bool includeInSymtab<ELF32LE>(const SymbolBody &);
-template bool includeInSymtab<ELF32BE>(const SymbolBody &);
-template bool includeInSymtab<ELF64LE>(const SymbolBody &);
-template bool includeInSymtab<ELF64BE>(const SymbolBody &);
-
 template bool shouldKeepInSymtab<ELF32LE>(const ObjectFile<ELF32LE> &,
                                           StringRef,
                                           const ELFFile<ELF32LE>::Elf_Sym &);

Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=256348&r1=256347&r2=256348&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Wed Dec 23 14:37:51 2015
@@ -61,7 +61,6 @@ getLocalRelTarget(const ObjectFile<ELFT>
                   const llvm::object::Elf_Rel_Impl<ELFT, IsRela> &Rel,
                   typename llvm::object::ELFFile<ELFT>::uintX_t Addend);
 bool canBePreempted(const SymbolBody *Body, bool NeedsGot);
-template <class ELFT> bool includeInSymtab(const SymbolBody &B);
 
 bool includeInDynamicSymtab(const SymbolBody &B);
 

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=256348&r1=256347&r2=256348&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Dec 23 14:37:51 2015
@@ -596,6 +596,18 @@ static void addIRelocMarkers(SymbolTable
             DefinedAbsolute<ELFT>::RelaIpltEnd);
 }
 
+template <class ELFT> static bool includeInSymtab(const SymbolBody &B) {
+  if (!B.isUsedInRegularObj())
+    return false;
+
+  // Don't include synthetic symbols like __init_array_start in every output.
+  if (auto *U = dyn_cast<DefinedAbsolute<ELFT>>(&B))
+    if (&U->Sym == &DefinedAbsolute<ELFT>::IgnoreUndef)
+      return false;
+
+  return true;
+}
+
 // Create output section objects and add them to OutputSections.
 template <class ELFT> void Writer<ELFT>::createSections() {
   // .interp needs to be on the first page in the output file.




More information about the llvm-commits mailing list