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:01:19 +0200
On 11 Oct, 2009, at 19:07, Jean-Daniel Dupas wrote:
Le 11 oct. 2009 à 18:00, Colin Howarth a écrit :
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.
Any help appreciated. Not especially with the code - I just want to
see something on the console :-)
The Mac OS X ABI probably does not match the one used in your book.
The simplest way to find how to write function prolog and epilog is
to write a simple function in a C file in Xcode, right clic on the
file, and choose "Show Assembly Code".
Thanks for the tip, but cc created 337 lines of gibberish (aka code) for
int myfunc2(int a, int b)
{
int c;
c = a + b;
return(c);
}
:-)
Anyway,
my code (all one line of it) was wrong:
instead of
call print
I've put
jmp print
which is much better: I now get the proper printout on the console :-)
So getting called from C, and calling a C function works OK.
... and it just crashes after the printout...
But that's OK - I haven't done any x86 assembler for, ummm, about 15
years, and I haven't got my books, so I'm doing it from -- ahhh,
what's it called? -- memory.
--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