[FFmpeg-devel] PIC and YASM

Reimar Döffinger Reimar.Doeffinger
Sun Nov 8 19:34:35 CET 2009

On Sun, Nov 08, 2009 at 01:16:39PM -0500, David Conrad wrote:
> On Nov 8, 2009, at 9:35 AM, M?ns Rullg?rd wrote:
> >Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
> >
> >>On Sun, Nov 08, 2009 at 01:47:20PM +0000, M?ns Rullg?rd wrote:
> >>>Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
> >>>
> >>>>Hello,
> >>>>I have been trying to figure out some compilation issues
> >>>>with hardened
> >>>>gentoo on AMD64 and they all come down to YASM.
> >>>>Several issues:
> >>>>-DPIC is and must be added explicitly to the yasm flags.
> >>>>in particular:
> >>>>--enable-pic will not add -DPIC to YASMFLAGS, nor will the
> >>>>enable_pic
> >>>>function. --enable-shared will though.
> >>>
> >>>That's easy to fix.  Does this work better?
> >>
> >>Probably, though why not just put it in the enable_pic function?
> >
> >Why litter a generic function with x86-specifics?
> >
> >>(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.
> >
> >>and the macho64 special-case.
> >
> >I don't know the story behind that one.
> Mach-o doesn't support 32-bit absolute relocations on x86_64, only
> 64-bit absolute which most instructions don't support.

Well, but since there is no issue with the inline-assembly, that must
mean that our inline assembly must be using PIC-relative addressing,
which in turn must mean that one of __PIC__ __pic__ or PIC is defined,
which in yet another turn means that my suggested patch would
detect that system/compiler as using PIC and enabling it properly,
no need for special-case hackery.

More information about the ffmpeg-devel mailing list