[PATCH] D29021: [ELF] - Stop handling local symbols in a special way.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 10:15:28 PST 2017


grimar added inline comments.


================
Comment at: lld/trunk/ELF/SyntheticSections.cpp:1104-1109
+template <class ELFT>
+size_t SymbolTableSection<ELFT>::getSymbolIndex(SymbolBody *Body) {
+  auto I = llvm::find_if(
+      Symbols, [&](const SymbolTableEntry &E) { return E.Symbol == Body; });
+  return I - Symbols.begin() + 1;
+}
----------------
ruiu wrote:
> This is a linear scan, so this makes the algorithm O(n^2), right? Did you verify that that is not a problem? Anyway, it needs comment as always -- you should explain that this is O(n^2) but in practice it is not an issue because blah blah (if that's the case.)
O(n*m). N bodies, M relocations, probably it is can be quadratic, yes.
I did not verify because it is for -relocatable only, it should be not often case.

But actually I already suggested 2 ways of solutions for that:
https://reviews.llvm.org/D28773#inline-250840

I supposed we can implement the second one just to be sure we do not have obviously slow place, what do you think ?


Repository:
  rL LLVM

https://reviews.llvm.org/D29021





More information about the llvm-commits mailing list