From patchwork Fri Oct 21 10:56:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ximin Luo X-Patchwork-Id: 78631 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp1233317qge; Fri, 21 Oct 2016 03:57:01 -0700 (PDT) X-Received: by 10.98.19.208 with SMTP id 77mr535547pft.102.1477047421104; Fri, 21 Oct 2016 03:57:01 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id l184si2225227pge.112.2016.10.21.03.57.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Oct 2016 03:57:01 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-439212-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-439212-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-439212-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=jLvUqgWNNh7tpR3jV gTfq2r83gjtvgRImQn/idA4+HL0l+OPY0ZGiH+IXOh3OLJZihOeJcMxF4lgNHqIp FQt5jXaRW4X0xq7h1CGjq6f1n88w5BQCpTHiZ7Q4RVg2Emj+jn0482xARC9miGIz QyRtSY77jQ3zWu9vKXn7jqAdL0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=m/ifBneOh04W1k9uW4IEIvL saQw=; b=iT5JIqoQZ39RB590ZOFS/8h4BrGsc9vtLQXpP91Fu0/MYmIV6GLNv7I yNmCfMrdPneR4Zx596o3g4vmIrLkqfwRYBBkF6PoLm/VmUVKK/vsDiqYVOGzeaZL X2CqmBk1fLyiXxGGN4g7azy4CrJO4RKcZG+xx0u3RbWSEe5BUwOQ= Received: (qmail 123919 invoked by alias); 21 Oct 2016 10:56:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 123894 invoked by uid 89); 21 Oct 2016 10:56:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=no version=3.3.2 spammy=sdb, guessed, wor, 4248 X-HELO: mail.headstrong.de Received: from mail.headstrong.de (HELO mail.headstrong.de) (81.7.4.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 21 Oct 2016 10:56:33 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.headstrong.de (Postfix) with ESMTP id A20841C00769; Fri, 21 Oct 2016 12:56:30 +0200 (CEST) Received: from mail.headstrong.de ([127.0.0.1]) by localhost (mail.headstrong.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 8XREl2gl00Vb; Fri, 21 Oct 2016 12:56:16 +0200 (CEST) Subject: Re: [PATCH] PR77985: DWARF: Emit DW_AT_comp_dir in all cases, even if source is an absolute path To: Richard Biener References: <85c55bf6-98ed-0277-f035-beaf469bb5bc@pwned.gg> <8A68DCB1-EE9C-44E9-B3E9-A9E5E459063B@comcast.net> <410A8AE9-91F9-4F9A-AC69-26ABDAFD1972@comcast.net> <5c1cd2eb-1f6d-efb7-ac38-90dc142fa4e4@pwned.gg> Cc: Mike Stump , GCC Patches From: Ximin Luo Message-ID: Date: Fri, 21 Oct 2016 10:56:00 +0000 MIME-Version: 1.0 In-Reply-To: Richard Biener: > On Tue, Oct 18, 2016 at 2:35 PM, Ximin Luo wrote: >> >> Thanks, I'll add the Changelog entry. My computer isn't very powerful, so I didn't bootstrap it yet, I only tested it on a stage1 compiler, on Debian testing/unstable. I'll find some time to bootstrap it and test it fully over the next few days. >> >> Shall I also get rid of the Darwin force_at_comp_dir stuff? Looking into it a bit more, my patch basically obsoletes the need for this so I can delete that as well. > > That would be nice. > Hi, Attached is the ChangeLog plus updated patch, rebased against the 2016-10-16 snapshot. Also I noticed I got the wrong bug number, the correct one is 77985 not 77895. I've tested it on a Debian testing/unstable x86_64-linux-gnu system. The results are good, the same tests fail both before and after the patch, and we have 2 new expected successes. Unfortunately I don't have access (and am unlikely to get access) to a Darwin system to test it on. Snippets of the test logs are attached. The full logs are about 200MB each in size (4MB XZ-compressed, each) so I guessed I shouldn't send them via email... The snippets were grepped from the logs using the '^FAIL: \|^# of\|pr77985' pattern. You can diff them to check that the results are same in both cases. X -- GPG: ed25519/56034877E1F87C35 GPG: rsa4096/1318EFAC5FBBDBCE https://github.com/infinity0/pubkeys.git 2016-10-18 Ximin Luo PR debug/77985 * dwarf2out.c (file_table_relative_p): Remove. (gen_compile_unit_die, dwarf2out_early_finish): Emit DW_AT_comp_dir for absolute paths. As a consequence of this, PR 53453 (2012-05-29) is no longer necessary and therefore also reverted, as follows: * doc/tm.texi: Update. * doc/tm.texi.in (SDB and DWARF) : Remove @hook. * target.def (force_at_comp_dir): Remove hook. * config/darwin.h (TARGET_FORCE_AT_COMP_DIR): Remove define. Index: gcc-7-20161016/gcc/dwarf2out.c =================================================================== --- gcc-7-20161016.orig/gcc/dwarf2out.c +++ gcc-7-20161016/gcc/dwarf2out.c @@ -22053,7 +22053,7 @@ gen_compile_unit_die (const char *filena { add_name_attribute (die, filename); /* Don't add cwd for . */ - if (!IS_ABSOLUTE_PATH (filename) && filename[0] != '<') + if (filename[0] != '<') add_comp_dir_attribute (die); } @@ -26416,20 +26416,6 @@ prune_unused_types (void) prune_unmark_dies (ctnode->root_die); } -/* Set the parameter to true if there are any relative pathnames in - the file table. */ -int -file_table_relative_p (dwarf_file_data **slot, bool *p) -{ - struct dwarf_file_data *d = *slot; - if (!IS_ABSOLUTE_PATH (d->filename)) - { - *p = true; - return 0; - } - return 1; -} - /* Helpers to manipulate hash table of comdat type units. */ struct comdat_type_hasher : nofree_ptr_hash @@ -28243,15 +28229,7 @@ dwarf2out_early_finish (const char *file /* Add the name for the main input file now. We delayed this from dwarf2out_init to avoid complications with PCH. */ add_name_attribute (comp_unit_die (), remap_debug_filename (filename)); - if (!IS_ABSOLUTE_PATH (filename) || targetm.force_at_comp_dir) - add_comp_dir_attribute (comp_unit_die ()); - else if (get_AT (comp_unit_die (), DW_AT_comp_dir) == NULL) - { - bool p = false; - file_table->traverse (&p); - if (p) - add_comp_dir_attribute (comp_unit_die ()); - } + add_comp_dir_attribute (comp_unit_die ()); /* With LTO early dwarf was really finished at compile-time, so make sure to adjust the phase after annotating the LTRANS CU DIE. */ Index: gcc-7-20161016/gcc/testsuite/gcc.dg/debug/dwarf2/pr77985.c =================================================================== --- /dev/null +++ gcc-7-20161016/gcc/testsuite/gcc.dg/debug/dwarf2/pr77985.c @@ -0,0 +1,9 @@ +/* DW_AT_comp_dir is emitted even if the file is compiled via an absolute path, + as is the case in the gcc testsuite. */ +/* { dg-do compile } */ +/* { dg-options "-g -dA" } */ +/* { dg-final { scan-assembler "DW_AT_comp_dir:" } } */ + +void func (void) +{ +} Index: gcc-7-20161016/gcc/config/darwin.h =================================================================== --- gcc-7-20161016.orig/gcc/config/darwin.h +++ gcc-7-20161016/gcc/config/darwin.h @@ -424,8 +424,6 @@ extern GTY(()) int darwin_ms_struct; #define TARGET_WANT_DEBUG_PUB_SECTIONS true -#define TARGET_FORCE_AT_COMP_DIR true - /* When generating stabs debugging, use N_BINCL entries. */ #define DBX_USE_BINCL Index: gcc-7-20161016/gcc/doc/tm.texi =================================================================== --- gcc-7-20161016.orig/gcc/doc/tm.texi +++ gcc-7-20161016/gcc/doc/tm.texi @@ -9784,10 +9784,6 @@ tables, and hence is desirable if it wor True if the @code{.debug_pubtypes} and @code{.debug_pubnames} sections should be emitted. These sections are not used on most platforms, and in particular GDB does not use them. @end deftypevr -@deftypevr {Target Hook} bool TARGET_FORCE_AT_COMP_DIR -True if the @code{DW_AT_comp_dir} attribute should be emitted for each compilation unit. This attribute is required for the darwin linker to emit debug information. -@end deftypevr - @deftypevr {Target Hook} bool TARGET_DELAY_SCHED2 True if sched2 is not to be run at its normal place. This usually means it will be run as part of machine-specific reorg. Index: gcc-7-20161016/gcc/doc/tm.texi.in =================================================================== --- gcc-7-20161016.orig/gcc/doc/tm.texi.in +++ gcc-7-20161016/gcc/doc/tm.texi.in @@ -7084,8 +7084,6 @@ tables, and hence is desirable if it wor @hook TARGET_WANT_DEBUG_PUB_SECTIONS -@hook TARGET_FORCE_AT_COMP_DIR - @hook TARGET_DELAY_SCHED2 @hook TARGET_DELAY_VARTRACK Index: gcc-7-20161016/gcc/target.def =================================================================== --- gcc-7-20161016.orig/gcc/target.def +++ gcc-7-20161016/gcc/target.def @@ -6057,13 +6057,6 @@ DEFHOOKPOD bool, false) DEFHOOKPOD -(force_at_comp_dir, - "True if the @code{DW_AT_comp_dir} attribute should be emitted for each \ - compilation unit. This attribute is required for the darwin linker \ - to emit debug information.", - bool, false) - -DEFHOOKPOD (delay_sched2, "True if sched2 is not to be run at its normal place.\n\ This usually means it will be run as part of machine-specific reorg.", bool, false)