Calling conventions used by gcc

Anders Schau Knatten anders@knatten.org
Fri Jan 19 14:37:00 GMT 2007


On Fri, 19 Jan 2007 15:26:06 +0100, kanishk rastogi <kanishk.85@gmail.com>  
wrote:

> On 1/19/07, Anders Schau Knatten <anders@knatten.org> wrote:
>> I am trying to find some info on calling conventions used by g++ and  
>> g77,
>> but I cannot find anything in the manuals [1] and [2]. Does anyone know
>> any other sources I could check? What I am looking for is what calling
>> convention is used by default by g++ and g77 on linux/ia64, and how to
>> change this if needed.
>>
>> [1] http://gcc.gnu.org/onlinedocs/gcc-3.4.6/cpp/
>> [2] http://gcc.gnu.org/onlinedocs/gcc-3.3.6/g77/
>>

> if i understand you correctly then u are asking how the parameters are
> are passed to function .....etc. All these are specified in
> Application Binary Interface of a particular arch.

Yes, but one architecture can have several calling conventions, like  
stdcall or cdecl. It is then up to the compiler to choose one of these.  
The question is which one is used by gcc. I would also like to be able to  
specify calling conventions in the function prototypes, but so far I have  
been unsuccessfull. I have tried things like
extern "C" float __stdcall square_(float* x)
and
extern "C" float square_(float* x) __attribute__ ((__cdecl));
but they give me "syntax error" and "`__cdecl' attribute directive  
ignored" respectively.

Most of the discussion on calling conventions out there seem to focus on  
x86 or other architectures, and very few on IA64.

Anders

-- 
Why do mathematicians often confuse Christmas and Halloween?
Because Oct 31 = Dec 25.



More information about the Gcc-help mailing list