Hi,
http://bugs.freepascal.org/view.php?id=17384
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838
can a C-ABI expert enlight us on this ABI mess.
Does this also effect calling in general of C-functions from Free Pascal.
regards,
Den Jean

Mailing lists / fpc-devel / 2010-11
3 messages · 2 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi,
http://bugs.freepascal.org/view.php?id=17384
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838
can a C-ABI expert enlight us on this ABI mess.
Does this also effect calling in general of C-functions from Free Pascal.
regards,
Den Jean
Afaik, the Linux/i386 abi only mandates 4 byte stack alignment. That means that any function requiring a higher stack alignment has to realign the stack. That's what the new -mstackrealign gcc option does.
FPC also only guarantees 4 byte stack alignment under Linux/i386. It does not have the equivalent of an -mstackrealign option, though it probably will have to be added one day to fix http://bugs.freepascal.org/view.php?id=15582 (which is basically the same issue for which that option was added to gcc).
Jonas
I am puzzled why some many projects seem to suffer from this (google), Is it not just a matter of adding __attribute__ ((force_align_arg_pointer)) to the functions with sse calls? Instead of compiling the whole code with -mstackrealign ?
The following extract from qglobal.h shows me it is only considered a problem on windows ?!
//defines the type for the WNDPROC on windows
//the alignment needs to be forced for sse2 to not crash with mingw #if defined(Q_WS_WIN)
# if defined(Q_CC_MINGW)
# define QT_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer)) # else
# define QT_ENSURE_STACK_ALIGNED_FOR_SSE
# endif
# define QT_WIN_CALLBACK CALLBACK QT_ENSURE_STACK_ALIGNED_FOR_SSE #endif
When grepping the Qt source, I do see this attribute popping up in windows only files like qdnd_win.cpp, so I am still puzzled why then with these precautions by Nokia Qt, it still does not work.
regards,
Den Jean