Linux file Command view elf files information __linux

Source: Internet
Author: User

Using the file command to view the dynamic link library, you get the following results:

#/usr/libx32$ file. /lib32/libgomp.so.1.0.0
.. /lib32/libgomp.so.1.0.0: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), Dynamically link Ed, buildid[sha1]=57ec5c404cd4f781ac341332437a6960784e4581, stripped.
#:/usr/libx32$ file. /libx32/libgcc_s.so.1
.. /libx32/libgcc_s.so.1: ELF 32-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, Bui LDID[SHA1]=4713F15844E2B3E13F741BD5ACEF9AAAB24CFF03, stripped

One of the more confusing parts of the scarlet Letter which made me

Elf 32-bit says the elf file is elf32, Elf64-bit says the elf file is elf64

typedef struct ELF32_HDR {unsigned char e_ident[ei_nident];
    Elf32_half E_type;
    Elf32_half E_machine;
    Elf32_word e_version; Elf32_addr E_entry;
    /* Entry Point * * Elf32_off E_phoff;
    Elf32_off E_shoff;
    Elf32_word E_flags;
    Elf32_half e_ehsize;
    Elf32_half e_phentsize;
    Elf32_half E_phnum;
    Elf32_half e_shentsize;
    Elf32_half E_shnum;
Elf32_half E_shstrndx;

} ELF32_EHDR;  typedef struct ELF64_HDR {unsigned char e_ident[16];
    /* ELF "magic number" * * elf64_half E_type;
    Elf64_half E_machine;
    Elf64_word e_version; Elf64_addr E_entry;  * Entry Point Virtual Address * * * Elf64_off E_phoff;  /* Program Header Table file offset */Elf64_off E_shoff;
    /* Section Header Table file offset */Elf64_word e_flags;
    Elf64_half e_ehsize;
    Elf64_half e_phentsize;
    Elf64_half E_phnum;
    Elf64_half e_shentsize;
    Elf64_half E_shnum;
Elf64_half E_shstrndx;
} ELF64_EHDR; 

For ELF32 and ELF64 headers, the first 16 bytes of the two are magic, magic the fifth byte defines the format of the elf file.


Intel 80386 and x86-64 define the type of target machine, which is the instruction set of the target machine.



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.