[ELF2] Use static non-member function when it suffices.
Pointed out by Rui Ueyama.
llvm-svn: 248559
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index 04036d0..ccff1d3 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -272,15 +272,6 @@
return true;
}
-template <class ELFT>
-bool SymbolTableSection<ELFT>::shouldKeepInSymtab(StringRef SymName) {
- if (Config->DiscardNone)
- return true;
-
- // ELF defines dynamic locals as symbols which name starts with ".L".
- return !(Config->DiscardLocals && SymName.startswith(".L"));
-}
-
bool lld::elf2::includeInDynamicSymtab(const SymbolBody &B) {
if (Config->ExportDynamic || Config->Shared)
return true;
diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h
index c40ee88..8cb7e10 100644
--- a/lld/ELF/OutputSections.h
+++ b/lld/ELF/OutputSections.h
@@ -15,6 +15,8 @@
#include "llvm/MC/StringTableBuilder.h"
#include "llvm/Object/ELF.h"
+#include "Config.h"
+
#include <type_traits>
namespace lld {
@@ -41,6 +43,14 @@
bool includeInSymtab(const SymbolBody &B);
bool includeInDynamicSymtab(const SymbolBody &B);
+static bool shouldKeepInSymtab(StringRef SymName) {
+ if (Config->DiscardNone)
+ return true;
+
+ // ELF defines dynamic locals as symbols which name starts with ".L".
+ return !(Config->DiscardLocals && SymName.startswith(".L"));
+}
+
// This represents a section in an output file.
// Different sub classes represent different types of sections. Some contain
// input sections, others are created by the linker.
@@ -186,8 +196,6 @@
++NumLocals;
}
- bool shouldKeepInSymtab(StringRef Name);
-
StringTableSection<ELFT::Is64Bits> &getStrTabSec() const { return StrTabSec; }
unsigned getNumSymbols() const { return NumVisible + 1; }
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index d690fad..ec2baeb 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -314,7 +314,7 @@
Elf_Sym_Range Syms = File.getLocalSymbols();
for (const Elf_Sym &Sym : Syms) {
ErrorOr<StringRef> SymName = Sym.getName(File.getStringTable());
- if (SymName && SymTabSec.shouldKeepInSymtab(*SymName))
+ if (SymName && shouldKeepInSymtab(*SymName))
SymTabSec.addSymbol(*SymName, true);
}
}