[all-commits] [llvm/llvm-project] b912b8: [ELF] Add --print-archive-stats=

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Apr 29 18:09:11 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b912b887d87c96a7ef900091cf11610a08a98c24
      https://github.com/llvm/llvm-project/commit/b912b887d87c96a7ef900091cf11610a08a98c24
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-04-29 (Wed, 29 Apr 2020)

  Changed paths:
    M lld/ELF/Config.h
    M lld/ELF/Driver.cpp
    M lld/ELF/InputFiles.cpp
    M lld/ELF/InputFiles.h
    M lld/ELF/MapFile.cpp
    M lld/ELF/MapFile.h
    M lld/ELF/Options.td
    M lld/ELF/Writer.cpp
    M lld/docs/ld.lld.1
    A lld/test/ELF/print-archive-stats.s

  Log Message:
  -----------
  [ELF] Add --print-archive-stats=

gold has an option --print-symbol-counts= which prints:

  // For each archive
  archive $archive $members $fetched_members
  // For each object file
  symbols $object $defined_symbols $used_defined_symbols

In most cases, `$defined_symbols = $used_defined_symbols` unless weak
symbols are present. Strangely `$used_defined_symbols` includes symbols defined relative to --gc-sections discarded sections.
The `symbols` lines do not appear to be useful.

`archive` lines are useful: `$fetched_members=0` lines correspond to
unused archives. The information can be used to trim dependencies.

This patch implements --print-archive-stats= which prints the number of
members and the number of fetched members for each archive.

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D78983




More information about the All-commits mailing list