GCC's -mstackrealign option
GCC's -mstackrealign option
- Subject: GCC's -mstackrealign option
- From: Ladd Van Tol <email@hidden>
- Date: Wed, 14 Jun 2006 12:46:04 -0700
So I'm porting some legacy x86 assembly to work on MacTel. The
assembly code uses 4-byte stack alignment, whereas GCC on Mac OS X
uses 16-byte alignment. This becomes problematic in places where the
assembly calls back into the C code.
Poking around the man pages, I noticed this useful-looking option:
-mstackrealign
Realign the stack at entry. On the Intel x86, the -
mstackrealign
option will generate an alternate prologue/epilogue that
realigns
the runtime stack. This supports mixing legacy codes
that keep a
4-byte aligned stack with modern codes that keep a 16-
byte stack
for SSE compatibility. The alternate prologue and
epilogue are
slower and bigger than the regular ones, and they require
one dedi-
cated register for the entire function. This also lowers
the num-
ber of registers available if used in conjunction with
the "reg-
parm" attribute. Nested functions encountered while -
mstackrealign
is on will generate warnings, and they will not realign
the stack
when called.
When I turn this on, my callbacks work as expected, and the function
prologue appears to do the right thing to get back into 16-byte
alignment. Unfortunately, gdb is less happy and refuses to show
correct values for local variables or step correctly when this option
is on. The debugging problems even occur in a simple test project
without any assembly.
I've filed a bug (#4585228) but in the meanwhile is there any way to
coax GDB into behaving with -mstackrealign turned on? I'm using the
Xcode 2.3 release.
Thanks,
Ladd
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden