Bug 28568 - Eliminate redundant DW_AT_entry_pc tags for inlined functions from debuginfo
Summary: Eliminate redundant DW_AT_entry_pc tags for inlined functions from debuginfo
Status: NEW
Alias: None
Product: dwz
Classification: Unclassified
Component: default (show other bugs)
Version: unspecified
: P2 enhancement
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-09 13:47 UTC by William Cohen
Modified: 2021-11-09 13:47 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description William Cohen 2021-11-09 13:47:03 UTC
According to the DWARF5.pdf standard DW_AT_entry_pc can be optional "2.18 Entry Address":

If no DW_AT_entry_pc attribute is present, then the entry address is assumed to
be the same as the base address of the containing scope.

Eliminating those unneeded DW_AT_entry_pc attributes would save some space in the generated debuginfo.  To determine the possible saving the following dwgrep (https://pmachata.github.io/dwgrep/) script was used to find how often this occurs in the Fedora 34 kernel and showed over 200,000 instances where the DW_AT_low_pc and DW_AT_entry_pc were the same:


$  dwgrep /usr/lib/debug/lib/modules/5.14.15-200.fc34.x86_64/vmlinux -e '
let A := entry (?TAG_inlined_subroutine) ?DW_AT_low_pc ?DW_AT_entry_pc;
let LOW := ((A ?DW_AT_low_pc @DW_AT_low_pc) || (0xdeadbeef));
let ENTRY := ((A ?DW_AT_entry_pc @DW_AT_entry_pc) || (0xdeadbeef));
(LOW == ENTRY) ([A name, ENTRY, LOW ])' | grep \\[  | wc
 214604  643812 12804153

Initially filed a gcc bug to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103134 for the redundant DW_AT_entry_pc. It was suggested that dwz would be likely be able to eliminate these unneeded DW_AT_entry_pc tags in the debuginfo.