gmp 4.2 fails tests on G5

Jack Howarth howarth at
Thu Apr 27 15:04:53 CEST 2006

    Okay. I believe this should prove to you that the -fPIC is need...
On the gcc mailing list it was discussed that for -arch ppc64, there
was a bug in the compiler not detecting local relocations (non-PIC code)
when linking...

Ignoring that issue for now, you can use the example for -arch ppc to
demonstrate that -fast causes non-PIC code. The proof is...

[macintosh:~] cat foo.c
extern int a;
int foo(void) { return a; }
[macintosh:~] cat bar.c
int a = 1;
[macintosh:~] prrlab% cc -fast -c bar.c -arch ppc
[macintosh:~] prrlab% cc -fast -c foo.c -arch ppc
[macintosh:~] prrlab% cc -dynamiclib -o libfoo.dylib foo.o bar.o -arch ppc
ld: foo.o has local relocation entries in non-writable section (__TEXT,__text)
/usr/bin/libtool: internal link edit command failed

Now if you repeat these steps with -arch ppc64 you will see that the
error is incorrectly suppressed. So on MacOS X, -fast DOES cause an
implicit -mdynamic-no-pic. Just add the -fPIC. Easy fix.

More information about the gmp-bugs mailing list