This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] Put warning into documentation of attribute "regparm"
- From: Wolfgang Bangerth <bangerth at ices dot utexas dot edu>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Kevin Ryde <user42 at zip dot com dot au>, Fergus Henderson <fjh at cs dot mu dot oz dot au>, <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 20 May 2003 17:13:55 -0500 (CDT)
- Subject: Re: [Patch] Put warning into documentation of attribute "regparm"
> This wording is ok with me, if someone wants to help him
> get it into proper texi form and committed.
I commited the form below. Kevin was right, registers are not put into
@code{...} in the paragraphs above and below this one. If you think that
this should be done, then I can do so in a separate patch.
What about the 3.3 branch?
W.
Index: extend.texi
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/doc/extend.texi,v
retrieving revision 1.138
diff -c -r1.138 extend.texi
*** extend.texi 5 May 2003 23:12:37 -0000 1.138
--- extend.texi 20 May 2003 16:22:47 -0000
***************
*** 2368,2379 ****
--- 2368,2390 ----
Not all ELF targets support this attribute.
@item regparm (@var{number})
+ @cindex @code{regparm} attribute
@cindex functions that are passed arguments in registers on the 386
On the Intel 386, the @code{regparm} attribute causes the compiler to
pass up to @var{number} integer arguments in registers EAX,
EDX, and ECX instead of on the stack. Functions that take a
variable number of arguments will continue to be passed all of their
arguments on the stack.
+
+ Beware that on some ELF systems this attribute is unsuitable for
+ global functions in shared libraries with lazy binding (which is the
+ default). Lazy binding will send the first call via resolving code in
+ the loader, which might assume EAX, EDX and ECX can be clobbered, as
+ per the standard calling conventions. Solaris 8 is affected by this.
+ GNU systems with GLIBC 2.1 or higher, and FreeBSD, are believed to be
+ safe since the loaders there save all registers. (Lazy binding can be
+ disabled with the linker or the loader if desired, to avoid the
+ problem.)
@item stdcall
@cindex functions that pop the argument stack on the 386