[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

Michael Buch via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 30 12:16:27 PDT 2023


Michael137 wrote:

>  I use `bloaty` for this ( https://github.com/google/bloaty ) - though it's a bit involved to do this to sum over all the object files - summing up the results from per-object file, etc...

```
bloaty `find ./patched-build/lib -name *.o`       │ bloaty `find ./no-patch-build/lib -name *.o `
  FILE SIZE        VM SIZE                        │    FILE SIZE        VM SIZE    
-------------  --------------                     │ --------------  -------------- 
54.6%  2.02Gi  60.3%  2.02Gi    ,__debug_str      │  54.5%  2.01Gi  60.1%  2.01Gi    ,__debug_str
22.0%   835Mi  24.3%   835Mi    ,__debug_info     │  22.1%   831Mi  24.3%   831Mi    ,__debug_info
 6.2%   236Mi   0.0%       0    String Table      │   6.1%   228Mi   0.0%       0    String Table
 4.5%   170Mi   5.0%   170Mi    ,__text           │   4.5%   169Mi   5.0%   169Mi    ,__text
 2.6%  97.6Mi   2.8%  97.6Mi    ,__debug_line     │   2.8%   104Mi   3.1%   104Mi    ,__debug_line
 2.3%  88.0Mi   2.6%  88.0Mi    ,__apple_types    │   2.3%  87.8Mi   2.6%  87.8Mi    ,__apple_types
 2.2%  83.1Mi   2.4%  83.1Mi    ,__apple_names    │   2.1%  81.0Mi   0.0%       0    [Unmapped]
 2.2%  81.8Mi   0.0%       0    [Unmapped]        │   2.1%  78.5Mi   2.3%  78.5Mi    ,__apple_names
 1.7%  65.6Mi   1.9%  65.6Mi    ,__compact_unwind │   1.7%  65.4Mi   1.9%  65.4Mi    ,__compact_unwind
 1.0%  39.2Mi   0.0%       0    Symbol Table      │   1.0%  39.0Mi   0.0%       0    Symbol Table
 0.2%  8.05Mi   0.2%  8.05Mi    ,__const          │   0.2%  7.55Mi   0.2%  7.55Mi    ,__const
 0.2%  7.91Mi   0.2%  7.91Mi    ,__cstring        │   0.2%  7.54Mi   0.2%  7.54Mi    ,__cstring
 0.1%  5.24Mi   0.2%  5.24Mi    ,__debug_abbrev   │   0.1%  5.27Mi   0.2%  5.27Mi    ,__debug_abbrev
 0.1%  2.31Mi   0.0%       0    [Mach-O Headers]  │   0.1%  2.30Mi   0.0%       0    [Mach-O Headers]
 0.0%  1.38Mi   0.0%  1.38Mi    ,__debug_ranges   │   0.0%  1.38Mi   0.0%  1.38Mi    ,__debug_ranges
 0.0%   994Ki   0.0%   994Ki    ,__apple_namespac │   0.0%   949Ki   0.0%   949Ki    ,__apple_namespac
 0.0%       0   0.0%   354Ki    ,__bss            │   0.0%       0   0.0%   354Ki    ,__bss
 0.0%   324Ki   0.0%   324Ki    ,__data           │   0.0%   324Ki   0.0%   324Ki    ,__data
 0.0%   283Ki   0.0%   283Ki    ,__StaticInit     │   0.0%   283Ki   0.0%   283Ki    ,__StaticInit
 0.0%  31.3Ki   0.0%  61.4Ki    [10 Others]       │   0.0%  31.9Ki   0.0%  62.0Ki    [11 Others]
 0.0%  58.6Ki   0.0%  58.6Ki    ,__apple_objc     │   0.0%  58.6Ki   0.0%  58.6Ki    ,__apple_objc
00.0%  3.71Gi 100.0%  3.35Gi    TOTAL             │ 100.0%  3.68Gi 100.0%  3.33Gi    TOTAL
```

Probably the linkage names that contribute most?

> That's a bit significant. Any chance you could get a per-section breakdown/growth on that? (& exact flags - is this with compressed debug info, for instance? Or not?)

This is an example command line invocation (with some paths redacted) for one of the object files:
```
./patched-build/bin/clang++ -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_HARDENED_MODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__
STDC_LIMIT_MACROS -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissin
g-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstr
ing-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -std=c++17 -arch arm64 -fno-exceptions -funwind-tables -fno-rtti"    
```

https://github.com/llvm/llvm-project/pull/70639


More information about the cfe-commits mailing list