Re: Problems with bfd: could it parse bin file built on arm64?

2021-09-01 Thread Nick Clifton

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:

  /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:

  /configure --enable-64-bit-bfd --enable-targets=all

I hope that this helps.

Cheers
  Nick




Problems with bfd: could it parse bin file built on arm64?

2021-08-13 Thread 孟祥炜
https://stackoverflow.com/questions/68757706/using-bfd-library-reading-arm64-file-on-x64
here i post the questions. It seems that cannot parse bin file built on
arm64 device(test on arm cloud server and raspi 4b). but there are arm
device declared in bfd.h
so i wonder
0 any bugs or errors in my using?
1 can bfd parse bin file built on arm?
2 or bfd could only parse files built on same platform(such as x86 platform
could parse x86 files but not arm、 arm platform could parse arm files but
not x86)
3 or parse serval architecture file is not bfd's goals. if this, tell me
and i will use other tools

wish some response if possible and hope it could be quick