Compiling with OS X

TA-ing this class, I have to explain about compilation system. Later found out that OS X does not support many of the tools that relate to loading, linking and executing programs. More about it here.

To generate an assembly code from a c program saved as code.c :

gcc -S code.c

that will result code.s

The file code.s looks like:


Using optimization option

gcc -O1 -S code.c


gcc -O2 -S code.c


to compile and assemble code:

gcc -c code.c

will result code.o in binary format

to dump the object code, instead of

objdump -d code.o

i use

otools -tv code.o


[this posting is still being updated at any time

i’m doing many things at the same time right now 🙂 ]