From patchwork Mon Aug 1 12:12:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 107725 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 66286B6FD1 for ; Mon, 1 Aug 2011 22:13:06 +1000 (EST) Received: (qmail 3378 invoked by alias); 1 Aug 2011 12:12:59 -0000 Received: (qmail 3357 invoked by uid 22791); 1 Aug 2011 12:12:56 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, RP_MATCHES_RCVD, TW_GD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 01 Aug 2011 12:12:42 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 33072A10 for ; Mon, 1 Aug 2011 14:12:41 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id BMPPGTRwAPPF for ; Mon, 1 Aug 2011 14:12:38 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 362FBA0F for ; Mon, 1 Aug 2011 14:12:38 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.5+Sun/8.14.5/Submit) id p71CCbnV009643; Mon, 1 Aug 2011 14:12:37 +0200 (MEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Subject: Support .debug_macro with Sun as (PR debug/49887) Date: Mon, 01 Aug 2011 14:12:37 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes 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 As described in the PR, many gcc.dg/debug and g++.dg/debug tests were failing on Solaris/SPARC with -gdwarf-2 -g3 and Sun as. This happens because the signature symbols Sun as requires for the COMDAT groups are emitted in TARGET_ASM_CODE_END, before *debug_hooks->finish runs which creates new ones for .debug_macro. Fixed by moving the emission to TARGET_ASM_FILE_END instead. Bootstrapped without regressions on i386-pc-solaris2.11 and sparc-sun-solaris2.11, installed on mainline. Rainer 2011-07-29 Rainer Orth PR debug/49887 * config/sol2.c (solaris_code_end): Rename to solaris_file_end. * config/sol2-protos.h: Likewise. * config/i386/i386.c (ix86_code_end) [TARGET_SOLARIS]: Don't call solaris_code_end. * config/i386/sol2.h [!USE_GAS] (TARGET_ASM_FILE_END): Redefine. * config/sparc/sparc.c (sparc_file_end) [TARGET_SOLARIS]: Call solaris_file_end. * config/sparc/sol2.h (TARGET_ASM_CODE_END): Remove. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -8321,10 +8321,6 @@ ix86_code_end (void) rtx xops[2]; int regno; -#ifdef TARGET_SOLARIS - solaris_code_end (); -#endif - for (regno = AX_REG; regno <= SP_REG; regno++) { char name[32]; diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h --- a/gcc/config/i386/sol2.h +++ b/gcc/config/i386/sol2.h @@ -160,6 +160,12 @@ along with GCC; see the file COPYING3. #undef TARGET_ASM_NAMED_SECTION #define TARGET_ASM_NAMED_SECTION i386_solaris_elf_named_section +#ifndef USE_GAS +/* Emit COMDAT group signature symbols for Sun as. */ +#undef TARGET_ASM_FILE_END +#define TARGET_ASM_FILE_END solaris_file_end +#endif + /* Unlike GNU ld, Sun ld doesn't coalesce .ctors.N/.dtors.N sections, so inhibit their creation. Also cf. sparc/sysv4.h. */ #ifndef USE_GLD diff --git a/gcc/config/sol2-protos.h b/gcc/config/sol2-protos.h --- a/gcc/config/sol2-protos.h +++ b/gcc/config/sol2-protos.h @@ -1,6 +1,6 @@ /* Operating system specific prototypes to be used when targeting GCC for any Solaris 2 system. - Copyright 2004, 2007, 2010 Free Software Foundation, Inc. + Copyright 2004, 2007, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -23,4 +23,4 @@ extern void solaris_register_pragmas (vo extern void solaris_output_init_fini (FILE *, tree); extern void solaris_assemble_visibility (tree, int); extern void solaris_elf_asm_comdat_section (const char *, unsigned int, tree); -extern void solaris_code_end (void); +extern void solaris_file_end (void); diff --git a/gcc/config/sol2.c b/gcc/config/sol2.c --- a/gcc/config/sol2.c +++ b/gcc/config/sol2.c @@ -228,7 +228,7 @@ solaris_elf_asm_comdat_section (const ch for Sun as. With a few exceptions, this is already the case. To identify the missing ones without changing the affected frontents, remember the signature symbols and emit those not marked - TREE_SYMBOL_REFERENCED in solaris_code_end. */ + TREE_SYMBOL_REFERENCED in solaris_file_end. */ if (solaris_comdat_htab == NULL) solaris_comdat_htab = htab_create_alloc (37, comdat_hash, comdat_eq, NULL, xcalloc, free); @@ -275,7 +275,7 @@ solaris_define_comdat_signature (void ** /* Emit unreferenced COMDAT group signature symbols for Sun as. */ void -solaris_code_end (void) +solaris_file_end (void) { if (solaris_comdat_htab == NULL) return; diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h --- a/gcc/config/sparc/sol2.h +++ b/gcc/config/sparc/sol2.h @@ -314,10 +314,6 @@ along with GCC; see the file COPYING3. #undef TARGET_ASM_NAMED_SECTION #define TARGET_ASM_NAMED_SECTION sparc_solaris_elf_asm_named_section -/* Emit COMDAT group signature symbols for Sun as. */ -#undef TARGET_ASM_CODE_END -#define TARGET_ASM_CODE_END solaris_code_end - /* Sun as requires doublequoted section names on SPARC. While GNU as supports that, too, we prefer the standard variant. */ #undef SECTION_NAME_FORMAT diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -10019,6 +10019,10 @@ sparc_file_end (void) if (NEED_INDICATE_EXEC_STACK) file_end_indicate_exec_stack (); + +#ifdef TARGET_SOLARIS + solaris_file_end (); +#endif } #ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING