[FFmpeg-devel] PIC and YASM

Reimar Döffinger Reimar.Doeffinger
Sun Nov 8 15:45:18 CET 2009


On Sun, Nov 08, 2009 at 02:35:06PM +0000, M?ns Rullg?rd wrote:
> Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
> > (x86inc.asm will unset it by itself where it is not supported)
> > I also suspect that my proposal will allow to get rid of that
> > "enable pic" hack for OpenBSD
> 
> OpenBSD requires PIC.  Always.  End of story.

Not really. I suspect with
--extra-cflags=-mnopie --extra-ldflags=-mnopie
or similar it will work fine without.

> > However that darwin case means the check would have to be done earlier
> > (to get -mdynamic-no-pic):
> > Index: configure
> > ===================================================================
> > --- configure   (revision 20469)
> > +++ configure   (working copy)
> > @@ -1876,6 +1876,7 @@
> >
> >  enable $arch $subarch
> >  enabled spic && enable pic
> > +check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
> 
> what is the purpose of this?

To detect whether PIC is enabled by the compiler without extra options
(usually implying that also -fPIE is set), as is the case for the
OpenBSD, (darwin64?), haiku and hardened gentoo compilers.
It also is related to this code in libavutil/internal.h:
> #if ( defined(__PIC__) || defined(__pic__) ) && ! defined(PIC)
> #    define PIC
> #endif
On AMD64 in particular that means that if any of __PIC__ __pic__ or PIC
are defined the inline asm code will be generated as PIC-relative.
Above change is one way to make the YASM-code behave the same.



More information about the ffmpeg-devel mailing list