[FFmpeg-devel] PIC and YASM
Reimar Döffinger
Reimar.Doeffinger
Sun Nov 8 15:39:16 CET 2009
On Sun, Nov 08, 2009 at 03:27:16PM +0100, Reimar D?ffinger wrote:
> 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?
> (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 and the macho64 special-case.
> Not to mention the Haiku/Zeta case that just looks very strange,
> if not to say wrong (adding -DPIC but not doing enable_pic?).
> 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
>
> # OS specific
> case $target_os in
> @@ -2103,6 +2104,7 @@
> add_cppflags -DPIC
> add_cflags -fPIC
> add_asflags -fPIC
> + append YASMFLAGS "-DPIC"
> }
>
> enabled pic && enable_pic
> @@ -2231,7 +2233,6 @@
>
> YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)"
> enabled x86_64 && append YASMFLAGS "-m amd64"
> - enabled_all x86_64 shared && append YASMFLAGS "-DPIC"
> case "$objformat" in
> elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
> macho64) append YASMFLAGS "-DPIC -DPREFIX" ;;
Hmm. I guess I obviously haven't tested it, since the YASMFLAGS= line
will of course overwrite it.
However does anything speak against
> enabled pic && append YASMFLAGS "-DPIC"
instead of
> enabled_all x86_64 shared && append YASMFLAGS "-DPIC"
?
More information about the ffmpeg-devel
mailing list