[all-commits] [llvm/llvm-project] 7cd0c4: [ELF] Simplify SectionBase::partition handling and...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sun Jan 30 15:12:23 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7cd0c45364f7767c81185f2f086fe416af0a165d
      https://github.com/llvm/llvm-project/commit/7cd0c45364f7767c81185f2f086fe416af0a165d
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-01-30 (Sun, 30 Jan 2022)

  Changed paths:
    M lld/ELF/Driver.cpp
    M lld/ELF/InputSection.h
    M lld/ELF/MarkLive.cpp
    M lld/ELF/SyntheticSections.h
    M lld/ELF/Writer.cpp

  Log Message:
  -----------
  [ELF] Simplify SectionBase::partition handling and make it live by default. NFC

Previously an InputSectionBase is dead (`partition==0`) by default.
SyntheticSection calls markLive and BssSection overrides that with markDead.

It is more natural to make InputSectionBase live by default and let
--gc-sections mark InputSectionBase dead.

When linking a Release build of clang:

* --no-gc-sections:, the removed `inputSections` loop decreases markLive time from 4ms to 1ms.
* --gc-sections: the extra `inputSections` loop increases markLive time from 0.181296s to 0.188526s.
  This is as of we lose the removing one `inputSections` loop optimization (4374824ccf6e7ae68264d996a9ae5bb5e3be7fc5).
  I believe the loss can be mitigated if we refactor markLive.




More information about the All-commits mailing list