2

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
tommyk
  • 3,187
  • 7
  • 39
  • 61
  • See `objdump -i` - a particular build of objdump understands whatever that particular build of objdump was configured to understand. If you're cross-compiling, that toolchain probably also provides its own suitably-configured objdump binary. – Notlikethat Sep 28 '16 at 11:57
  • 1
    Try `arm-linux-gnueabi-objdump` instead which is in the *binutils-arm-linux-gnueabi* package. I guess you have a shared library for Linux and are using the Ubuntu cross compiler. If not, *crosstool-ng* has objdump with what ever prefix your compiler uses and most people make ARM crosses from this project. More directly, your `objdump` is only understanding PC extensions to ELF. – artless noise Sep 28 '16 at 13:44

1 Answers1

0

You need to use the objdump binary provided by the toolchain of your target system (ARM), not from host system(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

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.

charles
  • 263
  • 5
  • 7