This is the mail archive of the
mailing list for the GCC project.
Re: Which spec has defined the calling sequence of static C functions (like the extern C functions' has been defined in the Sys V ABI specs)?
- From: Florian Weimer <fweimer at redhat dot com>
- To: Andrew Haley <aph at redhat dot com>
- Cc: Remus Clearwater <remus dot clearwater at gmail dot com>, gcc-help at gcc dot gnu dot org
- Date: Thu, 03 Jan 2019 14:46:19 +0100
- Subject: Re: Which spec has defined the calling sequence of static C functions (like the extern C functions' has been defined in the Sys V ABI specs)?
- References: <CAMjELSuc57ajAZiLykpoDW4PPJqOM1uS-4Mbigu8Chq1rC40eA@mail.gmail.com> <firstname.lastname@example.org>
* Andrew Haley:
> On 12/29/18 12:53 PM, Remus Clearwater wrote:
>> B. The calling of those un-inlined static C functions does not have to
>> comply with the function calling sequence defined in the ABI spec. And
>> because the calling of the function pointers which are pointing to the
>> static C functions has to work correctly as the C standard described, so it
>> is the compiler's free will to decide any "calling sequence" that as long
>> as could satisfy both the Sys V ABI and the C standard.
> B is correct. We don't care about function pointers because we know if a
> static function has its address takes in the same compilation unit in
> which it appears. If it has not had its address taken, we don't have
> to care about the system ABI. If it has, then we need to use the system
With the caveat that system ABI still has to be followed for global
concerns, such as red zones and unwinding information. But on many
architectures, it is possible to relax requirements regarding register
spilling, calling convention, and stack alignment.