llvm-project/llvm/tools/dsymutil
Pavel Labath 2f0881160c [DebugInfo] Reduce debug_str_offsets section size
Summary:
The accelerator tables use the debug_str section to store their strings.
However, they do not support the indirect method of access that is
available for the debug_info section (DW_FORM_strx et al.).

Currently our code is assuming that all strings can/will be referenced
indirectly, and puts all of them into the debug_str_offsets section.
This is generally true for regular (unsplit) dwarf, but in the DWO case,
most of the strings in the debug_str section will only be used from the
accelerator tables. Therefore the contents of the debug_str_offsets
section will be largely unused and bloating the main executable.

This patch rectifies this by teaching the DwarfStringPool to
differentiate between strings accessed directly and indirectly. When a
user inserts a string into the pool it has to declare whether that
string will be referenced directly or not. If at least one user requsts
indirect access, that string will be assigned an index ID and put into
debug_str_offsets table. Otherwise, the offset table is skipped.

This approach reduces the overall binary size (when compiled with
-gdwarf-5 -gsplit-dwarf) in my tests by about 2% (debug_str_offsets is
shrunk by 99%).

Reviewers: probinson, dblaikie, JDevlieghere

Subscribers: aprantl, mgrang, llvm-commits

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

llvm-svn: 339122
2018-08-07 09:54:52 +00:00
..
BinaryHolder.cpp [dsymutil] Rename conflicting declaration 2018-06-29 17:11:34 +00:00
BinaryHolder.h [dsymutil] Rename conflicting declaration 2018-06-29 17:11:34 +00:00
CFBundle.cpp [dsymutil][NFC] Replace calls to CoreFoundation with LLVM equivalent. 2017-12-28 14:05:49 +00:00
CFBundle.h [dsymutil] Upstream getBundleInfo implementation 2017-11-30 10:25:28 +00:00
CMakeLists.txt [dsymutil] Move abstractions into separate files (NFC) 2018-06-27 16:13:40 +00:00
CompileUnit.cpp [dsymutil] Move abstractions into separate files (NFC) 2018-06-27 16:13:40 +00:00
CompileUnit.h [dsymutil] Emit label at the begin of a CU 2018-07-06 12:49:54 +00:00
DebugMap.cpp [dsymutil] Make the CachedBinaryHolder the default 2018-06-29 16:51:52 +00:00
DebugMap.h [dsymutil] Move abstractions into separate files (NFC) 2018-06-27 16:13:40 +00:00
DeclContext.cpp [dsymutil] Move abstractions into separate files (NFC) 2018-06-27 16:13:40 +00:00
DeclContext.h [dsymutil] Move abstractions into separate files (NFC) 2018-06-27 16:13:40 +00:00
DwarfLinker.cpp [dsymutil] Convert recursion in lookForDIEsToKeep into worklist. 2018-08-01 13:24:39 +00:00
DwarfLinker.h [dsymutil] Convert recursion in lookForDIEsToKeep into worklist. 2018-08-01 13:24:39 +00:00
DwarfStreamer.cpp [DebugInfo] Reduce debug_str_offsets section size 2018-08-07 09:54:52 +00:00
DwarfStreamer.h [dsymutil] Add support for generating DWARF5 accelerator tables. 2018-07-25 23:01:38 +00:00
LLVMBuild.txt [dsymutil] Rename llvm-dsymutil -> dsymutil 2018-03-18 11:38:41 +00:00
LinkUtils.h [dsymutil] Add support for generating DWARF5 accelerator tables. 2018-07-25 23:01:38 +00:00
MachODebugMapParser.cpp [dsymutil] Make the CachedBinaryHolder the default 2018-06-29 16:51:52 +00:00
MachOUtils.cpp [DebugInfo] Reduce debug_str_offsets section size 2018-08-07 09:54:52 +00:00
MachOUtils.h [dsymutil] Simplify temporary file handling. 2018-07-29 14:56:15 +00:00
NonRelocatableStringpool.cpp [DebugInfo] Reduce debug_str_offsets section size 2018-08-07 09:54:52 +00:00
NonRelocatableStringpool.h [DebugInfo] Reduce debug_str_offsets section size 2018-08-07 09:54:52 +00:00
dsymutil.cpp [dsymutil] Simplify temporary file handling. 2018-07-29 14:56:15 +00:00
dsymutil.h [dsymutil] Make the CachedBinaryHolder the default 2018-06-29 16:51:52 +00:00