From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100509 invoked by alias); 7 Oct 2016 15:07:34 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 100485 invoked by uid 89); 7 Oct 2016 15:07:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=Hx-languages-length:2110, Hosted, H*M:bdb8, states X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Oct 2016 15:07:23 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtp id 1bsWk6-00017U-65 from Luis_Gustavo@mentor.com ; Fri, 07 Oct 2016 08:07:22 -0700 Received: from [172.30.8.200] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 7 Oct 2016 08:07:19 -0700 Reply-To: Luis Machado Subject: Re: [PATCH] Fixup gdb.python/py-value.exp for bare-metal aarch64-elf References: <1475771231-1739-1-git-send-email-lgustavo@codesourcery.com> To: Yao Qi CC: "gdb-patches@sourceware.org" From: Luis Machado Message-ID: <33a4a07e-7d59-bdb8-a87b-9f6aea6e76d2@codesourcery.com> Date: Fri, 07 Oct 2016 15:07:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: svr-orw-mbx-04.mgc.mentorg.com (147.34.90.204) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) X-IsSubscribed: yes X-SW-Source: 2016-10/txt/msg00168.txt.bz2 On 10/07/2016 09:48 AM, Yao Qi wrote: > On Fri, Oct 7, 2016 at 1:08 PM, Luis Machado wrote: >> >> I went back and read the standard and we're dealing with a freestanding >> environment for bare metal here. >> >> The descriptions above seem to make sense for a hosted environment, but not >> for a freestanding one, correct? >> > > IMO, bare metal != freestadning environment. Since "main" function is used, > it is a hosted environment. See > https://gcc.gnu.org/onlinedocs/gcc/Standards.html I'm slightly confused. Are you implying that using main makes this a hosted environment even though there is no underlying OS facility at play? The documentation states freestanding environments can use any type of startup routine they want, only having to honor a small subset of clauses. This seems to imply that the use of "main" is allowed and the lack of underlying OS facilities make it freestanding. Skipping the discussion of whether we have a hosted x freestanding environment, the testcase itself uses main/argc/argv. Does that mean it is supposed to be exercised only on hosted environments or only on targets providing sane argc/argv values? > > "a hosted environment, which is not required, in which all the library > facilities are provided and startup is through a function int main > (void) or int main (int, char *[])." > > On the other hand, in the C standard, function "main" is only mentioned in > the section of "5.1.2.2 Hosted environment". > They are mentioned there because it is a requirement for a hosted environment but, as mentioned above, freestanding programs could have a function called main as the startup function. There is no restriction on that part, correct? More importantly, does it really matter, from a gdb testsuite point of view, whether the freestanding implementation provides main/argc/argv or not? The tests get exercised anyway, with only a small adjustment being required to make it not crash due to an assumption that is not always true (presence of argc/argv).