diff options
-rw-r--r-- | lld/ELF/ICF.cpp | 10 | ||||
-rw-r--r-- | lld/ELF/MarkLive.cpp | 11 | ||||
-rw-r--r-- | lld/ELF/OutputSections.cpp | 4 | ||||
-rw-r--r-- | lld/ELF/OutputSections.h | 2 | ||||
-rw-r--r-- | lld/ELF/Relocations.cpp | 2 | ||||
-rw-r--r-- | lld/ELF/Relocations.h | 2 | ||||
-rw-r--r-- | lld/ELF/Writer.cpp | 9 |
7 files changed, 20 insertions, 20 deletions
diff --git a/lld/ELF/ICF.cpp b/lld/ELF/ICF.cpp index f708d96c4fc..8a595ce996a 100644 --- a/lld/ELF/ICF.cpp +++ b/lld/ELF/ICF.cpp @@ -114,9 +114,9 @@ private: size_t findBoundary(size_t Begin, size_t End); void forEachClassRange(size_t Begin, size_t End, - std::function<void(size_t, size_t)> Fn); + llvm::function_ref<void(size_t, size_t)> Fn); - void forEachClass(std::function<void(size_t, size_t)> Fn); + void forEachClass(llvm::function_ref<void(size_t, size_t)> Fn); std::vector<InputSection *> Sections; @@ -385,7 +385,7 @@ template <class ELFT> size_t ICF<ELFT>::findBoundary(size_t Begin, size_t End) { // This function calls Fn on every group within [Begin, End). template <class ELFT> void ICF<ELFT>::forEachClassRange(size_t Begin, size_t End, - std::function<void(size_t, size_t)> Fn) { + llvm::function_ref<void(size_t, size_t)> Fn) { while (Begin < End) { size_t Mid = findBoundary(Begin, End); Fn(Begin, Mid); @@ -395,7 +395,7 @@ void ICF<ELFT>::forEachClassRange(size_t Begin, size_t End, // Call Fn on each equivalence class. template <class ELFT> -void ICF<ELFT>::forEachClass(std::function<void(size_t, size_t)> Fn) { +void ICF<ELFT>::forEachClass(llvm::function_ref<void(size_t, size_t)> Fn) { // If threading is disabled or the number of sections are // too small to use threading, call Fn sequentially. if (!ThreadsEnabled || Sections.size() < 1024) { @@ -444,7 +444,7 @@ template <class ELFT> void ICF<ELFT>::run() { // Initially, we use hash values to partition sections. parallelForEach(Sections, [&](InputSection *S) { // Set MSB to 1 to avoid collisions with non-hash IDs. - S->Class[0] = getHash<ELFT>(S) | (1 << 31); + S->Class[0] = getHash<ELFT>(S) | (1U << 31); }); // From now on, sections in Sections vector are ordered so that sections diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp index bacbf0eee06..a8371e212c3 100644 --- a/lld/ELF/MarkLive.cpp +++ b/lld/ELF/MarkLive.cpp @@ -60,8 +60,9 @@ static typename ELFT::uint getAddend(InputSectionBase &Sec, static DenseMap<StringRef, std::vector<InputSectionBase *>> CNamedSections; template <class ELFT, class RelT> -static void resolveReloc(InputSectionBase &Sec, RelT &Rel, - std::function<void(InputSectionBase *, uint64_t)> Fn) { +static void +resolveReloc(InputSectionBase &Sec, RelT &Rel, + llvm::function_ref<void(InputSectionBase *, uint64_t)> Fn) { Symbol &B = Sec.getFile<ELFT>()->getRelocTargetSym(Rel); // If a symbol is referenced in a live section, it is used. @@ -90,7 +91,7 @@ static void resolveReloc(InputSectionBase &Sec, RelT &Rel, template <class ELFT> static void forEachSuccessor(InputSection &Sec, - std::function<void(InputSectionBase *, uint64_t)> Fn) { + llvm::function_ref<void(InputSectionBase *, uint64_t)> Fn) { if (Sec.AreRelocsRela) { for (const typename ELFT::Rela &Rel : Sec.template relas<ELFT>()) resolveReloc<ELFT>(Sec, Rel, Fn); @@ -120,7 +121,7 @@ forEachSuccessor(InputSection &Sec, template <class ELFT, class RelTy> static void scanEhFrameSection(EhInputSection &EH, ArrayRef<RelTy> Rels, - std::function<void(InputSectionBase *, uint64_t)> Fn) { + llvm::function_ref<void(InputSectionBase *, uint64_t)> Fn) { const endianness E = ELFT::TargetEndianness; for (unsigned I = 0, N = EH.Pieces.size(); I < N; ++I) { @@ -155,7 +156,7 @@ scanEhFrameSection(EhInputSection &EH, ArrayRef<RelTy> Rels, template <class ELFT> static void scanEhFrameSection(EhInputSection &EH, - std::function<void(InputSectionBase *, uint64_t)> Fn) { + llvm::function_ref<void(InputSectionBase *, uint64_t)> Fn) { if (!EH.NumRelocations) return; diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 31e1d196db4..8253b18b486 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -139,7 +139,7 @@ void OutputSection::addSection(InputSection *IS) { } static void sortByOrder(MutableArrayRef<InputSection *> In, - std::function<int(InputSectionBase *S)> Order) { + llvm::function_ref<int(InputSectionBase *S)> Order) { typedef std::pair<int, InputSection *> Pair; auto Comp = [](const Pair &A, const Pair &B) { return A.first < B.first; }; @@ -162,7 +162,7 @@ bool OutputSection::classof(const BaseCommand *C) { return C->Kind == OutputSectionKind; } -void OutputSection::sort(std::function<int(InputSectionBase *S)> Order) { +void OutputSection::sort(llvm::function_ref<int(InputSectionBase *S)> Order) { assert(Live); for (BaseCommand *B : SectionCommands) if (auto *ISD = dyn_cast<InputSectionDescription>(B)) diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index 9720aab0e14..56296f4f2de 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -107,7 +107,7 @@ public: template <class ELFT> void writeTo(uint8_t *Buf); template <class ELFT> void maybeCompress(); - void sort(std::function<int(InputSectionBase *S)> Order); + void sort(llvm::function_ref<int(InputSectionBase *S)> Order); void sortInitFini(); void sortCtorsDtors(); diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 936371303b6..68a97a0a721 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -1295,7 +1295,7 @@ std::pair<Thunk *, bool> ThunkCreator::getThunk(Symbol &Sym, RelType Type, // InputSectionDescription::Sections. void ThunkCreator::forEachInputSectionDescription( ArrayRef<OutputSection *> OutputSections, - std::function<void(OutputSection *, InputSectionDescription *)> Fn) { + llvm::function_ref<void(OutputSection *, InputSectionDescription *)> Fn) { for (OutputSection *OS : OutputSections) { if (!(OS->Flags & SHF_ALLOC) || !(OS->Flags & SHF_EXECINSTR)) continue; diff --git a/lld/ELF/Relocations.h b/lld/ELF/Relocations.h index 3a930d935b0..2a82a677d8a 100644 --- a/lld/ELF/Relocations.h +++ b/lld/ELF/Relocations.h @@ -153,7 +153,7 @@ private: void forEachInputSectionDescription( ArrayRef<OutputSection *> OutputSections, - std::function<void(OutputSection *, InputSectionDescription *)> Fn); + llvm::function_ref<void(OutputSection *, InputSectionDescription *)> Fn); std::pair<Thunk *, bool> getThunk(Symbol &Sym, RelType Type, uint64_t Src); diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 0a23d467922..07c981f017b 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -50,7 +50,7 @@ public: private: void copyLocalSymbols(); void addSectionSymbols(); - void forEachRelSec(std::function<void(InputSectionBase &)> Fn); + void forEachRelSec(llvm::function_ref<void(InputSectionBase &)> Fn); void sortSections(); void resolveShfLinkOrder(); void sortInputSections(); @@ -83,8 +83,6 @@ private: uint64_t FileSize; uint64_t SectionHeaderOff; - - bool HasGotBaseSym = false; }; } // anonymous namespace @@ -889,7 +887,8 @@ template <class ELFT> void Writer<ELFT>::addRelIpltSymbols() { } template <class ELFT> -void Writer<ELFT>::forEachRelSec(std::function<void(InputSectionBase &)> Fn) { +void Writer<ELFT>::forEachRelSec( + llvm::function_ref<void(InputSectionBase &)> Fn) { // Scan all relocations. Each relocation goes through a series // of tests to determine if it needs special treatment, such as // creating GOT, PLT, copy relocations, etc. @@ -1474,7 +1473,7 @@ template <class ELFT> void Writer<ELFT>::resolveShfLinkOrder() { } static void applySynthetic(const std::vector<SyntheticSection *> &Sections, - std::function<void(SyntheticSection *)> Fn) { + llvm::function_ref<void(SyntheticSection *)> Fn) { for (SyntheticSection *SS : Sections) if (SS && SS->getParent() && !SS->empty()) Fn(SS); |