]> sourceware.org Git - libabigail.git/commit
dwarf-reader: Leverage ODR & DWZ
authorDodji Seketeli <dodji@redhat.com>
Wed, 23 Nov 2022 10:54:08 +0000 (11:54 +0100)
committerDodji Seketeli <dodji@redhat.com>
Wed, 30 Nov 2022 16:17:15 +0000 (17:17 +0100)
commitd222b44733f08000e639420f89772663b1064e9a
treea1166d0c3d4771e8c58d7f38ce4624e0fd7723ef
parent754364d5cab71dddf79b816d7ce3b447c332abe1
dwarf-reader: Leverage ODR & DWZ

When DWARF debug info has been preprocessed with the DWZ tool, I think
we can assume that if two DIEs originating from the .gnu_debugaltlink
section have different offset, it means they are different, even if
they represent two types of the same nature and of the same name.
This is the whole point of DWZ.

When we process two DIEs originating from C++, it's possible "in
general" to assume that the One Definition Rule is in effect, meaning
that if two types of the same nature have the same name, they ought to
represent the same entity, meaning, they are the same type.

These two observations can lead to faster comparison of two aggregate
types of the same nature and of the same name.

This patch implements these two optimizations and use them by
default.

The first one is used by default on binaries that contains a
.gnu_debugaltlink section, which is the hint we use to detect that DWZ
was used to factorize DWARF DIEs.

The second of is used by default on DWARF DIEs originating from C++.

These optimizations can be de-activated on abidw and abidiff using the
--no-leverage-dwarf-factorization and --no-assume-odr-for-cplusplus.

* doc/manuals/abidiff.rst: Add documentation for
--no-leverage-dwarf-factorization and
--no-assume-odr-for-cplusplus
* doc/manuals/abidw.rst: Likewise.
* doc/manuals/abipkgdiff.rst: Likewise.
* include/abg-fe-iface.h (options::{leverage_dwarf_factorization,
assume_odr_for_cplusplus}): New data members.
* src/abg-dwarf-reader.cc (reader::leverage_dwarf_factorization_):
New data member.
(reader::leverage_dwarf_factorization): New accessor.
(compare_dies): If we are allowed to leverage the DWARF
factorization and if two type DIEs coming from the
.gnu_debugaltlink DWARF section have different offset, then they
are different.  Also, if we are allowed to assume ODR, use it to
speed up class/struct/unions comparisons.
* tools/abidiff.cc (options::{assume_odr_for_cplusplus,
leverage_dwarf_factorization}): Define new data members.
(options::options): Initialize them.
(display_usage): Add new help strings for
--no-leverage-dwarf-factorization and
--no-assume-odr-for-cplusplus.
(parse_command_line): Parse these new options.
(set_generic_options): New function.
(main): Use the new set_generic_options function.
* tools/abidw.cc (options::{assume_odr_for_cplusplus,
leverage_dwarf_factorization}): Define new data members.
(options::options): Initialize them.
(display_usage): Add new help strings for
--no-leverage-dwarf-factorization and
--no-assume-odr-for-cplusplus.
(parse_command_line): Parse these new options.
(set_generic_options): New function.
(load_corpus_and_write_abixml): Use the new set_generic_options
function.
* tools/abipkgdiff.cc (options::{assume_odr_for_cplusplus,
leverage_dwarf_factorization}): Define new data members.
(options::options): Initialize them.
(display_usage): Add new help strings for
--no-leverage-dwarf-factorization and
--no-assume-odr-for-cplusplus.
(parse_command_line): Parse these new options.
(set_generic_options): New function.
(compare): Use it.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
doc/manuals/abidiff.rst
doc/manuals/abidw.rst
doc/manuals/abipkgdiff.rst
include/abg-fe-iface.h
src/abg-dwarf-reader.cc
tests/test-diff-pkg.cc
tools/abidiff.cc
tools/abidw.cc
tools/abipkgdiff.cc
This page took 0.031421 seconds and 5 git commands to generate.