3 ms·
If you already know C, you can start out by looking at the machine code generated by your compiler with "objdump -d" on Linux and "otool -tV" on Mac. Start expe
by penberg 13y ago
If you already know C, you can start out by looking at the machine code generated by your compiler with "objdump -d" on Linux and "otool -tV" on Mac. Start experimenting by writing out C constructs like functions, loops, switch statements, etc., and just looking at what the generated code looks like.
Of course, to do that, you need to find the manual for your machine architecture. The x86 manuals are, for example, available here:
http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html http://www.intel.com/content/www/us/en/processors/architectu...
You also then start to notice things like the operating system specific application binary interfaces (ABI):
http://www.x86-64.org/documentation/abi.pdf http://www.x86-64.org/documentation/abi.pdf
and object file formats such as ELF that's used in Linux:
http://www.skyfree.org/linux/references/ELF_Format.pdf http://www.skyfree.org/linux/references/ELF_Format.pdf
or Mach-O used in Mac OS X:
https://developer.apple.com/library/mac/documentation/developertools/conceptual/machoruntime/reference/reference.html https://developer.apple.com/library/mac/documentation/develo...
You can also do the same thing with the JVM and look at its JIT-generated machine code with the '-XX:+PrintCompilation' option:
http://stackoverflow.com/questions/13086690/understanding-the-output-of-xxprintcompilation http://stackoverflow.com/questions/13086690/understanding-th...