On 16.09.16 13:30, Richard Biener wrote:
On Thu, 15 Sep 2016, Richard Biener wrote:


This addresses sth I needed to address with the early LTO debug patches
(you might now figure I'm piecemail merging stuff from that patch).

When the cgraph code optimizes out a global we call the late_global_decl
debug hook to eventually add a DW_AT_const_value to its DIE (we don't
really expect a location as that will be invalid after optimizing out
and will be pruned).

With the early LTO debug patches I have introduced a early_dwarf_finished
flag (mainly for consistency checking) and I figured I can use that to
detect the call to the late hook during the early phase and provide
the following cleaned up variant of avoiding to create locations that
require later pruning (which doesn't work with emitting the early DIEs).

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

I verified it does the correct thing for a unit like

static const int i = 2;

(but ISTR we do have at least one testcase in the testsuite as well).

Will commit if testing finishes successfully.

Ok, so it showed issues when merging that back to early-LTO-debug.
Turns out in LTO we never call early_finish and thus early_dwarf_finished
was never set.  Also dwarf2out_late_global_decl itself is a better
place to constrain generating locations.

The following variant is in very late stage of testing.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
LTO bootstrap on x86_64-unknown-linux-gnu in stage3.  LTO bootstrap
with early-LTO-debug in stage3, bootstraped with early-LTO-debug,
testing in progress.

Any chance to backport this commit (r240228) to 6.x?
It fixes a bootstrap comparison issue on aarch64-*-freebsd*.
The aarch64-*-freebsd* port is not yet merged to 6.x and 5.4.x due to the bootstrap comparison failure I faced.

I did a bootstrap with a backport of this revision to 6.x on amd64-*-freebsd* and I did not see any issues.

TIA,
Andreas

2016-09-16  Richard Biener  <rguent...@suse.de>

        * dwarf2out.c (early_dwarf_finished): New global.
        (set_early_dwarf::set_early_dwarf): Assert early_dwarf_finished
        is false.
        (dwarf2out_early_finish): Set early_dwarf_finished at the end,
        if called from LTO exit early.
        (dwarf2out_late_global_decl): When being during the early
        debug phase do not add locations but only const value attributes.
        Adjust the way we generate early DIEs for LTO.

        lto/
        * lto.c (lto_main): Invoke early_finish debug hook.

Reply via email to