During the various stages of compilation in C or C++, I know that an object file gets generated (i.e., any_name.o file). What does this .o file contain? I can\'t open it sin
Use the file command for things like this. It's an ELF object file on a modern Linux system. E.g. if compiled for 32-bit x86.
ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
In contrast, a dynamically linked executable might look like:
ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
To see headers, including section names, you can use:
objdump -x any_name.o
To disassemble:
objdump -d any_name.o