From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19961 invoked by alias); 8 Apr 2003 22:26:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 19928 invoked by uid 71); 8 Apr 2003 22:26:00 -0000 Resent-Date: 8 Apr 2003 22:26:00 -0000 Resent-Message-ID: <20030408222600.19927.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, Kevin Ryde Received: (qmail 17272 invoked from network); 8 Apr 2003 22:18:48 -0000 Received: from unknown (HELO snoopy.pacific.net.au) (61.8.0.36) by sources.redhat.com with SMTP; 8 Apr 2003 22:18:48 -0000 Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.2.228.40]) by snoopy.pacific.net.au (8.12.3/8.12.3/Debian-5) with ESMTP id h38MIh3Q031131 for ; Wed, 9 Apr 2003 08:18:44 +1000 Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id h38MIh9N024076 for ; Wed, 9 Apr 2003 08:18:43 +1000 (EST) Received: from localhost (ppp75.dyn228.pacific.net.au [203.143.228.75]) by wisma.pacific.net.au (8.12.8/8.12.8) with ESMTP id h38MIfqn022540 for ; Wed, 9 Apr 2003 08:18:42 +1000 (EST) Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 1931QK-0000bX-00; Wed, 09 Apr 2003 08:18:36 +1000 Message-Id: <87n0j0ab0k.fsf@zip.com.au> Date: Tue, 08 Apr 2003 22:26:00 -0000 From: Kevin Ryde To: gcc-gnats@gcc.gnu.org Subject: c/10355: i386 regparm doco note on shlib use X-SW-Source: 2003-04/txt/msg00359.txt.bz2 List-Id: >Number: 10355 >Category: c >Synopsis: i386 regparm doco note on shlib use >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: doc-bug >Submitter-Id: net >Arrival-Date: Tue Apr 08 22:26:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: >Release: 3.2.3 20030316 (Debian prerelease) (Debian testing/unstable) >Organization: >Environment: System: Linux blah 2.2.15 #1 Tue Apr 25 17:13:48 EST 2000 i586 unknown unknown GNU/Linux Architecture: i586 host: i386-pc-linux-gnu build: i386-pc-linux-gnu target: i386-pc-linux-gnu configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux >Description: The i386 regparm attribute is not good for functions in shared libraries on some systems. It'd be nice to have a warning about that in the manual. >How-To-Repeat: On Solaris 8, the loader's lazy binding resolver code clobbers eax, ecx and edx, in accordance with the standard calling conventions, meaning bad values reach the first call to a regparm function. >Fix: I'd like to propose the few words below. GLIBC and FreeBSD are the only loaders I've had a close look at. Very possibly other BSD flavours are safe too. --=-=-= Content-Disposition: attachment; filename=extend.texi.regparm-plt.diff --- extend.texi.~1.127.~ 2003-03-27 09:10:43.000000000 +1000 +++ extend.texi 2003-04-09 08:17:25.000000000 +1000 @@ -2360,6 +2360,7 @@ @code{local-dynamic}, @code{initial-exec} or @code{local-exec}. @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, @@ -2367,6 +2368,14 @@ 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. 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 though since the loaders there +save all registers. + @item stdcall @cindex functions that pop the argument stack on the 386 On the Intel 386, the @code{stdcall} attribute causes the compiler to --=-=-=-- >Release-Note: >Audit-Trail: >Unformatted: --=-=-=