[PATCH] D119909: [ELF] Parallelize initializeLocalSymbols and postpone postParse

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 15 18:16:11 PST 2022


MaskRay created this revision.
MaskRay added reviewers: bd1976llvm, ikudrin, peter.smith.
Herald added subscribers: arichardson, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

ObjFile::parse combines symbol initialization and resolution. Many tasks
unrelated to symbol resolution can be postponed and parallelized. This patch
extracts local symbol initialization and parallelizes it.

Technically the new function initializeLocalSymbols can be merged into
ObjFile::postParse, but functions like getSrcMsg may access the
uninitialized (all nullptr) local part of InputFile::symbols.

While here, move initializeLocalSymbols after `skipLinkedOutput` so that
--thinlto-index-only does not have to waste time initializing local
initializeLocalSymbols of ET_REL files. (`ld.lld --thinlto-index-only a.bc b.o`
won't detect duplicate symbol error when a.bc is bitcode and
b.o is ET_REL. I think this is an acceptable compromise. The important
cases where (a) both are bitcode or (b) --thinlto-index-only is unused
are detected.)

Depends on D119908 <https://reviews.llvm.org/D119908>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119909

Files:
  lld/ELF/Driver.cpp
  lld/ELF/InputFiles.cpp
  lld/ELF/InputFiles.h
  lld/ELF/InputSection.cpp
  lld/test/ELF/invalid/symtab-sh-info-dup.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119909.409115.patch
Type: text/x-patch
Size: 8161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220216/c1801ee7/attachment.bin>


More information about the llvm-commits mailing list