This is an archive of the discontinued LLVM Phabricator instance.

[BOLT][DWARF] Reuse entries in .debug_addr when not modified
ClosedPublic

Authored by ayermolo on Jan 23 2023, 5:13 PM.

Details

Summary

In some binaries produced with ThinLTO there are CUs that share entry in
.debug_addr. Before we would generate a new entry for each. Which lead to binary
size increase. This changes the behavior so that we re-use entries in
.debug_addr.

Diff Detail

Event Timeline

ayermolo created this revision.Jan 23 2023, 5:13 PM
Herald added a reviewer: Amir. · View Herald Transcript
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
ayermolo requested review of this revision.Jan 23 2023, 5:13 PM
Herald added a project: Restricted Project. · View Herald Transcript
maksfb accepted this revision.Jan 24 2023, 3:44 PM

LGTM. Thanks!

This revision is now accepted and ready to land.Jan 24 2023, 3:44 PM

Example of pre-bolt debug info

DW_TAG_compile_unit
  DW_AT_addr_base (0x00000008)
DW_TAG_compile_unit
  DW_AT_addr_base (0x00000008)
DW_TAG_compile_unit
  DW_AT_addr_base (0x00000008)

If only the first CU was modified, and other two were not.
Before the fix:

DW_TAG_compile_unit
  DW_AT_addr_base (0x00000008)
DW_TAG_compile_unit
  DW_AT_addr_base (0x00000020)
DW_TAG_compile_unit
  DW_AT_addr_base (0x00000030)

After the fix:

DW_TAG_compile_unit
  DW_AT_addr_base (0x00000008)
DW_TAG_compile_unit
  DW_AT_addr_base (0x00000020)
DW_TAG_compile_unit
  DW_AT_addr_base (0x00000020)