[Ffmpeg-devel] [BUG] Compilation failure when using --disable-opts

Måns Rullgård mans
Wed Mar 14 21:52:15 CET 2007


Panagiotis Issaris <takis at issaris.org> writes:

> Hi M?ns,
>
> M?ns Rullg?rd schreef:
>> Panagiotis Issaris <takis.issaris at uhasselt.be> writes:
>> 
>>> The attached patch defines CONFIG_EBP in config.h if EBP is available.
>>>
>>>  configure |   16 ++++++++++++++++
>>>  1 file changed, 16 insertions(+)
>>>
>>> With friendly regards,
>>> Takis
>>> Index: configure
>>> ===================================================================
>>> --- configure	(revision 8405)
>>> +++ configure	(working copy)
>>> @@ -1390,6 +1390,18 @@
>>>      die "C compiler test failed."
>>>  fi
>>>  
>>> +# check whether EBP is available
>>> +ebp_available=no
>>> +check_exec <<EOF && ebp_available=yes
>> 
>> check_exec <<EOF && enable ebp_available
> Done.
>
>>> +int main(){
>>> +    volatile int i=0;
>>> +    asm volatile (
>>> +        "xorl %%ebp, %%ebp"
>>> +    ::: "%ebp");
>>> +    return i;
>>> +}
>>> +EOF
>> 
>> All of the above should be conditional on x86 target.  
> Done.
>
>> And what's the "int i" good for?
> The 'i' is set at the beginning of the program, and so base pointer will
> be used to initialize it (it is on the stack). At the end of the program
> the the contents of 'i' is the returnvalue of the program and so the
> base pointer will again be used to get at the value of 'i'. As it is set
> to zero by the inline assembly code, a 0+offset pointer will be
> dereferenced caused a segfault. Without the 'i' or with
> -fomit-frame-pointer this won't happen.

Makes sense.  I figured there was some reason for it, but as Diego
said, a comment would be nice.

> Index: configure
> ===================================================================
> --- configure	(revision 8405)
> +++ configure	(working copy)
> @@ -542,6 +542,7 @@
>      bktr
>      dc1394
>      dv1394
> +    ebp_available
>      ffmpeg
>      ffplay
>      ffserver
> @@ -1390,6 +1391,20 @@
>      die "C compiler test failed."
>  fi
>  
> +# check whether EBP is available on x86
> +if test $arch = "x86_32" -o $arch = "x86_64"; then
> +ebp_available=no
> +check_exec <<EOF && enable ebp_available
> +int main(){
> +    volatile int i=0;
> +    asm volatile (
> +        "xorl %%ebp, %%ebp"
> +    ::: "%ebp");
> +    return i;
> +}
> +EOF
> +fi

Isn't there already some x86 section this could be added to?  And are
you certain that this is correct for x86_64?  Is the check even needed
there, what with all the extra registers?

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




More information about the ffmpeg-devel mailing list