I\'m trying to make a program compiled with GCC and using Qt and SSE intrinsics. It seems that when one of my functions is called by Qt, the stack alignment is not preserved
__attribute__((force_align_arg_pointer)) void paintEvent(QPaintEvent *);
made it work! Does anybody have a better solution?
You can use the option -mstackrealign
to do that without adding attributes to your source code:
-mstackrealign Realign the stack at entry. On the Intel x86, the -mstackrealign option will generate an alternate prologue and epilogue that realigns the runtime stack if necessary. This supports mixing legacy codes that keep a 4-byte aligned stack with modern codes that keep a 16-byte stack for SSE compatibility. See also the attribute force_align_arg_pointer, applicable to individual functions.
(from the GCC docs)