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

Panagiotis Issaris takis
Wed Mar 14 22:42:07 CET 2007


Hi Diego,

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.
+ebp_available=no
+check_exec <<EOF && enable ebp_available
+int main(){
+    volatile int i=0;
+    asm volatile (

Or rather the full and clear:
+# check whether EBP is available on x86
+# 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.
+ebp_available=no
+check_exec <<EOF && enable ebp_available
+int main(){
+    volatile int i=0;
+    asm volatile (

-- 
With friendly regards,
Takis

vCard: http://www.issaris.org/pi.vcf
Public key: http://www.issaris.org/pi.key




More information about the ffmpeg-devel mailing list