x86 Assembly on a Mac

前端 未结 9 1507
温柔的废话
温柔的废话 2020-11-28 01:15

Does anyone know of any good tools (I\'m looking for IDEs) to write assembly on the Mac. Xcode is a little cumbersome to me.

Also, on the Intel Macs, can I use gener

9条回答
  •  萌比男神i
    2020-11-28 02:07

    Recently I wanted to learn how to compile Intel x86 on Mac OS X:

    For nasm:

    -o hello.tmp - outfile
    -f macho - specify format
    Linux - elf or elf64
    Mac OSX - macho
    

    For ld:

    -arch i386 - specify architecture (32 bit assembly)
    -macosx_version_min 10.6 (Mac OSX - complains about default specification)
    -no_pie (Mac OSX - removes ld warning)
    -e main - specify main symbol name (Mac OSX - default is start)
    -o hello.o - outfile
    

    For Shell:

    ./hello.o - execution
    

    One-liner:

    nasm -o hello.tmp -f macho hello.s && ld -arch i386 -macosx_version_min 10.6 -no_pie -e _main -o hello.o hello.tmp && ./hello.o
    

    Let me know if this helps!

    I wrote how to do it on my blog here:

    http://blog.burrowsapps.com/2013/07/how-to-compile-helloworld-in-intel-x86.html

    For a more verbose explanation, I explained on my Github here:

    https://github.com/jaredsburrows/Assembly

提交回复
热议问题