run 32 bit assembly on 64 bit processor with mac os x

前端 未结 2 929
甜味超标
甜味超标 2021-01-15 12:45

I have a problem with running 32 bit assembly on my 64 bit mac running os x 10.9.5. I also have NASM 2.11.08 installed. I am currently reading Assembly Language Step by Step

相关标签:
2条回答
  • 2021-01-15 13:37

    You have two problems here.

    1. You are compiling your assembly file to an ELF binary (-f elf), which is not supported by the Mac OS X ld. Use -f macho to generate Mach-O object files for your system, then use -arch i386 to link it as a 32-bit binary.

    2. You are trying to use Linux system calls on Mac OS X. This does not work; the system call numbers and calling conventions are different, and are not publicly documented. Fixing this is possible, but, as Frank Kotler mentions, it's not a task I'd recommend for a beginner; your best bet will be to use a 32-bit Linux system to complete these tutorials.

    0 讨论(0)
  • 2021-01-15 13:41

    An executable for Linux won't run on a Mac, period. Install Linux on a virtual machine on your Mac, if you want to run Jeff Duntemann's stuff. The code can be translated to -f macho64 fairly(?) easily, but there's a bad bug in Nasm-2.11.08 on -f macho64 :(

    There's a release candidate - http://www.nasm.us/pub/nasm/releasebuilds/2.11.09rc1/macosx/ - which "may" fix it. Someone needs to test it. Perhaps not a good job for a beginner. You should be able to program using gcc with your Mac, but not using "Step by Step". Nasm will work on your Mac... but not right now... Install Linux if you can, for now.

    0 讨论(0)
提交回复
热议问题