2 A format is a BFD concept of high level file contents type. The
3 formats supported by BFD are:
10 The BFD may contain data, symbols, relocations and debug info.
17 The BFD contains other BFDs and an optional index.
24 The BFD contains the result of an executable core dump.
26 @subsection File format functions
29 @findex bfd_check_format
30 @subsubsection @code{bfd_check_format}
33 bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
35 @strong{Description}@*
36 Verify if the file attached to the BFD @var{abfd} is compatible
37 with the format @var{format} (i.e., one of @code{bfd_object},
38 @code{bfd_archive} or @code{bfd_core}).
40 If the BFD has been set to a specific target before the
41 call, only the named target and format combination is
42 checked. If the target has not been set, or has been set to
43 @code{default}, then all the known target backends is
44 interrogated to determine a match. If the default target
45 matches, it is used. If not, exactly one target must recognize
46 the file, or an error results.
48 The function returns @code{TRUE} on success, otherwise @code{FALSE}
49 with one of the following error codes:
54 @code{bfd_error_invalid_operation} -
55 if @code{format} is not one of @code{bfd_object}, @code{bfd_archive} or
59 @code{bfd_error_system_call} -
60 if an error occured during a read - even some file mismatches
61 can cause bfd_error_system_calls.
64 @code{file_not_recognised} -
65 none of the backends recognised the file format.
68 @code{bfd_error_file_ambiguously_recognized} -
69 more than one backend recognised the file format.
72 @findex bfd_check_format_matches
73 @subsubsection @code{bfd_check_format_matches}
76 bfd_boolean bfd_check_format_matches
77 (bfd *abfd, bfd_format format, char ***matching);
79 @strong{Description}@*
80 Like @code{bfd_check_format}, except when it returns FALSE with
81 @code{bfd_errno} set to @code{bfd_error_file_ambiguously_recognized}. In that
82 case, if @var{matching} is not NULL, it will be filled in with
83 a NULL-terminated list of the names of the formats that matched,
84 allocated with @code{malloc}.
85 Then the user may choose a format and try again.
87 When done with the list that @var{matching} points to, the caller
90 @findex bfd_set_format
91 @subsubsection @code{bfd_set_format}
94 bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
96 @strong{Description}@*
97 This function sets the file format of the BFD @var{abfd} to the
98 format @var{format}. If the target set in the BFD does not
99 support the format requested, the format is invalid, or the BFD
100 is not open for writing, then an error occurs.
102 @findex bfd_format_string
103 @subsubsection @code{bfd_format_string}
106 const char *bfd_format_string (bfd_format format);
108 @strong{Description}@*
109 Return a pointer to a const string
110 @code{invalid}, @code{object}, @code{archive}, @code{core}, or @code{unknown},
111 depending upon the value of @var{format}.