[FFmpeg-devel] PIC and YASM

Reimar Döffinger Reimar.Doeffinger
Sun Nov 8 09:24:44 CET 2009


On Sun, Nov 08, 2009 at 09:06:30AM +0100, Reimar D?ffinger wrote:
> On Sun, Nov 08, 2009 at 01:12:47AM +0000, Loren Merritt wrote:
> > On Sun, 8 Nov 2009, Reimar D?ffinger wrote:
> > 
> > > I have been trying to figure out some compilation issues with hardened
> > > gentoo on AMD64 and they all come down to YASM.
> > 
> > I would object to this in x264, since PIC is slower than non-PIC at 
> > indexing static arrays. None of the yasm code in ffmpeg does that, so 
> > no problem for now. But I may revert this if I ever do write/import such 
> > code.
> 
> The patch is obsolete with my second mail.
> However the issues remain, at the very least --enable-pic on x86_64
> should be fixed.

Something like this might work (untested), and I wonder if the macho64
case then still needs the -DPIC hack:
Index: configure
===================================================================
--- configure   (revision 20469)
+++ configure   (working copy)
@@ -2103,8 +2103,11 @@
     add_cppflags -DPIC
     add_cflags   -fPIC
     add_asflags  -fPIC
+    append YASMFLAGS "-DPIC"
 }
 
+check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
+
 enabled pic && enable_pic
 
 check_cc <<EOF || die "Symbol mangling check failed."
@@ -2231,7 +2234,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" ;;



More information about the ffmpeg-devel mailing list