[Ffmpeg-devel] [PATCH] Make use of GCC's __PIC__ definition when available

Diego 'Flameeyes' Pettenò flameeyes
Sat Jul 1 16:03:46 CEST 2006

The attached patch is the patch version of something that we already do in a 
different way in Gentoo with ffmpeg and other software that uses ffmpeg, 
cleaned up to be suitable for a general use.

Basically, instead of relying on -DPIC to know when PIC code is built, it 
relies when possible on the __PIC__ definition by the compiler (GCC defines 
it when building PIC code).
The reason for this is that there are cases in which GCC compiles PIC code 
even if -fPIC is not used directly, for instance when building PIE (position 
independent executables) often uses for hardened systems.

Basically in configure it's checked if -fPIC enable the __PIC__ symbol, if it 
does not, it's injected via CFLAGS exactly as before; if it is, just -fPIC is 
used to build PIC libraries, the code is then changed to check for __PIC__ 
instead of the definition of PIC (it can be done, every compiler defining 
__PIC__ defines it to 1, and the commandline defines it to 1 too the way I 
made it).

Functional changes: none, a part that now ffmpeg builds correct code for 
hardened systems.

Diego "Flameeyes" Petten? - http://farragut.flameeyes.is-a-geek.org/
Gentoo/Alt lead, Gentoo/FreeBSD, Video, AMD64, Sound, PAM, KDE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-pic.patch
Type: text/x-diff
Size: 10074 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060701/fe06af31/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060701/fe06af31/attachment.pgp>

More information about the ffmpeg-devel mailing list