[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
-prefer-pic
From: |
Olly Betts |
Subject: |
-prefer-pic |
Date: |
Thu, 10 Jan 2008 18:42:16 +0000 (UTC) |
User-agent: |
slrn/0.9.8.1pl1 (Debian) |
The output from:
libtool --help --mode=compile
contains:
-prefer-pic try to building PIC objects only
-prefer-non-pic try to building non-PIC objects only
Firstly, that's poor grammar ("try to build" would be better).
Secondly, this seems to be the full extent of the documentation for
these options - searching the info manual for "-prefer" doesn't find
anything. The NEWS file notes they were added in libtool 1.3d "to
control the generation of PIC/non-PIC code".
Experimenting, it seems that -prefer-pic results in PIC code in static
libraries, whereas -prefer-non-pic results in non-PIC code in shared
libraries, but it's unclear to me what "try" means. On x86-64 Linux,
(which doesn't allow non-PIC code in shared libraries), I still get
non-PIC code in the object destined for the shared library, so it
doesn't seem to take platform-specific restrictions into account:
$ /usr/share/misc/config.guess
x86_64-unknown-linux-gnu
$ libtool --mode=compile gcc -prefer-non-pic -c xxx.c -o xxx.o
gcc -c xxx.c -o .libs/xxx.o
gcc -c xxx.c -o xxx.o >/dev/null 2>&1
However, looking at the libtool script, I see:
if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
# non-PIC code in shared libraries is not supported
pic_mode=default
fi
This is with the Ubuntu gutsy libtool package of 1.5.24, but vanilla
1.5.22 seems to behave the same way:
$ libtool --version
ltmain.sh (GNU libtool) 1.5.24 Debian 1.5.24-1ubuntu1 (1.1220.2.456 2007/06/24
02:25:32)
I think it would be useful to cover these options in a bit more detail
in the manual.
Cheers,
Olly
- -prefer-pic,
Olly Betts <=