From e3c2051d2722cbbe1188d0f009c46b5c6f7c1b7e Mon Sep 17 00:00:00 2001 From: George Rimar Date: Tue, 24 Jan 2017 09:31:02 +0000 Subject: [PATCH] [ELF] - Added additional comments on top of r292789 (D29021) It was requested during post commit review. llvm-svn: 292903 --- lld/ELF/InputSection.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 6a0f45b8534d..7503767ada9b 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -237,6 +237,10 @@ template void InputSection::copyRelocations(uint8_t *Buf, ArrayRef Rels) { InputSectionBase *RelocatedSection = getRelocatedSection(); + // Loop is slow and have complexity O(N*M), where N - amount of + // relocations and M - amount of symbols in symbol table. + // That happens because getSymbolIndex(...) call below performs + // simple linear search. for (const RelTy &Rel : Rels) { uint32_t Type = Rel.getType(Config->Mips64EL); SymbolBody &Body = this->File->getRelocTargetSym(Rel);