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

Michael Niedermayer michaelni
Sat Jul 1 21:31:26 CEST 2006


On Sat, Jul 01, 2006 at 04:03:46PM +0200, Diego 'Flameeyes' Petten? wrote:
> 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).

rejected, __* is reserved you may not define it
add a #ifdef __PIC__ #define PIC if you want but not that mess


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is

More information about the ffmpeg-devel mailing list