From patchwork Fri May 25 13:03:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Howarth X-Patchwork-Id: 161338 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 135D4B6F86 for ; Fri, 25 May 2012 23:03:33 +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=1338555815; 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=H97mTxXBvml17BxhKB31Qf/+GPw=; b=k2OU7L/n1zj7dCj xGGSQZw5C5BhttHgxLEtgCPfftxn8J4Jw7U2zplqfm8MdjMe/RJ38W8gcNFwXSfE /95Xl/QO/uf9/7nWeMVYs3RCl/58k2nS3n8InvDAL1mfaC2dsIFpkEU0QyzPyn/4 RY/3UzpFcN/S4417MRwy+1mFDRho= 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=YxuKlZdlZQT1EZNpObfcQAyEJ+mBQQOwWu/DvLpNzuIFvu+/0CpfUUGIzT27C8 4zb7pYQT71f8zvf+9WvoyDBqX+HDGdDtT+1JFeKj3zExn6N42F+OHbOpVswyPSgy vXk9XD2LG5VtTYKakpuvxPzEMSy4RdmjGg7tUo5YNnZFY=; Received: (qmail 32515 invoked by alias); 25 May 2012 13:03:27 -0000 Received: (qmail 32500 invoked by uid 22791); 25 May 2012 13:03:26 -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:03:12 +0000 Received: from bromo.med.uc.edu (localhost.localdomain [127.0.0.1]) by bromo.med.uc.edu (Postfix) with ESMTP id DF3C9B005C; Fri, 25 May 2012 09:03:05 -0400 (EDT) Received: (from howarth@localhost) by bromo.med.uc.edu (8.14.3/8.14.3/Submit) id q4PD32In020680; Fri, 25 May 2012 09:03:02 -0400 Date: Fri, 25 May 2012 09:03:02 -0400 From: Jack Howarth To: gcc-patches@gcc.gnu.org Cc: mikestump@comcast.net, iains@gcc.gnu.org, jason@redhat.com Subject: [PATCH] PR debug/53453 ensure debug notes linked on darwin Message-ID: <20120525130302.GA20678@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. 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{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