[all-commits] [llvm/llvm-project] 074af0: [lld][ELF] Add --why-live flag (inspired by Mach-O...

Daniel Thornburgh via All-commits all-commits at lists.llvm.org
Wed Mar 26 09:56:54 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 074af0f30f8efb237cf9afe4bfb83769fa181d86
      https://github.com/llvm/llvm-project/commit/074af0f30f8efb237cf9afe4bfb83769fa181d86
  Author: Daniel Thornburgh <dthorn at google.com>
  Date:   2025-03-26 (Wed, 26 Mar 2025)

  Changed paths:
    M lld/ELF/Config.h
    M lld/ELF/Driver.cpp
    M lld/ELF/MarkLive.cpp
    M lld/ELF/Options.td
    M lld/docs/ReleaseNotes.rst
    M lld/docs/ld.lld.1
    A lld/test/ELF/why-live.test

  Log Message:
  -----------
  [lld][ELF] Add --why-live flag (inspired by Mach-O) (#127112)

This prints a stack of reasons that symbols that match the given glob(s)
survived GC. It has no effect unless section GC occurs.

This implementation does not require -ffunction-sections or
-fdata-sections to produce readable results, althought it does tend to
work better (as does GC).

Details about the semantics:
- Some chain of liveness reasons is reported; it isn't specified which
chain.
 - A symbol or section may be live:
   - Intrisically (e.g., entry point)
   - Because needed by a live symbol or section
   - (Symbols only) Because part of a section live for another reason
   - (Sections only) Because they contain a live symbol
 - Both global and local symbols (`STB_LOCAL`) are supported.
 - References to symbol + offset are considered to point to:
   - If the referenced symbol is a section (`STT_SECTION`):
- If a sized symbol encloses the referenced offset, the enclosing
symbol.
     - Otherwise, the section itself, generically.
   - Otherwise, the referenced symbol.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list