public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* 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)?
@ 2018-12-29 18:52 Remus Clearwater
  2018-12-30  9:58 ` Andrew Haley
  0 siblings, 1 reply; 9+ messages in thread
From: Remus Clearwater @ 2018-12-29 18:52 UTC (permalink / raw)
  To: gcc-help

Hi,

I am sure that the standard "Function Calling Sequence" described in Sys V
ABI specs (both i386 and AMD64) applies to the calling of those extern
functions in a C library, but does it applies to the calling of those
static C functions too if we do not take the compiler's "inline"
optimization into account (say such "inline" optimization has been switched
off)?

I think it should have two possibilities -- A and B:

A. The calling of those un-inlined static C functions should also comply
with the function calling sequence details (including registers usage,
stack frame, parameters passing, variable arguments...) which is defined in
the Sys V ABI spec just like the extern C functions do.

I think A should be correct. But I didn't manage to find any detailed
reference in the Sys V ABI specs (i386 & AMD64) or in the C standard.

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.

If B is right, then what is the special "calling sequence" GCC chooses for
calling static C functions? Is GCC just use the same "Function Calling
Sequence" rule which has been described in Sys V ABI specs (same as the
calling of those extern C functions)?

Thank you very much.

PS:

This question has been discussed on the SO yesterday, but I didn't manage
to get an exact answer.

-- 
https://stackoverflow.com/questions/53958062/does-the-standard-function-calling-sequence-described-in-sys-v-abi-specs-both

Thanks a lot.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-01-03 13:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-29 18:52 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)? Remus Clearwater
2018-12-30  9:58 ` Andrew Haley
2018-12-30 10:43   ` Remus Clearwater
2018-12-30 11:30     ` Xi Ruoyao
2018-12-30 12:52       ` Andrew Haley
2018-12-30 13:21       ` Remus Clearwater
2018-12-31 10:49         ` Remus Clearwater
2018-12-30 13:27       ` Remus Clearwater
2019-01-03 13:46   ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).