This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Documentation
- To: Rafael Rodríguez Velilla <rrv at tid dot es>
- Subject: Re: Documentation
- From: Erik Mouw <J dot A dot K dot Mouw at ITS dot TUDelft dot NL>
- Date: Wed, 29 Nov 2000 18:06:41 +0100
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Organization: Eric Conspiracy Secret Labs
- References: <3A24DE34.F78FBE90@tid.es>
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/