I may not be asking this in the correct place, but is there somewhere I can research what the structure of an executable binary files is? As in, how the code is organized, where the symbols are stored, etc.
-
8What kind of binary file? Do you mean an executable file? For which platform(s)?Greg Hewgill– Greg Hewgill2012-02-26 18:25:05 +00:00Commented Feb 26, 2012 at 18:25
-
1I think you need to specify a bit more what kind of binary file you're looking for. I'm guessing an executable, but what format? ELF? DWARF? a.out?Joachim Isaksson– Joachim Isaksson2012-02-26 18:25:41 +00:00Commented Feb 26, 2012 at 18:25
-
Yes, I'm talking executable. I actually didn't know what the different formats were, but judging by one of the answers I'm mostly looking for ELF and Mach-O.Jumhyn– Jumhyn2012-02-26 18:34:06 +00:00Commented Feb 26, 2012 at 18:34
4 Answers
Depends on what platform you're interested in!
Windows uses the PE binary format.
Linux uses ELF.
Mac OS (and iOS) use Mach-O.
Some older UNIX systems use a.out.
1 Comment
readelf output on Linux ELF executables, including some about the x86-64 machine code in the .text section.The structure of a binary file is defined by the application which created it. For example the code you write in Java or C and write it into a file, can be only read back by a code which knows the structure of how it was written.
In the case of executable files, there are different kinds which varies depending on operating systems. For example to check the structure of the Executable and Linking Format (ELF) files see man elf : http://www.kernel.org/doc/man-pages/online/pages/man5/elf.5.html
Comments
You need to understand what an ELF file is! Here is your starting point.
And this article neatly explains how to dissect ELF files using readelf and objdump
Comments
This article does a really easy to follow overview of executable binaries.