From patchwork Mon Jun 1 08:20:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 478848 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 11E43140E3E for ; Mon, 1 Jun 2015 18:22:35 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Byvms5Pu; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=LrwD1mI5DqYG6kID 2/Sny//NkawH456/0C3nuJan0kmZcjjUg12Nu3HlsBkQKT7JwaJtVUZAXBnEY30D HgZdBkIXz7DP4Uv24PKwANYtom7LmV/3rCzX62Vy3IIQMgTkNDX81R2Oz9yQAxSf +n17dxZPvHtJPkL8Z4rreUkftUg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=22ry9kYODwUb5+po1cm0NP XRuBE=; b=Byvms5PuutBiu59cLsAFK436UoHTPBkdRoHu1+OJullQarUa0uqfrk 9gfjjofyWSXnvngflWF2KtTQlGmI151J9+msbkHJ7aX+K2IX8gJe5m/QW+U96Wc3 Msv7ST4QicIbH2Gq47L/4/touMwzRv/r1Mzm7RifCZ5uYxydZZcMc= Received: (qmail 30296 invoked by alias); 1 Jun 2015 08:22:28 -0000 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 Received: (qmail 30280 invoked by uid 89); 1 Jun 2015 08:22:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.0 required=5.0 tests=AWL, BAYES_50, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 01 Jun 2015 08:22:26 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id EE27F2852C70 for ; Mon, 1 Jun 2015 10:22:23 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wiqx-nddtBXc for ; Mon, 1 Jun 2015 10:22:23 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id C61632852C6C for ; Mon, 1 Jun 2015 10:22:23 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Remove old kludge in i386_pe_encode_section_info Date: Mon, 01 Jun 2015 10:20:39 +0200 Message-ID: <1675410.WFKYCA0tne@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.29-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 This dates back to 2008 and is specific to the Ada compiler. Tested on x86_64-suse-linux and i686-pc-mingw32, applied on the mainline. 2015-06-01 Eric Botcazou * config/i386/winnt.c (i386_pe_encode_section_info) : Remove obsolete kludge. ada/ * gcc-interface/utils.c (create_var_decl_1): If an assembler name is specified, let the target mangle it before settting. (create_subprog_decl): Likewise and move this treatment last. Index: ada/gcc-interface/utils.c =================================================================== --- ada/gcc-interface/utils.c (revision 223912) +++ ada/gcc-interface/utils.c (working copy) @@ -2428,7 +2428,13 @@ create_var_decl_1 (tree var_name, tree a if (TREE_CODE (var_decl) == VAR_DECL) { if (asm_name) - SET_DECL_ASSEMBLER_NAME (var_decl, asm_name); + { + /* Let the target mangle the name if this isn't a verbatim asm. */ + if (*IDENTIFIER_POINTER (asm_name) != '*') + asm_name = targetm.mangle_decl_assembler_name (var_decl, asm_name); + + SET_DECL_ASSEMBLER_NAME (var_decl, asm_name); + } if (global_bindings_p ()) rest_of_decl_compilation (var_decl, true, 0); @@ -3047,8 +3053,17 @@ create_subprog_decl (tree subprog_name, DECL_BY_REFERENCE (result_decl) = TREE_ADDRESSABLE (subprog_type); DECL_RESULT (subprog_decl) = result_decl; + process_attributes (&subprog_decl, &attr_list, true, gnat_node); + + /* Add this decl to the current binding level. */ + gnat_pushdecl (subprog_decl, gnat_node); + if (asm_name) { + /* Let the target mangle the name if this isn't a verbatim asm. */ + if (*IDENTIFIER_POINTER (asm_name) != '*') + asm_name = targetm.mangle_decl_assembler_name (subprog_decl, asm_name); + SET_DECL_ASSEMBLER_NAME (subprog_decl, asm_name); /* The expand_main_function circuitry expects "main_identifier_node" to @@ -3061,11 +3076,6 @@ create_subprog_decl (tree subprog_name, DECL_NAME (subprog_decl) = main_identifier_node; } - process_attributes (&subprog_decl, &attr_list, true, gnat_node); - - /* Add this decl to the current binding level. */ - gnat_pushdecl (subprog_decl, gnat_node); - /* Output the assembler code and/or RTL for the declaration. */ rest_of_decl_compilation (subprog_decl, global_bindings_p (), 0); Index: config/i386/winnt.c =================================================================== --- config/i386/winnt.c (revision 223897) +++ config/i386/winnt.c (working copy) @@ -339,20 +339,6 @@ i386_pe_encode_section_info (tree decl, switch (TREE_CODE (decl)) { case FUNCTION_DECL: - /* FIXME: Imported stdcall names are not modified by the Ada frontend. - Check and decorate the RTL name now. */ - if (strcmp (lang_hooks.name, "GNU Ada") == 0) - { - tree new_id; - tree old_id = DECL_ASSEMBLER_NAME (decl); - const char* asm_str = IDENTIFIER_POINTER (old_id); - /* Do not change the identifier if a verbatim asmspec - or if stdcall suffix already added. */ - if (!(*asm_str == '*' || strchr (asm_str, '@')) - && (new_id = i386_pe_maybe_mangle_decl_assembler_name (decl, - old_id))) - XSTR (symbol, 0) = IDENTIFIER_POINTER (new_id); - } break; case VAR_DECL: