Linux文件命令:SYSV意味着什么?

前端之家收集整理的这篇文章主要介绍了Linux文件命令:SYSV意味着什么?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在挖掘两个传统的交叉编译ARM Linux版本.除了“使用此VM映像构建源”之外没有太多文档.文件命令输出之间的唯一区别是存在“(SYSV)”
  1. # file Executable
  2. Executable: ELF 32-bit LSB executable,ARM,version 1 (SYSV) ...

根据字符串中是否存在SYSV,我应该能够假设什么?

解决方法

如果看到(SYSV)字符串,则表示ELF头中的e_ident [EI_OSABI]字段设置为0.从 ELF spec (PDF link)开始:
  1. Table 5. Operating System and ABI Identifiers,e_ident[EI_OSABI]
  2. Name Value Meaning
  3. ELFOSABI_SYSV 0 System V ABI
  4. ELFOSABI_HPUX 1 HP-UX operating system
  5. ELFOSABI_STANDALONE 255 Standalone (embedded) application

我的本地计算机的/usr/share / file / magic / elf文件有一个更长的列表:

  1. # Up to now only 0,1 and 2 are defined; I've seen a file with 0x83,it seemed
  2. # like proper ELF,but extracting the string had bad results.
  3. >4 byte <0x80
  4. >>8 string >\0 (%s)
  5. >8 string \0
  6. >>7 byte 0 (SYSV)
  7. >>7 byte 1 (HP-UX)
  8. >>7 byte 2 (NetBSD)
  9. >>7 byte 3 (GNU/Linux)
  10. >>7 byte 4 (GNU/Hurd)
  11. >>7 byte 5 (86Open)
  12. >>7 byte 6 (Solaris)
  13. >>7 byte 7 (Monterey)
  14. >>7 byte 8 (IRIX)
  15. >>7 byte 9 (FreeBSD)
  16. >>7 byte 10 (Tru64)
  17. >>7 byte 11 (Novell Modesto)
  18. >>7 byte 12 (OpenBSD)
  19. >8 string \2
  20. >>7 byte 13 (OpenVMS)
  21. >>7 byte 97 (ARM)
  22. >>7 byte 255 (embedded)

以下是您参考的ELF标题和偏移量(从this link开始):

  1. #define EI_NIDENT 16
  2.  
  3. typedef struct {
  4. unsigned char e_ident[EI_NIDENT];
  5. Elf32_Half e_type;
  6. Elf32_Half e_machine;
  7. Elf32_Word e_version;
  8. Elf32_Addr e_entry;
  9. Elf32_Off e_phoff;
  10. Elf32_Off e_shoff;
  11. Elf32_Word e_flags;
  12. Elf32_Half e_ehsize;
  13. Elf32_Half e_phentsize;
  14. Elf32_Half e_phnum;
  15. Elf32_Half e_shentsize;
  16. Elf32_Half e_shnum;
  17. Elf32_Half e_shstrndx;
  18. } Elf32_Ehdr;
  19.  
  20.  
  21. Figure 4-4: e_ident[] Identification Indexes
  22. Name Value Purpose
  23. EI_MAG0 0 File identification
  24. EI_MAG1 1 File identification
  25. EI_MAG2 2 File identification
  26. EI_MAG3 3 File identification
  27. EI_CLASS 4 File class
  28. EI_DATA 5 Data encoding
  29. EI_VERSION 6 File version
  30. EI_OSABI 7 Operating system/ABI identification
  31. EI_ABIVERSION 8 ABI version
  32. EI_PAD 9 Start of padding bytes
  33. EI_NIDENT 16 Size of e_ident[]

猜你在找的Linux相关文章