This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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)?


* 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
> ABI.

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.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]