Determine target ISA extensions of binary file in Linux (library or executable)

后端 未结 6 1188
太阳男子
太阳男子 2020-12-23 11:35

We have an issue related to a Java application running under a (rather old) FC3 on an Advantech POS board with a Via C3 processor. The java application has several compiled

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-23 11:41

    I decide to add one more solution for any, who got here: personally in my case the information provided by the file and objdump wasn't enough, and the grep isn't much of a help -- I resolve my case through the readelf -a -W.

    Note, that this gives you pretty much info. The arch related information resides in the very beginning and the very end. Here's an example:

    ELF Header:
      Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
      Class:                             ELF32
      Data:                              2's complement, little endian
      Version:                           1 (current)
      OS/ABI:                            UNIX - System V
      ABI Version:                       0
      Type:                              EXEC (Executable file)
      Machine:                           ARM
      Version:                           0x1
      Entry point address:               0x83f8
      Start of program headers:          52 (bytes into file)
      Start of section headers:          2388 (bytes into file)
      Flags:                             0x5000202, has entry point, Version5 EABI, soft-float ABI
      Size of this header:               52 (bytes)
      Size of program headers:           32 (bytes)
      Number of program headers:         8
      Size of section headers:           40 (bytes)
      Number of section headers:         31
      Section header string table index: 28
    ...
    Displaying notes found at file offset 0x00000148 with length 0x00000020:
      Owner                 Data size   Description
      GNU                  0x00000010   NT_GNU_ABI_TAG (ABI version tag)
        OS: Linux, ABI: 2.6.16
    Attribute Section: aeabi
    File Attributes
      Tag_CPU_name: "7-A"
      Tag_CPU_arch: v7
      Tag_CPU_arch_profile: Application
      Tag_ARM_ISA_use: Yes
      Tag_THUMB_ISA_use: Thumb-2
      Tag_FP_arch: VFPv3
      Tag_Advanced_SIMD_arch: NEONv1
      Tag_ABI_PCS_wchar_t: 4
      Tag_ABI_FP_rounding: Needed
      Tag_ABI_FP_denormal: Needed
      Tag_ABI_FP_exceptions: Needed
      Tag_ABI_FP_number_model: IEEE 754
      Tag_ABI_align_needed: 8-byte
      Tag_ABI_align_preserved: 8-byte, except leaf SP
      Tag_ABI_enum_size: int
      Tag_ABI_HardFP_use: SP and DP
      Tag_CPU_unaligned_access: v6
    

提交回复
热议问题