Andrew is referring to the following:
[EMAIL PROTECTED] cat foo.c
extern int a;
int foo(void) { return a; }
[EMAIL PROTECTED] cat bar.c
int a = 1;
[EMAIL PROTECTED] cc -mdynamic-no-pic -c foo.c -arch ppc
[EMAIL PROTECTED] cc -mdynamic-no-pic -c bar.c -arch ppc
[EMAIL PROTECTED] 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
[EMAIL PROTECTED]
Instead of going through stubs in the data segment, -mdynamic-no-pic
puts relocations directly in the text segment on the assumption that
the final linked image will be an executable at a fixed address and
the relocations will be resolved to absolute addresses. If you do the
same experiment with -arch ppc64, you will not get a static linker
error, but instead the program will crash at runtime. Some may
consider that a bug that should be reported to Apple.
I don't believe there's a general way of detecting non-dylib-safe
object files, except trying to link it into a dylib and see if it
fails (for ppc32)
Shantonu
On Apr 26, 2006, at 6:45 PM, Jack Howarth wrote:
Andrew,
What on earth would make you think that the linker on Darwin would
reject non-PIC code in linking a shared library. The linker on Linux
doesn't do any such thing (hence the discussion on the Debian mailing
list of adopting this as check on their builds).
http://lists.debian.org/debian-gcc/2003/10/msg00115.html
Jack