Objdump 无法识别共享库的架构 [英] Objdump doesn't recognize the architecture of a shared library
问题描述
我在 Ubuntu 14.04 上为 ARM 平台构建了一个共享库.该文件已成功编译和构建.我可以使用 nm 命令检查导出的符号,但是当我检查 .so 文件头时,我得到了架构未知的信息.
这个库是否正确构建,为什么库架构未知?
I built a shared library on Ubuntu 14.04 for ARM platform. The file has compiled and build successfully. I can inspect exported symbols with nm command but when I check .so file header I got the information that architecture is unknown.
Is this library built correctly, why is the library architecture unknown ?
objdump -f libMyLib.so
libMyLib.so: file format elf32-little
architecture: UNKNOWN!, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x000033a0
推荐答案
您需要使用目标系统 (ARM) 的工具链提供的 objdump 二进制文件,而不是主机系统 (x86_64).
You need to use the objdump binary provided by the toolchain of your target system (ARM), not from host system(x86_64).
例如:我已经设置了一个针对 openwrt mips 的主机系统 Linux x86_64,我的工具链文件夹中有一些文件:
As a example: I have setup a host system Linux x86_64 targeting openwrt mips, my toolchain folder has some files:
mips-openwrt-linux-gnu-ar
mips-openwrt-linux-gnu-as
mips-openwrt-linux-gnu-gcc
mips-openwrt-linux-gnu-ld
mips-openwrt-linux-gnu-objdump
mips-openwrt-linux-gnu-nm
这些是openwrt mips系统操作程序的工具,所以我需要调用./mips-openwrt-linux-gnu-objdump -f <bin file>
读取并获得编译文件的正确输出.
These are the tools to manipulate programs for openwrt mips system, so instead of just calling objdump, I need to call ./mips-openwrt-linux-gnu-objdump -f <bin file>
to read and get the proper output for the compiled file.
这篇关于Objdump 无法识别共享库的架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!