Documentation
Erik Mouw
J.A.K.Mouw@ITS.TUDelft.NL
Wed Nov 29 09:07:00 GMT 2000
On Wed, Nov 29, 2000 at 11:45:08AM +0100, Rafael RodrÃÂguez Velilla wrote:
> I'm looking for documentation on how does gcc manges function
> callings and how it organices the compiled code and data into the
> different sections that it generates.
Hmm, I think it is in the gcc info files, or otherwise it is in the ELF
description (which is available from Intel, IIRC).
> I'm compiling for ARM with gcc and I'm mixing C code and assembler.
GCC on ARM follows the ARM Procedure Call Standard (APCS), which
basically boils down to:
- First four arguments to a function go into r0 - r3. Extra arguments
are pushed onto the stack in reverse order (somebody please correct
me if I'm wrong).
- The return value of the function goes into r0.
Calling a C function from assembly is just:
bl c_function
Returning from an assembly function to a C function is:
mov pc,lr
> Is there such a documentation?
The APCS is described in "ARM Architecture Reference Manual" by Dave
Jagger, or in "ARM System Architecture" by Steve Furber.
For code examples, check out the Linux kernel source, or have a look at
blob, a bootloader I wrote for StrongARM systems:
http://www.lart.tudelft.nl/lartware/blob/
Erik
--
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031, 2600 GA Delft, The Netherlands
Phone: +31-15-2783635 Fax: +31-15-2781843 Email: J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/
More information about the Gcc
mailing list