public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [Bug default/27438] New: [dwz, odr, multifile] Multifile after odr not optimal
@ 2021-02-19  8:45 vries at gcc dot gnu.org
  2021-02-19 11:50 ` [Bug default/27438] " vries at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-02-19  8:45 UTC (permalink / raw)
  To: dwz

https://sourceware.org/bugzilla/show_bug.cgi?id=27438

            Bug ID: 27438
           Summary: [dwz, odr, multifile] Multifile after odr not optimal
           Product: dwz
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: default
          Assignee: nobody at sourceware dot org
          Reporter: vries at gcc dot gnu.org
                CC: dwz at sourceware dot org
  Target Milestone: ---

Consider odr-struct:
...
$ make odr-struct
...

It has two structs aaa (from different CUs), each with member of type bbb and
ccc, but in one case bbb is a decl, in the other case ccc is a decl:
...
$ readelf -wi odr-struct | egrep -A2 "DW_TAG_structure" | egrep
"DW_TAG|DW_AT_name|DW_AT_decl"
 <1><f4>: Abbrev Number: 2 (DW_TAG_structure_type)
    <f5>   DW_AT_name        : ccc
 <1><114>: Abbrev Number: 2 (DW_TAG_structure_type)
    <115>   DW_AT_name        : aaa
 <1><139>: Abbrev Number: 5 (DW_TAG_structure_type)
    <13a>   DW_AT_name        : bbb
    <13e>   DW_AT_declaration : 1
 <1><1af>: Abbrev Number: 2 (DW_TAG_structure_type)
    <1b0>   DW_AT_name        : bbb
 <1><1cf>: Abbrev Number: 2 (DW_TAG_structure_type)
    <1d0>   DW_AT_name        : aaa
 <1><1fa>: Abbrev Number: 6 (DW_TAG_structure_type)
    <1fb>   DW_AT_name        : ccc
    <1ff>   DW_AT_declaration : 1
...

And we keep the same when doing dwz:
...
$ cp odr-struct 1; ./dwz 1
$ readelf -wi 1 | egrep -A2 "DW_TAG_structure" | egrep
"DW_TAG|DW_AT_name|DW_AT_decl" <1><e7>: Abbrev Number: 23
(DW_TAG_structure_type)
    <e8>   DW_AT_name        : ccc
 <1><101>: Abbrev Number: 23 (DW_TAG_structure_type)
    <102>   DW_AT_name        : aaa
 <1><11d>: Abbrev Number: 27 (DW_TAG_structure_type)
    <11e>   DW_AT_name        : bbb
    <122>   DW_AT_declaration : 1
 <1><17d>: Abbrev Number: 23 (DW_TAG_structure_type)
    <17e>   DW_AT_name        : bbb
 <1><197>: Abbrev Number: 23 (DW_TAG_structure_type)
    <198>   DW_AT_name        : aaa
 <1><1b6>: Abbrev Number: 27 (DW_TAG_structure_type)
    <1b7>   DW_AT_name        : ccc
    <1bb>   DW_AT_declaration : 1
...

When doing odr, we end up with one struct aaa, and no decls:
...
$ cp odr-struct 1; ./dwz 1 --odr
$ readelf -wi 1 | egrep -A2 "DW_TAG_structure" | egrep
"DW_TAG|DW_AT_name|DW_AT_decl"
 <1><19>: Abbrev Number: 25 (DW_TAG_structure_type)
    <1a>   DW_AT_name        : ccc
 <1><2f>: Abbrev Number: 25 (DW_TAG_structure_type)
    <30>   DW_AT_name        : aaa
 <1><4b>: Abbrev Number: 25 (DW_TAG_structure_type)
    <4c>   DW_AT_name        : bbb
...

Now consider:
...
$ cp odr-struct 1; cp 1 2; ./dwz -m 3 1 2 --odr 
...
The desired outcome is that the structs aaa are unified in both 1 and 2, and
then moved to multifile 3.

Sofar, so good:
...
$ readelf -wi 3 | egrep -A2 "DW_TAG_structure" | egrep
"DW_TAG|DW_AT_name|DW_AT_decl"
 <1><14>: Abbrev Number: 15 (DW_TAG_structure_type)
    <15>   DW_AT_name        : ccc
 <1><2a>: Abbrev Number: 15 (DW_TAG_structure_type)
    <2b>   DW_AT_name        : aaa
 <1><46>: Abbrev Number: 15 (DW_TAG_structure_type)
    <47>   DW_AT_name        : bbb
...

But:
...
$ readelf -wi 1 | egrep -A2 "DW_TAG_structure" | egrep
"DW_TAG|DW_AT_name|DW_AT_decl"
 <1><1e>: Abbrev Number: 12 (DW_TAG_structure_type)
    <1f>   DW_AT_name        : aaa
 <1><3d>: Abbrev Number: 12 (DW_TAG_structure_type)
    <3e>   DW_AT_name        : bbb
...

And it's not just that these are dead dies left behind.  The 0x1e DIE is used
here:
...
 <1><114>: Abbrev Number: 20 (DW_TAG_variable)
    <115>   DW_AT_name        : (alt indirect string, offset: 0xe)
    <11b>   DW_AT_type        : <0x1e>
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-02-25 14:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-19  8:45 [Bug default/27438] New: [dwz, odr, multifile] Multifile after odr not optimal vries at gcc dot gnu.org
2021-02-19 11:50 ` [Bug default/27438] " vries at gcc dot gnu.org
2021-02-19 12:08 ` vries at gcc dot gnu.org
2021-02-19 12:10 ` vries at gcc dot gnu.org
2021-02-19 12:24 ` vries at gcc dot gnu.org
2021-02-22  8:25 ` vries at gcc dot gnu.org
2021-02-22 15:12 ` vries at gcc dot gnu.org
2021-02-25 14:53 ` vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).