From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2368 invoked by alias); 22 Nov 2016 22:50:27 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 2274 invoked by uid 89); 22 Nov 2016 22:50:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=PING, __dso_handle, DW_AT_decl_file, dw_at_decl_file X-HELO: mail-qk0-f180.google.com Received: from mail-qk0-f180.google.com (HELO mail-qk0-f180.google.com) (209.85.220.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 Nov 2016 22:50:24 +0000 Received: by mail-qk0-f180.google.com with SMTP id x190so46236480qkb.0 for ; Tue, 22 Nov 2016 14:50:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=HrchzoEAKs0fUWOBF1iBx41ZhEQkl2dLsVtkG+1zEx8=; b=Od8W7PFEldMjRZrUwlLfsmr6eJsLZFcyCSELrrcFJxO+vJM6S5gFu+TJr/HQwjX0xM 07IBQ3ACg7wF+WF4S0nxAUIm9F3iW2iGYpKEb7u6akUDw+OjAk5UJPz/1a2nYkielsq4 ismSDWBCVLHZTZ2WArJYyOfRttdhz6e+4885qAPnCz2L61f80k5NvTlKXxp+yTLDLX73 pdxMcAY7hk5j9qi4is6NwZUOWT6zecevvupHkmXDocE7O/w1k9Aj98TJJPkYL0I+/ka5 UaJmrY+GiorIBoQeierX6ZJVm4wbPoaphi5TqNBnQR4cLKKV5H9ln61bMyjtV0dBAM9I 8Mlg== X-Gm-Message-State: AKaTC03PqzD9MYvb9bDFdDXs9bt+4hsZ25XyHPB+DHggLO8yh5c9KQdfsuA8+3der79a/JMO X-Received: by 10.55.152.4 with SMTP id a4mr19798qke.69.1479855022794; Tue, 22 Nov 2016 14:50:22 -0800 (PST) Received: from [192.168.1.133] (209-6-90-240.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com. [209.6.90.240]) by smtp.gmail.com with ESMTPSA id w12sm14810214qka.4.2016.11.22.14.50.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 14:50:17 -0800 (PST) Subject: Re: [PING][PATCH][2/2] Early LTO debug -- main part To: Richard Biener , gcc-patches@gcc.gnu.org References: From: Jason Merrill Message-ID: <5e42756e-8064-3a9e-9ffb-5693169097aa@redhat.com> Date: Tue, 22 Nov 2016 22:50:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg02284.txt.bz2 On 11/11/2016 03:06 AM, Richard Biener wrote: > + /* ??? In some cases the C++ FE (at least) fails to > + set DECL_CONTEXT properly. Simply globalize stuff > + in this case. For example > + __dso_handle created via iostream line 74 col 25. */ The comment for DECL_CONTEXT says that a VAR_DECL can have 'NULL_TREE or a TRANSLATION_UNIT_DECL if the given decl has "file scope"' So this doesn't seem like a FE bug. > + /* ??? We cannot unconditionally output die_offset if > + non-zero - at least -feliminate-dwarf2-dups will > + create references to those DIEs via symbols. And we > + do not clear its DIE offset after outputting it > + (and the label refers to the actual DIEs, not the > + DWARF CU unit header which is when using label + offset > + would be the correct thing to do). I'd be happy to remove or disable -feliminate-dwarf2-dups at this point, since it's already useless for C++ without reimplementation. > + /* "Unwrap" the decls DIE which we put in the imported unit context. > + ??? If we finish dwarf2out_function_decl refactoring we can > + do this in a better way from the start and only lazily emit > + the early DIE references. */ Can you elaborate more on the refactoring? dwarf2out_function_decl is already very small, I'm guessing you mean gen_subprogram_die? > + /* ??? We can't annotate types late, but for LTO we may not > + generate a location early either (gfortran.dg/save_5.f90). > + The proper way is to handle it like VLAs though it is told > + that DW_AT_string_length does not support this. */ I think go ahead and handle it like VLAs, this is an obvious generalization and should go into the spec soon enough. This can happen later. > + /* ??? This all (and above) should probably be simply > + a ! early_dwarf check somehow. */ > + && ((DECL_ARTIFICIAL (decl) || in_lto_p) > || (get_AT_file (old_die, DW_AT_decl_file) == file_index > && (get_AT_unsigned (old_die, DW_AT_decl_line) > == (unsigned) s.line)))) Why doesn't the existing source position check handle the LTO case? Also the extra parens aren't necessary. > /* If we're emitting an out-of-line copy of an inline function, > emit info for the abstract instance and set up to refer to it. */ > + /* ??? We have output an abstract instance early already and > + could just re-use that. This is how LTO treats all functions > + for example. */ Isn't this what you do now? > + /* Avoid generating stray type DIEs during late dwarf dumping. > + All types have been dumped early. */ > + if (! (decl ? lookup_decl_die (decl) : NULL) Why do you still want to gen_type_die if decl_or_origin is origin? > +init_sections_and_labels (bool early_lto_debug) You're changing this function to do the same thing in four slightly different ways rather than two. I'd rather control each piece as appropriate; we ought to make SECTION_DEBUG or SECTION_DEBUG|SECTION_EXCLUDE a local variable, and select between *_SECTION and the DWO variant at each statement rather than in different blocks. > + /* Remove DW_AT_macro from the early output. */ > + if (have_macinfo) > + remove_AT (comp_unit_die (), > + dwarf_strict ? DW_AT_macro_info : DW_AT_GNU_macros); This will need adjustment for Jakub's DWARF 5 work. Please make the choice of AT value a macro. > + /* ??? Mostly duplicated from dwarf2out_finish. */ :( Jason