Android ndk 验证Android NDK编译库是否编译为正确的体系结构

Android ndk 验证Android NDK编译库是否编译为正确的体系结构,android-ndk,Android Ndk,我有许多使用CMake或Automake构建的库,我想确保它们针对各种体系结构进行了正确编译。具体而言,我希望确保我针对armeabi和armeabi-v7a的库是使用ARM v5或ARM v7-a指令编译的。我发现linux上的readelf提供了一定程度的确定性,即库是使用所需选项编译的,您不需要使用linux,因为该工具位于NDK中。以下示例是使用NDK r13b使用Clang编译的 # -h option instead of -A is helpful if you're inspec

我有许多使用CMake或Automake构建的库,我想确保它们针对各种体系结构进行了正确编译。具体而言,我希望确保我针对armeabi和armeabi-v7a的库是使用ARM v5或ARM v7-a指令编译的。

我发现linux上的
readelf
提供了一定程度的确定性,即库是使用所需选项编译的,您不需要使用linux,因为该工具位于NDK中。以下示例是使用NDK r13b使用Clang编译的

# -h option instead of -A is helpful if you're inspecting x86 binaries
arm-linux-androideabi-readelf -A library.so 
readelf
在NDK工具链中,因此即使您在macOS上,也可以使用它

阿姆亚比 armeabi-v7a
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "5TE"
  Tag_CPU_arch: v5TE
  Tag_ARM_ISA_use: Yes
  Tag_THUMB_ISA_use: Thumb-1
  Tag_FP_arch: VFPv2
  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_enum_size: int
  Tag_ABI_optimization_goals: Aggressive Speed
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "ARM v7"
  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_denormal: Needed
  Tag_ABI_FP_exceptions: Needed
  Tag_ABI_FP_number_model: IEEE 754
  Tag_ABI_align_needed: 8-byte
  Tag_ABI_enum_size: int
  Tag_ABI_HardFP_use: Deprecated
  Tag_ABI_optimization_goals: Aggressive Speed
  Tag_CPU_unaligned_access: v6