diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-05-05 16:40:28 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-05-05 16:40:28 +0000 |
commit | 474eb019b4cdad4d2cc6348e133bbc23637ef9bf (patch) | |
tree | 66fd37f04f1f079bba96ca880be23013297790e8 | |
parent | 501e739d8a668ddcad2c240f077d0e1f4450a764 (diff) | |
download | bcm5719-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.cpp | 38 |
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 |