On Tue, Jan 31, 2012 at 1:13 PM, Roland McGrath <rol...@hack.frob.com> wrote:
>
> From Richard's response it sounds like there is an easy fix that's
> compatible with both old and new GCC (-fno-inline).  I think we can do that
> right away without trouble, and get it onto release branches too.
>
> On the libc side more generally, I've become skeptical that the generic C
> version of initfini is worth continuing with.  (I say this as the person
> who chose to do it that way in the first place.)  These sorts of things
> always come up again and again.  It's just damn little assembly code to
> write for each machine so you get it exactly right and need not worry about
> what next year's compiler does.
>
>
> Thanks,
> Roland


I've been carrying the following patch in my ibm/ branches for a while
due to us hitting something similar earlier last year.  I'm not
opposed to working out a machine specific version.  I'll have one of
my guys draft up a proof of concept for PowerPC.

Ryan

commit 1fe05ea95e1460e5e1cf1568a8ce3982f0f02de6
Author: Ryan S. Arnold <r...@us.ibm.com>
Date:   Tue May 3 17:26:17 2011 -0500

    Prevent erroneous inline optimization of initfini.s on PowerPC64.

diff --git a/ChangeLog b/ChangeLog
index 66482ff..5913162 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-05-03  Ryan S. Arnold  <r...@us.ibm.com>
+
+       * sysdeps/powerpc/powerpc64/Makefile (CFLAGS-initfini.s): Add
+       -fno-inline to prevent potential erroneous optimization where init is
+       inlined to branch directly to fini.
+
 2011-02-23  Andreas Schwab  <sch...@redhat.com>
            Ulrich Drepper  <drep...@gmail.com>

diff --git a/sysdeps/powerpc/powerpc64/Makefile
b/sysdeps/powerpc/powerpc64/Makefile
index 78d4f07..fe96aae 100644
--- a/sysdeps/powerpc/powerpc64/Makefile
+++ b/sysdeps/powerpc/powerpc64/Makefile
@@ -28,7 +28,7 @@ elide-routines.os += hp-timing
 ifneq ($(elf),no)
 # The initfini generation code doesn't work in the presence of -fPIC, so
 # we use -fpic instead which is much better.
-CFLAGS-initfini.s += -fpic -O1
+CFLAGS-initfini.s += -fpic -O1 -fno-inline
 endif
 endif

Reply via email to