[PATCH] D36079: Binary search to find a relocation.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 31 21:11:48 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL309652: Binary search to find a relocation. (authored by ruiu).
Changed prior to commit:
https://reviews.llvm.org/D36079?vs=108889&id=109046#toc
Repository:
rL LLVM
https://reviews.llvm.org/D36079
Files:
lld/trunk/ELF/GdbIndex.cpp
Index: lld/trunk/ELF/GdbIndex.cpp
===================================================================
--- lld/trunk/ELF/GdbIndex.cpp
+++ lld/trunk/ELF/GdbIndex.cpp
@@ -79,11 +79,13 @@
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];
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36079.109046.patch
Type: text/x-patch
Size: 912 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170801/3f9e04b1/attachment.bin>
More information about the llvm-commits
mailing list