From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74337 invoked by alias); 23 Jan 2020 09:23:37 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 74292 invoked by uid 48); 23 Jan 2020 09:23:33 -0000 From: "vries at gcc dot gnu.org" To: dwz@sourceware.org Subject: [Bug default/25449] New: Factor out compilation units Date: Wed, 01 Jan 2020 00:00:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: dwz X-Bugzilla-Component: default X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: nobody at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2020-q1/txt/msg00038.txt https://sourceware.org/bugzilla/show_bug.cgi?id=3D25449 Bug ID: 25449 Summary: Factor out compilation units Product: dwz Version: unspecified Status: NEW Severity: enhancement 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: --- The dwarf standard contains "Appendix E -- DWARF Compression and Duplicate Elimination (informative)", describing a technique on how to generate small= er debug information: ... to break up the debug information of a compilation into separate normal and partial compilation units, each consisting of one or more sections. By arranging that a sufficiently similar partitioning occurs in other compilations, a suitable system linker can delete redundant groups of secti= ons when combining object files. ... DWZ implements this scheme, but with the approach (described in pre-link te= rms in the appendix) applied post-link. It does this by: - moving common DIEs into partial units (tagged with DW_TAG_partial_unit), - generating DW_TAG_imported_unit/DW_AT_import to import the partial units into the compilation units which originally contained the DIEs - referencing DIEs in partial units using DW_FORM_ref_addr, when referenced from the originally containing compilation units or other partial units. The appendix has a bit though on "Use of DW_TAG_compile_unit versus DW_TAG_partial_unit": ... A section group compilation unit that uses DW_TAG_compile_unit is like any other compilation unit, in that its contents are evaluated by consumers as though it were an ordinary compilation unit. An #include directive appearing outside any other declarations is a good candidate to be represented using DW_TAG_compile_unit. However, an #include appearing inside a C++ namespace declaration or a function, for example, is not a good candidate because the entities included are not necessarily file level entities. Consequently a compiler must use DW_TAG_partial_unit (instead of DW_TAG_compile_unit) in a section group whenever the section group contents= are not necessarily globally visible. This directs consumers to ignore that compilation unit when scanning top le= vel declarations and definitions. The DW_TAG_partial_unit compilation unit will be referenced from elsewhere = and the referencing locations give the appropriate context for interpreting the partial compilation unit. ... So, there also is an option to tag the created units with DW_TAG_compile_un= it instead of DW_TAG_partial_unit, which means no requirement to create DW_TAG_imported_unit/DW_AT_import for such units, which means better compression. The first C++ example in the appendix shows this situation, and states: ... This example uses DW_TAG_compile_unit for the section group, implying that = the contents of the compilation unit are globally visible (in accordance with C= ++ language rules). DW_TAG_partial_unit is not needed for the same reason. ... So, as a first step we could do a optimization in DWZ to look at all the it= ems that are selected to be moved into a PU, and decide whether we can transform the PU into a CU and drop the imports. --=20 You are receiving this mail because: You are on the CC list for the bug.