add directory Ref-docs
This commit is contained in:
167
Ref-docs/manual gcc2.95.3/gcc_13.html
Normal file
167
Ref-docs/manual gcc2.95.3/gcc_13.html
Normal file
@@ -0,0 +1,167 @@
|
||||
<HTML>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<!-- Created on March, 17 2001 by texi2html 1.64 -->
|
||||
<!--
|
||||
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
|
||||
Karl Berry <karl@freefriends.org>
|
||||
Olaf Bachmann <obachman@mathematik.uni-kl.de>
|
||||
and many others.
|
||||
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
|
||||
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
|
||||
|
||||
-->
|
||||
<HEAD>
|
||||
<TITLE>Using and Porting the GNU Compiler Collection (GCC): Interface</TITLE>
|
||||
|
||||
<META NAME="description" CONTENT="Using and Porting the GNU Compiler Collection (GCC): Interface">
|
||||
<META NAME="keywords" CONTENT="Using and Porting the GNU Compiler Collection (GCC): Interface">
|
||||
<META NAME="resource-type" CONTENT="document">
|
||||
<META NAME="distribution" CONTENT="global">
|
||||
<META NAME="Generator" CONTENT="texi2html 1.64">
|
||||
|
||||
</HEAD>
|
||||
|
||||
<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
|
||||
|
||||
<A NAME="SEC147"></A>
|
||||
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
||||
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_12.html#SEC146" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_12.html#SEC146"> < </A>]</TD>
|
||||
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_14.html#SEC148" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_14.html#SEC148"> > </A>]</TD>
|
||||
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_2.html#SEC2" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_2.html#SEC2"> << </A>]</TD>
|
||||
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top"> Up </A>]</TD>
|
||||
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_14.html#SEC148" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_14.html#SEC148"> >> </A>]</TD>
|
||||
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
||||
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
||||
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
||||
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
||||
</TR></TABLE>
|
||||
<H1> 13. Interfacing to GCC Output </H1>
|
||||
<!--docid::SEC147::-->
|
||||
<P>
|
||||
|
||||
GCC is normally configured to use the same function calling convention
|
||||
normally in use on the target system. This is done with the
|
||||
machine-description macros described (see section <A HREF="gcc_17.html#SEC199" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_17.html#SEC199">17. Target Description Macros</A>).
|
||||
</P><P>
|
||||
|
||||
<A NAME="IDX433"></A>
|
||||
<A NAME="IDX434"></A>
|
||||
<A NAME="IDX435"></A>
|
||||
However, returning of structure and union values is done differently on
|
||||
some target machines. As a result, functions compiled with PCC
|
||||
returning such types cannot be called from code compiled with GCC,
|
||||
and vice versa. This does not cause trouble often because few Unix
|
||||
library routines return structures or unions.
|
||||
</P><P>
|
||||
|
||||
GCC code returns structures and unions that are 1, 2, 4 or 8 bytes
|
||||
long in the same registers used for <CODE>int</CODE> or <CODE>double</CODE> return
|
||||
values. (GCC typically allocates variables of such types in
|
||||
registers also.) Structures and unions of other sizes are returned by
|
||||
storing them into an address passed by the caller (usually in a
|
||||
register). The machine-description macros <CODE>STRUCT_VALUE</CODE> and
|
||||
<CODE>STRUCT_INCOMING_VALUE</CODE> tell GCC where to pass this address.
|
||||
</P><P>
|
||||
|
||||
By contrast, PCC on most target machines returns structures and unions
|
||||
of any size by copying the data into an area of static storage, and then
|
||||
returning the address of that storage as if it were a pointer value.
|
||||
The caller must copy the data from that memory area to the place where
|
||||
the value is wanted. This is slower than the method used by GCC, and
|
||||
fails to be reentrant.
|
||||
</P><P>
|
||||
|
||||
On some target machines, such as RISC machines and the 80386, the
|
||||
standard system convention is to pass to the subroutine the address of
|
||||
where to return the value. On these machines, GCC has been
|
||||
configured to be compatible with the standard compiler, when this method
|
||||
is used. It may not be compatible for structures of 1, 2, 4 or 8 bytes.
|
||||
</P><P>
|
||||
|
||||
<A NAME="IDX436"></A>
|
||||
<A NAME="IDX437"></A>
|
||||
GCC uses the system's standard convention for passing arguments. On
|
||||
some machines, the first few arguments are passed in registers; in
|
||||
others, all are passed on the stack. It would be possible to use
|
||||
registers for argument passing on any machine, and this would probably
|
||||
result in a significant speedup. But the result would be complete
|
||||
incompatibility with code that follows the standard convention. So this
|
||||
change is practical only if you are switching to GCC as the sole C
|
||||
compiler for the system. We may implement register argument passing on
|
||||
certain machines once we have a complete GNU system so that we can
|
||||
compile the libraries with GCC.
|
||||
</P><P>
|
||||
|
||||
On some machines (particularly the Sparc), certain types of arguments
|
||||
are passed "by invisible reference". This means that the value is
|
||||
stored in memory, and the address of the memory location is passed to
|
||||
the subroutine.
|
||||
</P><P>
|
||||
|
||||
<A NAME="IDX438"></A>
|
||||
If you use <CODE>longjmp</CODE>, beware of automatic variables. ANSI C says that
|
||||
automatic variables that are not declared <CODE>volatile</CODE> have undefined
|
||||
values after a <CODE>longjmp</CODE>. And this is all GCC promises to do,
|
||||
because it is very difficult to restore register variables correctly, and
|
||||
one of GCC's features is that it can put variables in registers without
|
||||
your asking it to.
|
||||
</P><P>
|
||||
|
||||
If you want a variable to be unaltered by <CODE>longjmp</CODE>, and you don't
|
||||
want to write <CODE>volatile</CODE> because old C compilers don't accept it,
|
||||
just take the address of the variable. If a variable's address is ever
|
||||
taken, even if just to compute it and ignore it, then the variable cannot
|
||||
go in a register:
|
||||
</P><P>
|
||||
|
||||
<TABLE><tr><td> </td><td class=example><pre>{
|
||||
int careful;
|
||||
&careful;
|
||||
<small>...</small>
|
||||
}
|
||||
</pre></td></tr></table></P><P>
|
||||
|
||||
<A NAME="IDX439"></A>
|
||||
<A NAME="IDX440"></A>
|
||||
Code compiled with GCC may call certain library routines. Most of
|
||||
them handle arithmetic for which there are no instructions. This
|
||||
includes multiply and divide on some machines, and floating point
|
||||
operations on any machine for which floating point support is disabled
|
||||
with <SAMP>`-msoft-float'</SAMP>. Some standard parts of the C library, such as
|
||||
<CODE>bcopy</CODE> or <CODE>memcpy</CODE>, are also called automatically. The usual
|
||||
function call interface is used for calling the library routines.
|
||||
</P><P>
|
||||
|
||||
These library routines should be defined in the library <TT>`libgcc.a'</TT>,
|
||||
which GCC automatically searches whenever it links a program. On
|
||||
machines that have multiply and divide instructions, if hardware
|
||||
floating point is in use, normally <TT>`libgcc.a'</TT> is not needed, but it
|
||||
is searched just in case.
|
||||
</P><P>
|
||||
|
||||
Each arithmetic function is defined in <TT>`libgcc1.c'</TT> to use the
|
||||
corresponding C arithmetic operator. As long as the file is compiled
|
||||
with another C compiler, which supports all the C arithmetic operators,
|
||||
this file will work portably. However, <TT>`libgcc1.c'</TT> does not work if
|
||||
compiled with GCC, because each arithmetic function would compile
|
||||
into a call to itself!
|
||||
</P><P>
|
||||
|
||||
<A NAME="Passes"></A>
|
||||
<HR SIZE="6">
|
||||
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
||||
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_2.html#SEC2" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_2.html#SEC2"> << </A>]</TD>
|
||||
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_14.html#SEC148" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_14.html#SEC148"> >> </A>]</TD>
|
||||
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc.html#SEC_Top" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc.html#SEC_Top">Top</A>]</TD>
|
||||
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_toc.html#SEC_Contents" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents">Contents</A>]</TD>
|
||||
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_24.html#SEC261" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_24.html#SEC261">Index</A>]</TD>
|
||||
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gcc_abt.html#SEC_About" tppabs="http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_abt.html#SEC_About"> ? </A>]</TD>
|
||||
</TR></TABLE>
|
||||
<BR>
|
||||
<FONT SIZE="-1">
|
||||
This document was generated
|
||||
by <I>GCC Administrator</I> on <I>March, 17 2001</I>
|
||||
using <A HREF="tppmsgs/msgs0.htm#1" tppabs="http://www.mathematik.uni-kl.de/~obachman/Texi2html"><I>texi2html</I></A>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
Reference in New Issue
Block a user