我没有访问构建命令的权限,只有这个库在我的系统中。
我猜我可以构建一个链接到它的hardfp可执行文件并进行测试,但我想知道是否有更简单的方法。
执行 readelf -A library.so
命令:如果输出的标签列表中包含 Tag_ABI_VFP_args: VFP registers
,则它是一个 hardfp
二进制文件;否则假设它是 softfp
。
例如,readelf -A /lib/arm-linux-gnueabihf/libm.so.6
将产生以下输出:
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-D16
Tag_ABI_PCS_wchar_t: 4
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_ABI_VFP_args: VFP registers
Tag_ABI_optimization_goals: Aggressive Speed
Tag_CPU_unaligned_access: v6
另一方面,readelf -A /lib/arm-linux-gnueabi/libm.so.6
生成:
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-D16
Tag_ABI_PCS_wchar_t: 4
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_optimization_goals: Aggressive Speed
Tag_CPU_unaligned_access: v6
readelf
不支持解析ARM EABI属性。 - Marat Dukhan使用readelf
命令。
以下是Poco ARM版本的示例输出:
$ readelf libPocoFoundation.so -h
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: DYN (Shared object file)
Machine: ARM
Version: 0x1
Entry point address: 0x61e50
Start of program headers: 52 (bytes into file)
Start of section headers: 1078048 (bytes into file)
Flags: 0x5000402, has entry point, Version5 EABI, hard-float ABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 7
Size of section headers: 40 (bytes)
Number of section headers: 28
Section header string table index: 27
Flags: 0x5000202, has entry point, Version5 EABI, soft-float ABI
hardfp
/softfp
标志是最近才加入的,只有最新的工具链支持它们。旧的工具链只在EABI属性部分指示浮点ABI。 - Marat DukhanEF_ARM_ABI_FLOAT_HARD(0x00000400)(ABI版本5及更高版本)
:在可执行文件头中设置(e_type = ET_EXEC或ET_DYN),以表示可执行文件构建时符合硬件浮点过程调用标准。与旧版(版本5之前)gcc兼容,可用作EF_ARM_VFP_FLOAT。 - undefinedobjdump -d
进行反汇编,然后grep一些浮点命令。我不确定objdump是否会生成符合UAL的汇编语言,因此也可以尝试旧语法。观察寄存器名称可能比命令助记符更容易,但可能会有误报。