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

Panagiotis Issaris takis
Wed Mar 14 23:12:56 CET 2007


Hi M?ns,

M?ns Rullg?rd schreef:
> Panagiotis Issaris <takis at issaris.org> writes:
>> Diego Biurrun schreef:
>>> On Wed, Mar 14, 2007 at 09:32:51PM +0100, Panagiotis Issaris wrote:
>>>> M?ns Rullg?rd schreef:
>>>>> Panagiotis Issaris <takis.issaris at uhasselt.be> writes:
>>>>>
>>>>>> +int main(){
>>>>>> +    volatile int i=0;
>>>>>> +    asm volatile (
>>>>>> +        "xorl %%ebp, %%ebp"
>>>>>> +    ::: "%ebp");
>>>>>> +    return i;
>>>>>> +}
>>>>>> +EOF
>>>>> 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.
>>> Could you add a comment?  This is non-intuitive..
>> Sure.
>>
>> Would you prefer the shorted but less clear:
>>
>> +# check whether EBP is available on x86
>> +# As 'i' is stored on the stack, this program will crash
>> +# if a the base pointer is used to access it because the
>> +# base pointer is cleared in the inline assembly code.
> 
> That will do nicely.
Updated patch attached. I've removed the x86_64 test for now and moved the
comment inside the conditional as the other patch adds the other test in
the same conditional. (And I got rid of the forgotten "a" in the "if a
the base pointer".)

 configure |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

-- 
With friendly regards,
Takis

vCard: http://www.issaris.org/pi.vcf
Public key: http://www.issaris.org/pi.key
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pi-20070314T231001-ffmpeg-ebp_available3.diff
Type: text/x-patch
Size: 829 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070314/19585502/attachment.bin>



More information about the ffmpeg-devel mailing list