ELF标题,是否重复06h和14h?

时间:2014-03-10 21:33:33

标签: linux assembly executable elf

我想知道这两个标题是否具有相同的含义,也不知道为什么?

来自维基百科:

偏移06h:对于原始版本的ELF,设置为1。

偏移14h:对于原始版本的ELF,设置为1.

参考:http://en.wikipedia.org/wiki/Executable_and_Linkable_Format

1 个答案:

答案 0 :(得分:1)

您可能需要阅读更详细的文档,其中可能包含您要查找的信息:

http://www.skyfree.org/linux/references/ELF_Format.pdf

标题结构

#define EINIDENT   16

typedefstruct{
    unsigned char e_ident[EINIDENT];
    Elf32_Half    e_type;
    Elf32_Half    e_machine;
    Elf32_Word    e_version;
    Elf32_Addr    e_entry;
    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;
} Elf32Ehdr;

第二个e_version,它将版本定义为1(即“当前”)

e_version This member identifies the object file version.
          Name        Value    Meaning
          EV_NONE       0      Invalid version
          EV_CURRENT    1      Current version

          The value 1 signifies the original file format; extensions will
          create new versions with higher numbers. The value of EV_CURRENT,
          though given as 1 above, will change as necessary to reflect the
          current version number.

e_ident部分中的版本也是EV_CURRENT,所以版本完全相同:

EI_VERSION Byte e_ident[EI_VERSION] specifies the ELF header version
           number. Currently, this value must be EV_CURRENT, as
           explained above for e_version.

根据我的理解,我会说该版本尚未改变,因此它在两个地方仍然是1,但未来可能会改变......