This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: detecting non-PIC in shared lib on Darwin?


Jack Howarth writes:

 >     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).

x86 is special.  On x86 it's somewhat possible to build shared
libraries without PIC, but it's a really bad idea.  On other arches,
PIC is compulsory.  So:


[aph@zorro ~]$ /usr/bin/gcc -m32 -shared -o client.so client.c
[aph@zorro ~]$ /usr/bin/gcc -m64 -shared -o client.so client.c
/usr/bin/ld: /tmp/ccaXMxyb.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

But please, take this to binutils.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]