Re: NASM with Xcode 3.2 ?
Re: NASM with Xcode 3.2 ?
- Subject: Re: NASM with Xcode 3.2 ?
- From: Colin Howarth <email@hidden>
- Date: Sun, 11 Oct 2009 23:24:39 +0200
On 11 Oct, 2009, at 22:48, Wim Lewis wrote:
On Oct 11, 2009, at 9:00 AM, Colin Howarth wrote:
Now it compiles, but the bit of code I copied from the NASM Manual
(Chapter 8. Writing 32 bit code (Unix...)
crashes with asm misaligned_stack_error.
As Jean-Daniel Dupas notes, the OSX ABI is probably slightly
different from the one you're writing from. In this case, I think
the problem is that when you do a function call to a dynamically-
linked function on OSX intel, the stack needs to be aligned to a 16-
byte(?) boundary --- this is a result of the dyld stub needing to
save some SIMD registers on the stack.
Thanks, Wim. I'll now read up on this. There's:
Mac OS X ABI Dynamic Loader Reference
Mac OS X ABI Function Call Guide
Mac OS X ABI Mach-O File Format Reference
... ;-)
Any help appreciated. Not especially with the code - I just want to
see something on the console :-)
Changing the 'print' function to align the stack will work. Here's
an example --- I just set a breakpoint on the "call _printf" line
and examined the $esp register to see how much I'd need to adjust
the stack in order to align it. In this case, it's making up for the
effects of the stack manipulation in _myfunc as well as in print.
Ah, that's another thing.
I can set break points in my C code, but not in my .nasm code.
I've probably configured something silly ;-(
--colin
_______________________________________________
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