Now that I have a spare machine where I can do all my experiments, I can start again to write posts about Disassembly C code for fun but, wait, my current hardware is a 32-bit Pentium-M CPU and I want to build and disassembly 64-bit code!
Let’s set up my Ubuntu for 64-bit cross-compilation.
The trick is to install the gcc and gdb packages to do cross-compilation. On an Ubuntu system you can just issue:
After the installation of the packages you can build an disassembly your 64-bit even on a 32-bit hardware. For example this code:
will be compiled and disassembled with this:
Note the extra -m64 argument of cc which tells the compiler to produce 64-bit code and the use of gdb-multiarch instead of the plain gdb to be able to interpreter the 64-bit debug symbols.