diff options
-rw-r--r-- | lld/ELF/GdbIndex.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lld/ELF/GdbIndex.cpp b/lld/ELF/GdbIndex.cpp index 1d242923220..d7313af0bdf 100644 --- a/lld/ELF/GdbIndex.cpp +++ b/lld/ELF/GdbIndex.cpp @@ -79,11 +79,13 @@ template <class RelTy> Optional<RelocAddrEntry> LLDDwarfObj<ELFT>::findAux(const InputSectionBase &Sec, uint64_t Pos, ArrayRef<RelTy> Rels) const { - auto I = llvm::find_if(Rels, - [=](const RelTy &Rel) { return Rel.r_offset == Pos; }); - if (I == Rels.end()) + auto It = std::lower_bound( + Rels.begin(), Rels.end(), Pos, + [](const RelTy &A, uint64_t B) { return A.r_offset < B; }); + if (It == Rels.end() || It->r_offset != Pos) return None; - const RelTy &Rel = *I; + const RelTy &Rel = *It; + const ObjFile<ELFT> *File = Sec.getFile<ELFT>(); uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL); const typename ELFT::Sym &Sym = File->getELFSymbols()[SymIndex]; |