[lld] r268646 - Move static function to avoid forward declaration. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu May 5 09:40:29 PDT 2016
Author: rafael
Date: Thu May 5 11:40:28 2016
New Revision: 268646
URL: http://llvm.org/viewvc/llvm-project?rev=268646&view=rev
Log:
Move static function to avoid forward declaration. NFC.
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=268646&r1=268645&r2=268646&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu May 5 11:40:28 2016
@@ -832,7 +832,24 @@ static bool shouldKeepInSymtab(InputSect
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>:
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
More information about the llvm-commits
mailing list