[PATCH] D81988: [ELF] Refactor ObjFile<ELFT>::initializeSymbols to enforce the invariant: InputFile::symbols has non null entry

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 19 01:02:27 PDT 2020


jhenderson added inline comments.


================
Comment at: lld/ELF/InputFiles.cpp:1101
+  // Symbol resolution of non-local symbols.
+  for (size_t i = firstGlobal, end = eSyms.size(); i != end; ++i) {
+    const Elf_Sym &eSym = eSyms[i];
----------------
Isn't this going to result in reading every global symbol twice? That seems like a negative performance hit to me, and I'm not sure it's necessary either (the two loops could still be a single loop it seems to me).


================
Comment at: lld/test/ELF/invalid/symtab-sh-info-dup.test:5
+## symbol table, make sure we have filled in all entries of InputFile::symbols.
+## Otherwise an null entry can lead to null pointer dereference when iterating
+## over InputFile::symbols.
----------------
an null -> a null
to null pointer -> to a null pointer


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81988/new/

https://reviews.llvm.org/D81988





More information about the llvm-commits mailing list