简体   繁体   English

确定编译的 ELF 对象是 32 位还是 64 位

[英]Determine if a compiled ELF object is 32-bit or 64-bit

I want to verify if an object has been compiled in 32-bit or 64-bit:我想验证一个对象是用 32 位还是 64 位编译的:

% readelf -h my_obj
ELF Header:
  Magic:   7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, big endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  ...

Since ELF32 is displayed, does this guarantee that the object is in 32-bit mode?既然显示的是ELF32,这能保证对象是32位模式吗?

Fat binaries aren't common or standard for ELF, so the class does reliably indicate 32 vs 64 bit.胖二进制文件对于 ELF 来说并不常见或标准,因此该类确实可以可靠地指示 32 位和 64 位。 But to figure out whether you're looking at 32-bit x86, ARM, MIPS, or whatever, you have to also inspect the Machine field right below the Type field.但是要弄清楚您是在查看 32 位 x86、ARM、MIPS 还是其他任何东西,您还必须检查 Type 字段正下方的 Machine 字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM