[all-commits] [llvm/llvm-project] f6bd0a: [ELF] Add makeThreadLocal/makeThreadLocalN and rem...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Aug 4 11:09:54 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f6bd0a8f2bc4b62f7f7800a7dd1de6ba764b56c6
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-08-04 (Thu, 04 Aug 2022)

  Changed paths:
    M lld/ELF/InputFiles.cpp
    M lld/ELF/InputFiles.h
    M lld/include/lld/Common/Memory.h

  Log Message:
  [ELF] Add makeThreadLocal/makeThreadLocalN and remove InputFile::localSymStorage

makeThreadLocal/makeThreadLocalN are moved from D130810 ([ELF] Parallelize input
section initialization) here to make D130810 more focused on the refactor:

* COFF has some needs for multiple linker contexts. D108850 partially removed
  global states from lldCommon but left the global variable `lctx`.
* To the best of my knowledge, all multiple-linker-context feature requests to
  ELF are more from user convenience, with no very strong argument.
* In practice, ELF port is very difficult to remove global states without
  introducing significant performance regression/hurting code readability.
* Per-thread allocators from D122922/D123879 are too expensive and will not
  really benefit ELF.

This patch adds a simple thread_local based makeThreadLocal to
lld/Common/Memory.h. It will enable further optimization in ELF.

More information about the All-commits mailing list