[fpc-devel] Stack alignment on i386

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Dec 22 17:56:06 CET 2011


On 22 Dec 2011, at 17:18, Sven Barth wrote:

> Am 22.12.2011 17:04, schrieb Jonas Maebe:
>>
>> Closed source code should be compiled with a compiler that respects  
>> the
>> ABI by default. I guess most of it is compiled with Microsoft Visual
>> Studio, which does presumably does that. I don't think that any  
>> compiler
>> other than GCC can create code for Win32 that assumes a 16-byte  
>> aligned
>> stack.
>
> My mysterious OpenCV problems are with the MSVC version of the  
> libraries...

Then the problem is probably something different.

>> Then you would have to add this to all routines that may (directly or
>> indirectly)

*call*

>> a routine from a broken library.
>
> Wouldn't it be sufficient to align the stack when calling a routine  
> from such a library? (sorry for sounding naive here, but the  
> requirements for stack alignment still puzzle me a bit)

Keeping an aligned stack requires completely different code generation  
inside the calling routine, you can't implement that on a call-by-call  
basis.


Jonas



More information about the fpc-devel mailing list