diff options
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
-rw-r--r-- | lld/ELF/LinkerScript.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 054f1e4838e..103277729e3 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -110,24 +110,6 @@ static bool fileMatches(const InputSectionDescription *Desc, !const_cast<Regex &>(Desc->ExcludedFileRe).match(Filename); } -// Returns input sections filtered by given glob patterns. -template <class ELFT> -std::vector<InputSectionBase<ELFT> *> -LinkerScript<ELFT>::getInputSections(const InputSectionDescription *I) { - const Regex &Re = I->SectionRe; - std::vector<InputSectionBase<ELFT> *> Ret; - for (ObjectFile<ELFT> *F : Symtab<ELFT>::X->getObjectFiles()) - if (fileMatches(I, sys::path::filename(F->getName()))) - for (InputSectionBase<ELFT> *S : F->getSections()) - if (!isDiscarded(S) && !S->OutSec && - const_cast<Regex &>(Re).match(S->Name)) - Ret.push_back(S); - - if (const_cast<Regex &>(Re).match("COMMON")) - Ret.push_back(CommonInputSection<ELFT>::X); - return Ret; -} - static bool compareName(InputSectionData *A, InputSectionData *B) { return A->Name < B->Name; } @@ -146,14 +128,6 @@ getComparator(SortKind K) { return compareAlignment; } -template <class ELFT> -void LinkerScript<ELFT>::discard(ArrayRef<InputSectionBase<ELFT> *> V) { - for (InputSectionBase<ELFT> *S : V) { - S->Live = false; - reportDiscarded(S); - } -} - static bool checkConstraint(uint64_t Flags, ConstraintKind Kind) { bool RO = (Kind == ConstraintKind::ReadOnly); bool RW = (Kind == ConstraintKind::ReadWrite); @@ -171,6 +145,32 @@ static bool matchConstraints(ArrayRef<InputSectionBase<ELFT> *> Sections, }); } +// Returns input sections filtered by given glob patterns. +template <class ELFT> +std::vector<InputSectionBase<ELFT> *> +LinkerScript<ELFT>::getInputSections(const InputSectionDescription *I) { + const Regex &Re = I->SectionRe; + std::vector<InputSectionBase<ELFT> *> Ret; + for (ObjectFile<ELFT> *F : Symtab<ELFT>::X->getObjectFiles()) + if (fileMatches(I, sys::path::filename(F->getName()))) + for (InputSectionBase<ELFT> *S : F->getSections()) + if (!isDiscarded(S) && !S->OutSec && + const_cast<Regex &>(Re).match(S->Name)) + Ret.push_back(S); + + if (const_cast<Regex &>(Re).match("COMMON")) + Ret.push_back(CommonInputSection<ELFT>::X); + return Ret; +} + +template <class ELFT> +void LinkerScript<ELFT>::discard(ArrayRef<InputSectionBase<ELFT> *> V) { + for (InputSectionBase<ELFT> *S : V) { + S->Live = false; + reportDiscarded(S); + } +} + template <class ELFT> std::vector<InputSectionBase<ELFT> *> LinkerScript<ELFT>::createInputSectionList(OutputSectionCommand &OutCmd) { |