[FFmpeg-devel] PIC and YASM

Måns Rullgård mans
Mon Nov 9 16:43:34 CET 2009


Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:

> On Mon, Nov 09, 2009 at 01:42:24PM +0100, Diego Biurrun wrote:
>> On Sun, Nov 08, 2009 at 07:34:35PM +0100, Reimar D?ffinger wrote:
>> > 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:
>> > > >>
>> > > >>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.
>> 
>> Remove the special case and let us find out.
>
> That depends on the check for PIC.
> Attached patch would add it and remove all the hacks that I think would
> be unnecessary, though they are untested as of now (though I tested a similar
> change for OSX/OSX64 for MPlayer).
>
> Index: configure
> ===================================================================
> --- configure	(revision 20485)
> +++ configure	(working copy)
> @@ -1876,14 +1876,12 @@
>  
>  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
>      beos|haiku|zeta)
>          prefix_default="$HOME/config"
> -        # helps building libavcodec
> -        add_cppflags -DPIC
> -        add_cflags -fomit-frame-pointer

We already add -fomit-frame-pointer, so that one can go.  -DPIC is
definitely wrong on its own.  The comment is absurd too.

>          # 3 gcc releases known for BeOS, each with ugly bugs
>          gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
>          case "$gcc_version" in
> @@ -1919,7 +1917,6 @@
>          ;;
>      openbsd)
>          enable malloc_aligned
> -        enable pic

OpenBSD builds fail without that currently.  Does your new __PIC__
check fix that?

>          SHFLAGS='-shared'
>          oss_indev_extralibs="-lossaudio"
>          oss_outdev_extralibs="-lossaudio"
> @@ -2235,7 +2232,6 @@
>      test -n "$extern_prefix"  && append YASMFLAGS "-DPREFIX"
>      case "$objformat" in
>          elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
> -        macho64)              append YASMFLAGS "-DPIC" ;;
>      esac
>      disabled yasm || { check_yasm "pabsw xmm0, xmm0" && enable yasm; }

I don't understand this one, but if it works, go for it.  Deleting
weird stuff is always good.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list