[PATCH] D157036: Emit a .debug_str_offsets section with dsymutil to support DW_FORM_strx in dsymutil.

Shubham Sandeep Rastogi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 14:15:32 PDT 2023


rastogishubham created this revision.
rastogishubham added reviewers: avl, aprantl, JDevlieghere.
rastogishubham added a project: debug-info.
Herald added a subscriber: hiraditya.
Herald added a project: All.
rastogishubham requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

With this change, dsymutil can emit a .debug_str_offsets section, therefore it can also emit DW_FORM_strx in the .debug_info section.

I elected to emit only one .debug_str_offset contribution for all compile units, because any shared strings between compile units wouldn't be assigned different offsets for different compile units. Therefore, dsymutil rewrites every DW_AT_str_offsets_base to 8 which is the size of the .debug_str_offsets section header and the start of the offsets for all compile units.

Before this change, the size of the .debug_info section + .debug_str section was for clang.dSYM ~1.17 GB
After this change, the size of the .debug_info section + .debug_str section + .debug_str_offsets section is ~1.12 GB

This results in a 4.35% size decrease


https://reviews.llvm.org/D157036

Files:
  llvm/include/llvm/DWARFLinker/DWARFLinker.h
  llvm/include/llvm/DWARFLinker/DWARFStreamer.h
  llvm/lib/DWARFLinker/DWARFLinker.cpp
  llvm/lib/DWARFLinker/DWARFStreamer.cpp
  llvm/test/tools/dsymutil/ARM/dwarf5-addr_base.test
  llvm/test/tools/dsymutil/ARM/dwarf5-addrx-0x0-last.test
  llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test
  llvm/test/tools/dsymutil/ARM/dwarf5-macho.test
  llvm/test/tools/dsymutil/X86/dwarf5-addrx.test
  llvm/test/tools/dsymutil/X86/dwarf5-loclists.test
  llvm/test/tools/dsymutil/X86/op-convert-offset.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157036.546990.patch
Type: text/x-patch
Size: 40414 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230803/48889c29/attachment.bin>


More information about the llvm-commits mailing list