[Ffmpeg-devel] [BUG] Compilation failure when using --disable-opts
Måns Rullgård
mans
Wed Mar 14 23:19:24 CET 2007
Panagiotis Issaris <takis at issaris.org> writes:
> 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".)
Why not merge the patches? They're quite small and not entirely
unrelated.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list