Analysis of ELF magic number in Linux

Source: Internet
Author: User


ELF magic number parsing in Linux: in Linux, we can usually use the readelf command to view ELF File Information. For example, the www.2cto.com ELF file contains 32-bit and 64-bit versions. The structure information of the 32-bit version is as follows: The above structure basically corresponds to the elf information of the output kill0 file, the difference is that e_ident in Elf32_Ehdr corresponds to "Class", "Data", "Version", "OS/ABI", "ABI Version" in readelf output ". The ELF magic number we want to talk about is the number of the draw line in the first figure. The first four bytes are all ELF files must have the same identifier, 0x7F, 0x45, 0x4c, 0x46, respectively. The first byte corresponds to the DEL control character in the ASCII characters, the next three bytes are exactly the elf ascii code. These four bytes are called the magic number of ELF. The first few bytes of almost all executable file formats are magic numbers. This magic number is used to confirm the file type. The operating system will confirm whether the magic number is correct when loading executable files.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.