View Full Version : NASM and Mac format
davidlt
Jul 23, 2008, 10:04 AM
Hello, I have never did Asm programming on UNIX type operating system and now I have tried it. I am using preisntalled NASM as compiler. I took simple Hello World program to try it for the first time and compiled like this:
nasm -f macho -o hello hello.asm
and tried to launch it:
./hello
I got message that permission was denied and then I tried with sudo the same and got message: "sudo: ./hello: command not found".
The question would be how to compile to Mac executive file and run it without any problems?
lee1210
Jul 23, 2008, 10:16 AM
This thread:
http://forums.macrumors.com/showthread.php?t=455794
Goes through a lot of what you'll need to do to get this going.
-Lee
davidlt
Jul 23, 2008, 10:24 AM
Okay, Linux was even easier, I did not know that UNIX is using stack for the arguments, thanks... :)
Any doc with full syscalls information for Mac?
Cromulent
Jul 23, 2008, 03:11 PM
Any doc with full syscalls information for Mac?
Any FreeBSD documentation should be fine.
Edit : If you want the specific numbers to use for specific system calls they are located in /usr/include/sys/syscall.h
Edit 2 : This is a useful document :
http://www.freebsd.org/doc/en/books/developers-handbook/x86.html
Muncher
Jul 23, 2008, 05:13 PM
Look here (http://www.int80h.org/).
larkost
Jul 24, 2008, 09:52 PM
I don't know a thing about asm, but it seems to be that the problem might be that the output file is not set as executable. If you "chmod +x" it, then it might work.
Muncher
Jul 25, 2008, 12:28 PM
I don't know a thing about asm, but it seems to be that the problem might be that the output file is not set as executable. If you "chmod +x" it, then it might work.
That could do it. :D
Cromulent
Jul 26, 2008, 09:46 AM
That could do it. :D
As long as you are assembling using the following commands it should just work.
nasm -f macho myfile.s
ld -o my_test_asm_prog myfile.o
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.