This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: detecting non-PIC in shared lib on Darwin?
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Andrew Haley <aph at redhat dot com>
- Cc: Jack Howarth <howarth at bromo dot msbb dot uc dot edu>, pinskia at physics dot uc dot edu, gcc at gcc dot gnu dot org
- Date: Thu, 27 Apr 2006 14:14:04 +0200
- Subject: Re: detecting non-PIC in shared lib on Darwin?
- References: <20060427014543.139DE11003D@bromo.msbb.uc.edu> <17488.37839.818833.975618@zapata.pink>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Apr 27, 2006 at 10:50:07AM +0100, Andrew Haley wrote:
> 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
On all arches that use binutils you can use -Wl,--warn-shared-textrel
to get at least a warning about this...
Jakub