site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com User-agent: Mutt/1.5.12-2006-07-14 On Sun, Mar 18, 2007 at 01:43:48AM +0000, Filipe Cabecinhas wrote:
Hi
I'm trying to port a compiler we had in class for Mac OS X but I'm having a little problem with the executable's entry point.
Our compiler translates from the source language to assembly, then I would assemble it with NASM, link it with our run-time library and then I could run it.
I tried to port the run-time library (changing the "int 0x80" to "sysenter"s and some other house-keeping stuff) and I'm trying to test it to see if that went well.
The problem is: After the assembling and linking part (both go well, without any kind of warnings or errors), I try to execute it but it doesn't run. I was thinking darwin would call the _start function but maybe that's not the case. I also tried googling to see if I could tell nasm/ld which function was the entry point but I had no luck.
The question is: how does darwin know where is the entry point of the binary and how can I choose it?
Use -e flag in ld(1). It is actually stored in the thread state, the kernel loads this thread state when the binary is loaded, you can see for yourself with otool -l, srr0 on ppc and eip on 32bit x86. - gl
If I should post in another list please tell me which. By reading the titles of the lists, this one seemed the best.
Thanks for the help
Filipe Cabecinhas
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/glee%40cse.unsw.edu.au
This email sent to glee@cse.unsw.edu.au
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com