Fix CK_BAD propagation for --odr
With the reproducer from PR26252 we get:
...
$ dwz 2 -o 2.z --odr -lnone
dwz: dwz.c:7396: partition_found_dups: \
Assertion `die->die_ck_state == CK_KNOWN' failed.
Aborted (core dumped)
...
The problem is caused by the odr code in checksum_ref_die, which skips
checksum calculation for the children of odr types, with as unintended
side-effect that it break the CK_BAD propagation to toplevel DIEs.
Fix this by making the skipping of the checksum calculation less intrusive.
Specially:
- undo all modifications related to odr in checksum_ref_die
- After calling checksum_ref_die in read_debug_info:
- override die_ref_hash for odr DIEs, and
- recalculate die_ref_hash for all other DIEs.
We still have the same amount of compression with cc1, that is: without odr
we have 42.30% reduction:
...
$ dwz cc1 -o cc1.z -lnone --no-odr
$ diff.sh cc1 cc1.z
.debug_info red: 44.84%
111527248 61527733
.debug_abbrev red: 40.28%
1722726 1028968
.debug_str red: 0%
6609355 6609355
total red: 42.30%
119859329 69166056
...
and with odr but without the bug fix we have 54.55%:
...
$ dwz cc1 -o cc1.z -lnone --odr
$ diff.sh cc1 cc1.z
.debug_info red: 57.46%
111527248 47449258
.debug_abbrev red: 75.08%
1722726 429434
.debug_str red: 0%
6609355 6609355
total red: 54.55%
119859329 54488047
...
and with odr and the bug fix still 54.55%:
...
$ dwz cc1 -o cc1.z -lnone --odr
$ diff.sh cc1 cc1.z
.debug_info red: 57.46%
111527248 47446501
.debug_abbrev red: 75.51%
1722726 422027
.debug_str red: 0%
6609355 6609355
total red: 54.55%
119859329 54477883
...
2021-02-18 Tom de Vries <tdevries@suse.de>
PR dwz/26252
* dwz.c (checksum_ref_die): Undo modifications related to odr.
(read_debug_info): After calling checksum_ref_die, override
die_ref_hash for odr DIEs, and recalculate die_ref_hash for all
other DIEs.