Hi 孟祥炜,

0 any bugs or errors in my using?

The BFD library supports a large number of different architectures,
but usually programs that use it are configured to only support a
limited subset of these architectures.  Often this is limited to
just the host architecture.  So for example if you were to use the
objdump program on an x86_64 host machine you might see output like
this:

  % objdump --help
  [...]
objdump: supported targets: elf64-x86-64 elf32-i386 elf32-iamcu elf32-x86-64 pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big pe-x86-64 pe-bigobj-x86-64 pe-i386 srec symbolsrec verilog tekhex binary ihex plugin objdump: supported architectures: i386 i386:x86-64 i386:x64-32 i8086 i386:intel i386:x86-64:intel i386:x64-32:intel i386:nacl i386:x86-64:nacl i386:x64-32:nacl iamcu iamcu:intel l1om l1om:intel k1om k1om:intel
  [...]

Note how there are lots of different target formats supported, but
they are all x86 related.  None of them are ARM related.

So in order to support arm64 you either want to use a BFD library
that has been built to run on an arm64 host (and of course run
your program on that arm64 host too), or else you need to build
your own version of the BFD library that has been configured to
support arm64 as well as any other formats that you care about.

To configure and build a BFD library with multiple different target
support you need to obtain the binutils sources and then use a
configure option to choose the targets.  For example:

  <path-to-binutils-sources>/configure --enable-64-bit-bfd 
--enable-targets=aarch64-linux-gnu,x86_64-linux-gnu

If you are not sure which targets you will need to support, you
can configure the library to handle all of them:

  <path-to-binutils-sources>/configure --enable-64-bit-bfd --enable-targets=all

I hope that this helps.

Cheers
  Nick


Reply via email to