From patchwork Wed Jun 23 19:20:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 56707 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 3B083B6EFF for ; Thu, 24 Jun 2010 05:25:06 +1000 (EST) Received: (qmail 6869 invoked by alias); 23 Jun 2010 19:25:04 -0000 Received: (qmail 6853 invoked by uid 22791); 23 Jun 2010 19:25:01 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, T_FILL_THIS_FORM_SHORT X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Jun 2010 19:24:54 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 9FF78CB0268 for ; Wed, 23 Jun 2010 21:24:57 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Lqsys4dfdm7G for ; Wed, 23 Jun 2010 21:24:57 +0200 (CEST) Received: from [192.168.1.2] (unknown [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 7819CCB025E for ; Wed, 23 Jun 2010 21:24:57 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Fix glitch with DW_AT_MIPS_linkage_name (2) Date: Wed, 23 Jun 2010 21:20:28 +0200 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201006232120.29021.ebotcazou@adacore.com> 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 Hi, this is a repost of http://gcc.gnu.org/ml/gcc-patches/2010-06/msg00475.html adjusted to Jakub's recent change. Tested on i586-suse-linux, OK for mainline? 2010-06-23 Eric Botcazou * dwarf2out.c (AT_linkage_name): Delete. (add_linkage_attr): New function. (add_linkage_name): Call it to emit the linkage attribute. (dwarf2out_finish): Likewise. (move_linkage_attr): Explicitly accept both attribute variants. Index: dwarf2out.c =================================================================== --- dwarf2out.c (revision 161257) +++ dwarf2out.c (working copy) @@ -6384,11 +6384,6 @@ static void gen_remaining_tmpl_value_par #define DEBUG_MACINFO_SECTION_LABEL "Ldebug_macinfo" #endif -/* Mangled name attribute to use. This used to be a vendor extension - until DWARF 4 standardized it. */ -#define AT_linkage_name \ - (dwarf_version >= 4 ? DW_AT_linkage_name : DW_AT_MIPS_linkage_name) - /* Definitions of defaults for formats and names of various special (artificial) labels which may be generated within this file (when the -g @@ -17343,6 +17338,25 @@ add_pure_or_virtual_attribute (dw_die_re } } +/* Add a DW_AT_linkage_name or DW_AT_MIPS_linkage_name attribute for the + given decl. This used to be a vendor extension until after DWARF 4 + standardized it. */ + +static void +add_linkage_attr (dw_die_ref die, tree decl) +{ + const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); + + /* Mimic what assemble_name_raw does with a leading '*'. */ + if (name[0] == '*') + name = &name[1]; + + if (dwarf_version >= 4) + add_AT_string (die, DW_AT_linkage_name, name); + else + add_AT_string (die, DW_AT_MIPS_linkage_name, name); +} + /* Add source coordinate attributes for the given decl. */ static void @@ -17377,8 +17391,7 @@ add_linkage_name (dw_die_ref die, tree d deferred_asm_name = asm_name; } else if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl)) - add_AT_string (die, AT_linkage_name, - IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))); + add_linkage_attr (die, decl); } } @@ -21944,7 +21957,8 @@ move_linkage_attr (dw_die_ref die) unsigned ix = VEC_length (dw_attr_node, die->die_attr); dw_attr_node linkage = *VEC_index (dw_attr_node, die->die_attr, ix - 1); - gcc_assert (linkage.dw_attr == AT_linkage_name); + gcc_assert (linkage.dw_attr == DW_AT_linkage_name + || linkage.dw_attr == DW_AT_MIPS_linkage_name); while (--ix > 0) { @@ -22177,8 +22191,7 @@ dwarf2out_finish (const char *filename) tree decl = node->created_for; if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl)) { - add_AT_string (node->die, AT_linkage_name, - IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))); + add_linkage_attr (node->die, decl); move_linkage_attr (node->die); } }