From patchwork Fri Mar 30 13:25:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tristan Gingold X-Patchwork-Id: 149648 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 0C7FDB6F6E for ; Sat, 31 Mar 2012 00:25:30 +1100 (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=1333718731; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:Content-Type:Content-Transfer-Encoding:Subject: Date:Message-Id:To:Mime-Version:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=1FwVAUmcULxP0V+8iF+me1dXdU8=; b=PyRnWzuU58e/FhF nsIfPR9FUdDxdrKcGraQNA131fq/ha3ZNwIHLZTL63zkZSonQN2NeiyggIC1mXcY 48ixIZzpMU5XbofKrYWsuG4RHcjDWb4dwG2sEpnqhUBXQ1djSz0mzoOZK2pMb0bo TxeAAI9iOn2AR7hd5Hkt3ptBBtVw= 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:Received:From:Content-Type:Content-Transfer-Encoding:Subject:Date:Message-Id:To:Mime-Version:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=op3hUgwBSz0Spm8+iam80iy1I/uCYmlgjBaDoC0ch3xCnHUQ39TUpxlRaNur9A +1/ssyz7gFC7AuwKgTOp+ZgfOTFkmbDn914rvK0vpJNJrUHyujxuQkqZDWJIv7Wn Hx8BHTQwYAGyzIcG0dgIDZvLAUTRN3JCnNtPmsYRG7sFU=; Received: (qmail 18326 invoked by alias); 30 Mar 2012 13:25:23 -0000 Received: (qmail 18303 invoked by uid 22791); 30 Mar 2012 13:25:20 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Mar 2012 13:25:07 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id CF74A2900CD for ; Fri, 30 Mar 2012 15:25:09 +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 mOvhQ2B6xY6D for ; Fri, 30 Mar 2012 15:25:09 +0200 (CEST) Received: from ulanbator.act-europe.fr (ulanbator.act-europe.fr [10.10.1.67]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id B7723290009 for ; Fri, 30 Mar 2012 15:25:09 +0200 (CEST) From: Tristan Gingold Subject: [ia64/vms]: Reimplement common_object Date: Fri, 30 Mar 2012 15:25:04 +0200 Message-Id: <4E34678F-E42B-422E-8A62-DA8D987F705E@adacore.com> To: GCC Patches Mime-Version: 1.0 (Apple Message framework v1257) 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 Hi, this attribute is used for some specialized Ada constructs available only on VMS. The current implementation is flawed when there are two (or more) variables with the same common_object. This patch uses the same mechanism as the one used by Alpha VMS. Manually tested on ia64-hp-openvms. Committed on trunk. Tristan. 2012-03-30 Tristan Gingold * config/ia64/ia64.c (ia64_section_type_flags): Remove common_object attribute handling. (SECTION_VMS_OVERLAY): Remove (ia64_vms_common_object_attribute): Replace abort with an assert. Do not set DECL_SECTION_NAME. (ia64_vms_output_aligned_decl_common): Handle common_object attribute. (ia64_vms_elf_asm_named_section): Remove. * config/ia64/vms.h (TARGET_ASM_NAMED_SECTION): Remove. Index: gcc/config/ia64/ia64.c =================================================================== --- gcc/config/ia64/ia64.c (revision 186009) +++ gcc/config/ia64/ia64.c (working copy) @@ -740,9 +740,6 @@ return NULL_TREE; } -/* The section must have global and overlaid attributes. */ -#define SECTION_VMS_OVERLAY SECTION_MACH_DEP - /* Part of the low level implementation of DEC Ada pragma Common_Object which enables the shared use of variables stored in overlaid linker areas corresponding to the use of Fortran COMMON. */ @@ -753,24 +750,18 @@ bool *no_add_attrs) { tree decl = *node; - tree id, val; - if (! DECL_P (decl)) - abort (); + tree id; + + gcc_assert (DECL_P (decl)); DECL_COMMON (decl) = 1; id = TREE_VALUE (args); - if (TREE_CODE (id) == IDENTIFIER_NODE) - val = build_string (IDENTIFIER_LENGTH (id), IDENTIFIER_POINTER (id)); - else if (TREE_CODE (id) == STRING_CST) - val = id; - else + if (TREE_CODE (id) != IDENTIFIER_NODE && TREE_CODE (id) != STRING_CST) { - warning (OPT_Wattributes, - "%qE attribute requires a string constant argument", name); + error ("%qE attribute requires a string constant argument", name); *no_add_attrs = true; return NULL_TREE; } - DECL_SECTION_NAME (decl) = val; return NULL_TREE; } @@ -783,50 +774,31 @@ { tree attr = DECL_ATTRIBUTES (decl); - /* As common_object attribute set DECL_SECTION_NAME check it before - looking up the attribute. */ - if (DECL_SECTION_NAME (decl) && attr) + if (attr) attr = lookup_attribute ("common_object", attr); - else - attr = NULL_TREE; - - if (!attr) + if (attr) { - /* Code from elfos.h. */ - fprintf (file, "%s", COMMON_ASM_OP); - assemble_name (file, name); - fprintf (file, ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", - size, align / BITS_PER_UNIT); - } - else - { - ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT)); - ASM_OUTPUT_LABEL (file, name); - ASM_OUTPUT_SKIP (file, size ? size : 1); - } -} + tree id = TREE_VALUE (TREE_VALUE (attr)); + const char *name; -/* Definition of TARGET_ASM_NAMED_SECTION for VMS. */ + if (TREE_CODE (id) == IDENTIFIER_NODE) + name = IDENTIFIER_POINTER (id); + else if (TREE_CODE (id) == STRING_CST) + name = TREE_STRING_POINTER (id); + else + abort (); -void -ia64_vms_elf_asm_named_section (const char *name, unsigned int flags, - tree decl) -{ - if (!(flags & SECTION_VMS_OVERLAY)) - { - default_elf_asm_named_section (name, flags, decl); - return; + fprintf (file, "\t.vms_common\t\"%s\",", name); } - if (flags != (SECTION_VMS_OVERLAY | SECTION_WRITE)) - abort (); + else + fprintf (file, "%s", COMMON_ASM_OP); - if (flags & SECTION_DECLARED) - { - fprintf (asm_out_file, "\t.section\t%s\n", name); - return; - } + /* Code from elfos.h. */ + assemble_name (file, name); + fprintf (file, ","HOST_WIDE_INT_PRINT_UNSIGNED",%u", + size, align / BITS_PER_UNIT); - fprintf (asm_out_file, "\t.section\t%s,\"awgO\"\n", name); + fputc ('\n', file); } static void @@ -10536,12 +10508,6 @@ || strncmp (name, ".gnu.linkonce.sb.", 17) == 0) flags = SECTION_SMALL; -#if TARGET_ABI_OPEN_VMS - if (decl && DECL_ATTRIBUTES (decl) - && lookup_attribute ("common_object", DECL_ATTRIBUTES (decl))) - flags |= SECTION_VMS_OVERLAY; -#endif - flags |= default_section_type_flags (decl, name, reloc); return flags; } Index: gcc/config/ia64/vms.h =================================================================== --- gcc/config/ia64/vms.h (revision 186009) +++ gcc/config/ia64/vms.h (working copy) @@ -121,9 +121,6 @@ #undef TARGET_VALID_POINTER_MODE #define TARGET_VALID_POINTER_MODE ia64_vms_valid_pointer_mode -#undef TARGET_ASM_NAMED_SECTION -#define TARGET_ASM_NAMED_SECTION ia64_vms_elf_asm_named_section - /* Define this macro if it is advisable to hold scalars in registers in a wider mode than that declared by the program. In such cases, the value is constrained to be within the bounds of the declared