What is the difference between ELF files and bin files?

The final images created by the compilers contain the ELF file with the bin file and the extended loader, what is the difference between them, especially the ELF file utility.

+67
arm elf
Mar 11 '10 at 17:01
source share
3 answers

A Bin file is a pure binary file without patches or memory moves, it is more likely that it has explicit instructions for loading to a specific memory address. While....

ELF files are an executable middleware format that consists of characters and a relocatable table, i.e. the kernel address can be loaded into any memory and automatically, all used characters are set to an offset from the memory address to which it was loaded. Usually there are several sections in ELF files, such as "data", "text", "bss", to name just a few ... it is located in those sections where the runtime can calculate where to adjust the memory links of characters dynamically at run time .

+68
Mar 11 '10 at 17:30
source share

The bin file is just the bits and bytes that enter the rum or the specific address from which you will run the program. You can take this data and download it directly, as is, you need to know what the base address is, although this is usually not the case.

An elf file contains information about the bin, but it is surrounded by a host of other information, possible debugging information, symbols, it can distinguish the code from the data in binary format. Allows you to use more than one fragment of binary data (when you upload one of them to the trash, you get one large bin file with fill data to put it in the next block). Tells you how much binary data you have and how much bss data there that wants to be initialized with zeros (gnu has problems creating bin files correctly).

The elf file format is standard, the hand publishes its improvements / options on the standard. I recommend everyone to write an elf analysis program to understand that there, not to worry about the library, it is quite simple to use information and structures in the specification. Helps overcome gnu problems in the overall creation of .bin files, as well as debug linker scripts and other things that can help ruin the output of your bunker or elf.

+24
Mar 15
source share

some resources:

The ELF format is usually the default compilation result. if you use the GNU toolchains, you can convert it to binary using objcopy, for example:

arm-elf-objcopy -O binary [elf-input-file] [binary-output-file] 

or using the fromel utility (built into most IDEs, such as ADS):

  fromelf -bin -o [binary-output-file] [elf-input-file] 
+20
Mar 12 '10 at 7:32
source share



All Articles