This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: About bfd (Binary File Descriptor)
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: libra <mr924352 at cs dot nthu dot edu dot tw>
- Cc: binutils at sources dot redhat dot com
- Date: 15 Apr 2004 11:07:16 -0400
- Subject: Re: About bfd (Binary File Descriptor)
- References: <1082041248.407ea3a01d05a@webmail.cs.nthu.edu.tw>
libra <mr924352@cs.nthu.edu.tw> writes:
> For example, when i compile a c file to an executable file by using gcc,
> i use the arm-elf-objdump(cross compile for target "arm") to dump the
> executable file.Obviously,this will show the error message like "arm-elf-
> objdump: a.exe: File format not recognized".
>
> I try to find where is the program to examine the file format(ex:pei-i386 or
> elf32-littlearm). But, i get nothing.
> I think there must be some place to set the file format information, and to
> check the file format when you wnat to execute this executable file or to dump
> it.
For an ELF file that information is stored in the ELF header which is
the first 52 bytes of the file (for a 32 bit target).
For most ELF files, you can use the 'file' program, or 'readelf -h' to
see the specific type of ELF file.
Note that pei-i386 is not an ELF format.
In many cases you can build the binutils using the configure option
'--enable-targets=all'. You can then use the resulting objdump
program on any file format which BFD recognizes.
Ian