File Formats
============

A format is a BFD concept of high level file contents. The formats supported by BFD are:

bfd_object
     The BFD may contain data, symbols, relocations and debug info.

bfd_archive
     The BFD contains other BFDs and an optional index.

bfd_core
     The BFD contains the result of an executable core dump.

bfd_check_format
................

This routine is supplied a BFD and a format. It attempts to verify if the file attached to the BFD is indeed compatible with the format specified (ie, one of bfd_object, bfd_archive or bfd_core).

If the BFD has been set to a specific TARGET before the call, only the named target and format combination will be checked. If the target has not been set, or has been set to default then all the known target backends will be interrogated to determine a match.

The function returns true on success, otherwise false with one of the following error codes:

     invalid_operation if format is not one of bfd_object, bfd_archive or bfd_core.

system_call_error
     if an error occured during a read -  even some file mismatches can cause system_call_errros

file_not_recognised
     none of the backends recognised the file format

file_ambiguously_recognized
     more than one backend recognised the file format.

     boolean bfd_check_format(bfd *abfd, bfd_format format);

bfd_set_format
..............

This function sets the file format of the supplied BFD to the format requested. If the target set in the BFD does not support the format requested, the format is illegal or the BFD is not open for writing than an error occurs.

     boolean bfd_set_format(bfd *, bfd_format);

bfd_format_string
.................

This function takes one argument, and enumerated type (bfd_format) and returns a pointer to a const string "invalid", "object", "archive", "core" or "unknown" depending upon the value of the enumeration.

     CONST char * bfd_format_string(bfd_format);