From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19761 invoked by alias); 14 Mar 2012 16:25:47 -0000 Received: (qmail 19751 invoked by uid 22791); 14 Mar 2012 16:25:47 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,TW_NV,TW_RG 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; Wed, 14 Mar 2012 16:25:34 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 2CF4029002D; Wed, 14 Mar 2012 17:25:35 +0100 (CET) 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 ZNJw+vujb6i6; Wed, 14 Mar 2012 17:25:35 +0100 (CET) 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 1A7EF290006; Wed, 14 Mar 2012 17:25:35 +0100 (CET) Subject: Re: [Patch/cfgexpand]: also consider assembler_name to call expand_main_function Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=windows-1252 From: Tristan Gingold In-Reply-To: Date: Wed, 14 Mar 2012 16:25:00 -0000 Cc: GCC Patches , Eric Botcazou Content-Transfer-Encoding: quoted-printable Message-Id: References: <875C6F56-7161-48DF-91FB-3A01891F8289@adacore.com> To: Richard Guenther X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-03/txt/msg00988.txt.bz2 On Mar 14, 2012, at 5:08 PM, Richard Guenther wrote: > On Wed, 14 Mar 2012, Tristan Gingold wrote: >=20 >> Hi, >>=20 >> the code to call expand_main_function currently only checks DECL_NAME. = This leads >> to a hack in ada/gcc-interface/utils.c to handle the gnatbind generated = file that could >> declare: >>=20 >> package ada_main is >> =85 >> function my_main >> (argc : Integer; >> argv : System.Address; >> envp : System.Address) >> return Integer; >> pragma Export (C, my_main, "main"); >> =85 >> end ada_main; >>=20 >> But expand_main_function is also called for function whose name is main = but assembly name isn't. Eg: >>=20 >> package pkg is >> procedure main; >> end pkg; >>=20 >> So I think we should consider the assembler name is set, otherwise the d= ecl name. >>=20 >> Manually tested on ia64-hp-openvms (where this issue was discovered). >> No C regressions for x86_64-darwin. >>=20 >> Ok for trunk ? >=20 > There are more checks for MAIN_NAME_P, so this certainly isn't enough. > And if it is a good idea then the whole check, whether a FUNCTION_DECL > is considered 'main' should be put into a function in tree.[ch] and > used everywhere. Note that what is 'main' is controlled by > main_identifier_node, controlled by frontends. So - why is that not > enough to control for Ada? Indeed, I think we could handle this issue in gigi for Ada. (I also think we don't want to handle crazy C code such as 'int my_main () asm ("main")'. But, unless I missed something, doing this in gigi won't work with LTO. Will write a predicate in tree.[ch]. Thank you for your comments, Tristan.