summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-05-05 16:40:28 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-05-05 16:40:28 +0000
commit474eb019b4cdad4d2cc6348e133bbc23637ef9bf (patch)
tree66fd37f04f1f079bba96ca880be23013297790e8
parent501e739d8a668ddcad2c240f077d0e1f4450a764 (diff)
downloadbcm5719-llvm-474eb019b4cdad4d2cc6348e133bbc23637ef9bf.tar.gz
bcm5719-llvm-474eb019b4cdad4d2cc6348e133bbc23637ef9bf.zip
Move static function to avoid forward declaration. NFC.
llvm-svn: 268646
-rw-r--r--lld/ELF/Writer.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index d198ed29ff9..153c645c8f1 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -832,7 +832,24 @@ static bool shouldKeepInSymtab(InputSectionBase<ELFT> *Sec, StringRef SymName,
return !(Sec->getSectionHdr()->sh_flags & SHF_MERGE);
}
-template <class ELFT> static bool includeInSymtab(const SymbolBody &B);
+template <class ELFT> static bool includeInSymtab(const SymbolBody &B) {
+ if (!B.isLocal() && !B.symbol()->IsUsedInRegularObj)
+ return false;
+
+ if (auto *D = dyn_cast<DefinedRegular<ELFT>>(&B)) {
+ // Always include absolute symbols.
+ if (!D->Section)
+ return true;
+ // Exclude symbols pointing to garbage-collected sections.
+ if (!D->Section->Live)
+ return false;
+ if (auto *S = dyn_cast<MergeInputSection<ELFT>>(D->Section))
+ if (S->getRangeAndSize(D->Value).first->second ==
+ MergeInputSection<ELFT>::PieceDead)
+ return false;
+ }
+ return true;
+}
// Local symbols are not in the linker's symbol table. This function scans
// each object file's symbol table to copy local symbols to the output.
@@ -1104,25 +1121,6 @@ template <class ELFT> void Writer<ELFT>::addRelIpltSymbols() {
DefinedSynthetic<ELFT>::SectionEnd);
}
-template <class ELFT> static bool includeInSymtab(const SymbolBody &B) {
- if (!B.isLocal() && !B.symbol()->IsUsedInRegularObj)
- return false;
-
- if (auto *D = dyn_cast<DefinedRegular<ELFT>>(&B)) {
- // Always include absolute symbols.
- if (!D->Section)
- return true;
- // Exclude symbols pointing to garbage-collected sections.
- if (!D->Section->Live)
- return false;
- if (auto *S = dyn_cast<MergeInputSection<ELFT>>(D->Section))
- if (S->getRangeAndSize(D->Value).first->second ==
- MergeInputSection<ELFT>::PieceDead)
- return false;
- }
- return true;
-}
-
// This class knows how to create an output section for a given
// input section. Output section type is determined by various
// factors, including input section's sh_flags, sh_type and
OpenPOWER on IntegriCloud