Bug 49594

Summary: bootstrap failure in libffi:darwin_closure for powerpc-darwin8
Product: gcc Reporter: David Fang <fang>
Component: libffiAssignee: Iain Sandoe <iains>
Status: RESOLVED FIXED    
Severity: normal CC: howarth.at.gcc, iains
Priority: P3    
Version: 4.6.1   
Target Milestone: ---   
Host: powerpc-apple-darwin8 Target: powerpc-apple-darwin8
Build: powerpc-apple-darwin8 Known to work:
Known to fail: Last reconfirmed: 2011-07-01 16:08:24
Attachments: make sure that the size of the dyld_stub_binding_helper is adjusted for arch.

Description David Fang 2011-06-30 16:01:40 UTC
During build of gcc-4.6.1 on powerpc-darwin8 (after having disabled libquadmath from PR 49582), I get a compilation error in libffi on powerpc/darwin_closure.lo:

depbase=`echo src/powerpc/darwin_closure.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`
;\
        /bin/sh ./libtool   --mode=compile /Volumes/Mercedes2/sw/src/fink.build/gcc46-4.6.1-1000/darwin_objdir/./gcc/xgcc -B/Volumes/Mercedes2/sw/src/fink.build/gcc46-4.6.1-1000/darwin_objdir/./gcc/ -B/sw/lib/gcc4.6/powerpc-apple-darwin8.11.0/bin/ -B/sw/lib/gcc4.6/powerpc-apple-darwin8.11.0/lib/ -isystem /sw/lib/gcc4.6/powerpc-apple-darwin8.11.0/include -isystem /sw/lib/gcc4.6/powerpc-apple-darwin8.11.0/sys-include  -m64 -DHAVE_CONFIG_H -I. -I../../../../gcc-4.6.1/libffi  -I.
 -I../../../../gcc-4.6.1/libffi/include -Iinclude -I../../../../gcc-4.6.1/libffi/src  -I. -I../../../../gcc-4.6.1/libffi/include -Iinclude -I../../../../gcc-4.6.1/libffi/src -g -O2 -MT src/powerpc/darwin_closure.lo -MD -MP -MF $depbase.Tpo 
-c -o src/powerpc/darwin_closure.lo ../../../../gcc-4.6.1/libffi/src/powerpc/darwin_closure.S &&\
        mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Volumes/Mercedes2/sw/src/fink.build/gcc46-4.6.1-1000/darwin_objdir/./gcc/xgcc -B/Volumes/Mercedes2/sw/src/fink.build/gcc46-4.6.1-1000/darwin_objdir/./gcc/ -B/sw/lib/gcc4.6/powerpc-apple-darwin8.11.0/bin/ -B/sw/lib/gcc4.6/powerpc-apple-darwin8.11.0/lib/ -isystem /sw/lib/gcc4.6/powerpc-apple-darwin8.11.0/include -isystem /sw/lib/gcc4.6/powerpc-apple-darwin8.11.0/sys-include -m64 
-DHAVE_CONFIG_H -I. -I../../../../gcc-4.6.1/libffi -I. -I../../../../gcc-4.6.1/libffi/include -Iinclude -I../../../../gcc-4.6.1/libffi/src -I. -I../../../../gcc-4.6.1/libffi/include -Iinclude -I../../../../gcc-4.6.1/libffi/src -g -O2 -MT src/powerpc/darwin_closure.lo -MD -MP -MF src/powerpc/.deps/darwin_closure.Tpo -c 
../../../../gcc-4.6.1/libffi/src/powerpc/darwin_closure.S  -fno-common -DPIC -o 
src/powerpc/.libs/darwin_closure.o
../../../../gcc-4.6.1/libffi/src/powerpc/darwin_closure.S:unknown:missing indirect symbols for section (__DATA,__la_symbol_ptr)
make[7]: *** [src/powerpc/darwin_closure.lo] Error 1
make[6]: *** [all-recursive] Error 1
make[5]: *** [all] Error 2
make[4]: *** [multi-do] Error 1
make[3]: *** [all-multi] Error 2
make[2]: *** [all] Error 2
make[1]: *** [all-target-libffi] Error 2
make[1]: *** Waiting for unfinished jobs....

system compiler:
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: /var/tmp/gcc/gcc-5370~2/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5370)

hardware: powerpc7400 (dual G4)
OS: OS X 10.4.11 (powerpc)
Comment 1 David Fang 2011-06-30 22:58:55 UTC
darwin_closure.S was touched a while ago:

http://gcc.gnu.org/ml/gcc-cvs/2010-12/msg00700.html

by

http://gcc.gnu.org/ml/gcc-patches/2010-12/txt00045.txt

Can anyone else test this on powerpc-darwin8?  I'll see what I can figure out.
Comment 2 Iain Sandoe 2011-07-01 07:21:26 UTC
(In reply to comment #1)
> darwin_closure.S was touched a while ago:
> 
> http://gcc.gnu.org/ml/gcc-cvs/2010-12/msg00700.html
> 
> by
> 
> http://gcc.gnu.org/ml/gcc-patches/2010-12/txt00045.txt
> 
> Can anyone else test this on powerpc-darwin8?  I'll see what I can figure out.

I'll take a look at this.

As a quick work-around you might try 
"--disable-multilib"  since you appear to be building on a machine that is not 64 bit anyway.

(of course, if you need to build m64 code for other machines that won't help - but it will get you going for native stuff).
Comment 3 Iain Sandoe 2011-07-01 10:09:03 UTC
(In reply to comment #0)
> During build of gcc-4.6.1 on powerpc-darwin8 (after having disabled libquadmath
> from PR 49582), I get a compilation error in libffi on

> hardware: powerpc7400 (dual G4)
> OS: OS X 10.4.11 (powerpc)

what is your configure line, please?
Comment 4 Jack Howarth 2011-07-01 12:49:45 UTC
He is using my proposed fink gcc46 packaging so it should be...

../gcc-4.6.1/configure --prefix=/sw --prefix=/sw/lib/gcc4.6 --mandir=/sw/share/man --infodir=/sw/lib/gcc4.6/info --enable-languages=c,c++,fortran,lto,objc,obj-c++,java --with-gmp=/sw --with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --program-suffix=-fsf-4.6 --enable-cloog-backend=isl --disable-libjava-multilib --disable-libquadmath

Note that I don't see any issues with a dual G5 building gcc 4.6.1 on powerpc-apple-darwin9 under Xcode 3.1.4.
Comment 5 Iain Sandoe 2011-07-01 13:02:38 UTC
(In reply to comment #4)
> He is using my proposed fink gcc46 packaging so it should be...
> 
> ../gcc-4.6.1/configure --prefix=/sw --prefix=/sw/lib/gcc4.6
> --mandir=/sw/share/man --infodir=/sw/lib/gcc4.6/info
> --enable-languages=c,c++,fortran,lto,objc,obj-c++,java --with-gmp=/sw
> --with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw
> --with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib
> --program-suffix=-fsf-4.6 --enable-cloog-backend=isl --disable-libjava-multilib
> --disable-libquadmath
> 
> Note that I don't see any issues with a dual G5 building gcc 4.6.1 on
> powerpc-apple-darwin9 under Xcode 3.1.4.

thanks, Jack
I check darwin9 quite often, and that is OK with trunk too.

whilst it would be nice to have m64 to work on D8 - I'm wondering if it is simply more trouble than value (esp. if the User has only 32bit hardware).   I wonder how many G5 owners have a reason to use D8.

for now,  trying a build on my remaining d8 box (500M G4, so .. will take 12+ hours)... 
... also will try a X to D8 on my quad G5.
Comment 6 Iain Sandoe 2011-07-01 16:08:24 UTC
Created attachment 24655 [details]
make sure that the size of the dyld_stub_binding_helper is adjusted for arch.

please try this -
-  it resolves the problem for me on a cross to darwin8 from powerpc-darwin9.

If I have a chance over the w/e I'll boot the G5 into D8 and try a full test cycle.
Comment 7 David Fang 2011-07-01 18:13:52 UTC
(In reply to comment #6)
> Created attachment 24655 [details]
> make sure that the size of the dyld_stub_binding_helper is adjusted for arch.
> 
> please try this -
> -  it resolves the problem for me on a cross to darwin8 from powerpc-darwin9.
> 
> If I have a chance over the w/e I'll boot the G5 into D8 and try a full test
> cycle.

Hi Iain, thanks for looking into this.
The above patch worked for me when I tried to re-run it in my previously failed build dir.  I didn't try to resume the bootstrap from there.  

At the same time I also kicked off a --disable-multilib build. 
Also running on dual 533MHz G4, -j2 here, so results in half-a-day, though I might be slow responding over the weekend.  :)
Comment 8 Iain Sandoe 2011-07-02 13:10:10 UTC
I tested the patch on darwin 8 on a G5 and with crosses from darwin 9 - > darwin 8.

results are shown in:
http://gcc.gnu.org/ml/gcc-patches/2011-07/msg00134.html

FWIW: unless there's a real need to generate m64 to target a different box, I don't think there's a whole lot of point in building the multi-libs in general on darwin 8 on a G4.   It makes a huge difference to build & test as well.

Even on a G5, there are missing m64 libraries that prevent java from working, and also there's no NeXT m64 ObjC support.

Having said that, m64 c, c++, fortran and GNU ObjC work fine on darwin 8.
Comment 9 David Fang 2011-07-05 22:34:43 UTC
(In reply to comment #8)
> I tested the patch on darwin 8 on a G5 and with crosses from darwin 9 - >
> darwin 8.

Using Iain's patch ( http://gcc.gnu.org/bugzilla/attachment.cgi?id=24655 ), a native powerpc-darwin8 bootstrap has just completed successfully.
The testsuite has just begun and will probably take another day to finish.
Comment 10 David Fang 2011-07-10 04:44:46 UTC
(In reply to comment #9)
> Using Iain's patch ( http://gcc.gnu.org/bugzilla/attachment.cgi?id=24655 ), a
> native powerpc-darwin8 bootstrap has just completed successfully.
> The testsuite has just begun and will probably take another day to finish.

Along with your LTO containerization patch from PR 48108, I get excellent results on powerpc-darwin8:
http://gcc.gnu.org/ml/gcc-testresults/2011-07/msg01092.html
Comment 11 Iain Sandoe 2011-09-04 19:17:29 UTC
Author: iains
Date: Sun Sep  4 19:17:25 2011
New Revision: 178511

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178511
Log:

	PR libffi/49594
	* src/powerpc/darwin_closure.S (stubs): Make the stub binding
	helper reference track the architecture pointer size.


Modified:
    branches/gcc-4_6-branch/libffi/ChangeLog
    branches/gcc-4_6-branch/libffi/src/powerpc/darwin_closure.S
Comment 12 Iain Sandoe 2011-09-04 19:19:43 UTC
Author: iains
Date: Sun Sep  4 19:19:39 2011
New Revision: 178512

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178512
Log:

	PR libffi/49594
	* src/powerpc/darwin_closure.S (stubs): Make the stub binding
	helper reference track the architecture pointer size.


Modified:
    trunk/libffi/ChangeLog
    trunk/libffi/src/powerpc/darwin_closure.S
Comment 13 Iain Sandoe 2011-09-04 19:20:38 UTC
fixed on trunk and 4.6.