public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: dwz@sourceware.org
Subject: [Bug default/25449] Factor out compilation units
Date: Wed, 01 Jan 2020 00:00:00 -0000	[thread overview]
Message-ID: <bug-25449-11298-41fvL9yblA@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-25449-11298@http.sourceware.org/bugzilla/>

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> So, there also is an option to tag the created units with
> DW_TAG_compile_unit 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 bit of "no requirement to create DW_TAG_imported_unit/DW_AT_import for such
units" is not entirely trivial.

In appendix E we find:
...
Use of DW_TAG_imported_unit

A DW_TAG_imported_unit debugging information entry has an DW_AT_import
attribute referencing a DW_TAG_compile_unit or DW_TAG_partial_unit debugging
information entry.

A DW_TAG_imported_unit debugging information entry refers to a
DW_TAG_compile_unit or DW_TAG_partial_unit debugging information entry to
specify that the DW_TAG_compile_unit or DW_TAG_partial_unit contents logically
appear at the point of the DW_TAG_imported_unit entry.
...

So, it's possible to do an import of a compile unit.

But in the first C++ example in E.1, the import statement for the compilation
unit is missing, while in the first Fortran example in E1, the import statement
for the partial unit is included.

Furthermore, at 3.1.1 Normal and Partial Compilation Unit Entries, we have:
...
A compilation unit entry owns debugging information entries that represent all
or part of the declarations made in the corresponding compilation. In the case
of a partial compilation unit, the containing scope of its owned declarations
is indicated by imported unit entries in one or more other compilation unit
entries that refer to that partial compilation unit.
...

A bit of explanation about when import is used and when not occurs here in E.1
"C example":
...
The C++ example in this Section might appear to be equally valid as a C
example. However, it is prudent to include a DW_TAG_imported_unit in the
primary unit (see Figure 84) with an DW_AT_import attribute that refers to the
proper unit in the section group.

The C rules for consistency of global (file scope) symbols across compilations
are less strict than for C++; inclusion of the import unit attribute assures
that the declarations of the proper section group are considered before
declarations from other compilations.
...

So, the jist of this seems to be:
- factored out partial unit: needs import
- factored out compilation unit:
  - prudent to import from C compilation unit (but we can have f.i. a
    command line option to not do this, and see what breaks)
  - not required from C++ compilation unit

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

  parent reply	other threads:[~2020-01-23 11:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-01  0:00 [Bug default/25449] New: " vries at gcc dot gnu.org
2020-01-01  0:00 ` [Bug default/25449] " vries at gcc dot gnu.org
2020-01-01  0:00 ` vries at gcc dot gnu.org [this message]
2020-01-01  0:00 ` vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-25449-11298-41fvL9yblA@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=dwz@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).