From 5d34c8e946a9df8f7c48739046418b28201077df Mon Sep 17 00:00:00 2001
From: Kevin Ryde <user42@zip.com.au>
Date: Tue, 20 May 2003 22:13:34 +0000
Subject: [PATCH] doc/extend.texi: Put warning into documentation of attribute
 regparm.

Co-Authored-By: Wolfgang Bangerth <bangerth@dealii.org>

From-SVN: r67037
---
 gcc/ChangeLog       |  7 +++++++
 gcc/doc/extend.texi | 11 +++++++++++
 2 files changed, 18 insertions(+)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4ec04bfffd41..c99a4fdaa483 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2003-05-20  Kevin Ryde <user42@zip.com.au>
+	    Wolfgang Bangerth <bangerth@dealii.org>
+
+	PR/10355
+	* doc/extend.texi: Put a warning into the documentation
+	of attribute regparm.
+
 2003-05-20  Jason Merrill  <jason@redhat.com>
 
 	* tree.c (expr_last): New fn.
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 6006f04f5741..dc9646ac5b5d 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -2368,6 +2368,7 @@ since it is known that the calling function loaded the correct value.
 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,
@@ -2375,6 +2376,16 @@ 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
 On the Intel 386, the @code{stdcall} attribute causes the compiler to
-- 
GitLab