From patchwork Fri May 25 13:17:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Howarth X-Patchwork-Id: 161343 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 3495EB6EE7 for ; Fri, 25 May 2012 23:17:42 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1338556663; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=1hDyQqNLwak+hgtBDKPTXGCIfPA=; b=Rl+3WbyrkFvtOFP tU2/9c5tuTwg2pxvsFUrg3UUTEDQe0o+gPehxHnyjnJPfSMByXI1dgjkPjljAh38 M8f2NlqCx/4v9A4xVWvkNaNhYVETic4VKZtv8BN2nEGix/E3ePbg8dFMcqBcmj0J SRcCneBlCymZlr8MVHweZgYp78JA= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=NzBO/QWXad/Z9LNeEXfZ9Z9uNP5rAsfpAI5WvhZQJi854c9BEdooiDy8oFLwSd sTHBSFfKEvgFRMdce5usVGmIJwdZi08zT15nm3KH2kAfsr0TFyiwS/EgUJpr0tbE BupsQOudlxGl7+Zfj9D5X1OrQAbDBZfT3GdgXsd6Ax5M0=; Received: (qmail 24506 invoked by alias); 25 May 2012 13:17:36 -0000 Received: (qmail 24492 invoked by uid 22791); 25 May 2012 13:17:35 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from bromo.med.uc.edu (HELO bromo.med.uc.edu) (129.137.3.146) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 May 2012 13:17:21 +0000 Received: from bromo.med.uc.edu (localhost.localdomain [127.0.0.1]) by bromo.med.uc.edu (Postfix) with ESMTP id A7C8AB005C; Fri, 25 May 2012 09:17:20 -0400 (EDT) Received: (from howarth@localhost) by bromo.med.uc.edu (8.14.3/8.14.3/Submit) id q4PDHKdS020799; Fri, 25 May 2012 09:17:20 -0400 Date: Fri, 25 May 2012 09:17:20 -0400 From: Jack Howarth To: gcc-patches@gcc.gnu.org Cc: mikestump@comcast.net, iains@gcc.gnu.org, jason@redhat.com Subject: [PATCH][revised] PR debug/53453 ensure debug notes linked on darwin Message-ID: <20120525131720.GA20797@bromo.med.uc.edu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) 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 The attached patch solves PR53453. The upcoming dsymutil release will now issue a warning when no debug notes are emitted for an object file on linkage. This causes several thousand failures in the FSF gcc testsuite. The origin of this problem is that the darwin linker requires the presence of both AT_name and AT_comp_dir attributes for each object file otherwise their debug notes will be omitted on linkage. The patch adds a new TARGET_FORCE_AT_COMP_DIR target hook for darwin so that AT_comp_dir will be present for all object files. Bootstrap and regression tested on x86_64-apple-darwin12. http://gcc.gnu.org/ml/gcc-testresults/2012-05/msg02331.html Okay for gcc trunk and later gcc-4_7-branch and gcc-4_6-branch? Jack ps Note that this is a pre-existing problem on darwin and that the newer dsymutil simply has alerted us to the issue. pps Added correction of s/AT_comp_dir/DW_AT_comp_dir/g to gcc/target.def change. 2012-05-24 Jack Howarth PR debug/53453 * doc/tm.texi: Update. * doc/tm.texi.in (SDB and DWARF) : Add @hook. * target-def (force_at_comp_dir): New hook. * config/darwin.h (TARGET_FORCE_AT_COMP_DIR): Define. * dwarf2out.c (dwarf2out_finish): Check targetm.force_at_comp_dir. Index: gcc/doc/tm.texi.in =================================================================== --- gcc/doc/tm.texi.in (revision 187856) +++ gcc/doc/tm.texi.in (working copy) @@ -9392,6 +9392,8 @@ 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/target.def =================================================================== --- gcc/target.def (revision 187856) +++ gcc/target.def (working copy) @@ -2749,6 +2749,13 @@ 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. \ This usually means it will be run as part of machine-specific reorg.", bool, false) Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 187856) +++ gcc/dwarf2out.c (working copy) @@ -21949,7 +21949,7 @@ dwarf2out_finish (const char *filename) /* 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)) + 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) { Index: gcc/config/darwin.h =================================================================== --- gcc/config/darwin.h (revision 187856) +++ gcc/config/darwin.h (working copy) @@ -414,6 +414,8 @@ 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