You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
7.8KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the BFD library.
  4. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3 or
  7. any later version published by the Free Software Foundation; with the
  8. Invariant Sections being "GNU General Public License" and "Funding
  9. Free Software", the Front-Cover texts being (a) (see below), and with
  10. the Back-Cover Texts being (b) (see below). A copy of the license is
  11. included in the section entitled "GNU Free Documentation License".
  12. (a) The FSF's Front-Cover Text is:
  13. A GNU Manual
  14. (b) The FSF's Back-Cover Text is:
  15. You have freedom to copy and modify this GNU Manual, like GNU
  16. software. Copies published by the Free Software Foundation raise
  17. funds for GNU development. -->
  18. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  19. <head>
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  21. <title>Formats (Untitled Document)</title>
  22. <meta name="description" content="Formats (Untitled Document)">
  23. <meta name="keywords" content="Formats (Untitled Document)">
  24. <meta name="resource-type" content="document">
  25. <meta name="distribution" content="global">
  26. <meta name="Generator" content="makeinfo">
  27. <link href="index.html#Top" rel="start" title="Top">
  28. <link href="BFD-Index.html#BFD-Index" rel="index" title="BFD Index">
  29. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  30. <link href="BFD-front-end.html#BFD-front-end" rel="up" title="BFD front end">
  31. <link href="Relocations.html#Relocations" rel="next" title="Relocations">
  32. <link href="Archives.html#Archives" rel="prev" title="Archives">
  33. <style type="text/css">
  34. <!--
  35. a.summary-letter {text-decoration: none}
  36. blockquote.indentedblock {margin-right: 0em}
  37. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  38. blockquote.smallquotation {font-size: smaller}
  39. div.display {margin-left: 3.2em}
  40. div.example {margin-left: 3.2em}
  41. div.lisp {margin-left: 3.2em}
  42. div.smalldisplay {margin-left: 3.2em}
  43. div.smallexample {margin-left: 3.2em}
  44. div.smalllisp {margin-left: 3.2em}
  45. kbd {font-style: oblique}
  46. pre.display {font-family: inherit}
  47. pre.format {font-family: inherit}
  48. pre.menu-comment {font-family: serif}
  49. pre.menu-preformatted {font-family: serif}
  50. pre.smalldisplay {font-family: inherit; font-size: smaller}
  51. pre.smallexample {font-size: smaller}
  52. pre.smallformat {font-family: inherit; font-size: smaller}
  53. pre.smalllisp {font-size: smaller}
  54. span.nolinebreak {white-space: nowrap}
  55. span.roman {font-family: initial; font-weight: normal}
  56. span.sansserif {font-family: sans-serif; font-weight: normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en">
  62. <a name="Formats"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Relocations.html#Relocations" accesskey="n" rel="next">Relocations</a>, Previous: <a href="Archives.html#Archives" accesskey="p" rel="prev">Archives</a>, Up: <a href="BFD-front-end.html#BFD-front-end" accesskey="u" rel="up">BFD front end</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="BFD-Index.html#BFD-Index" title="Index" rel="index">Index</a>]</p>
  66. </div>
  67. <hr>
  68. <a name="File-formats"></a>
  69. <h3 class="section">2.9 File formats</h3>
  70. <p>A format is a BFD concept of high level file contents type. The
  71. formats supported by BFD are:
  72. </p>
  73. <ul>
  74. <li> <code>bfd_object</code>
  75. </li></ul>
  76. <p>The BFD may contain data, symbols, relocations and debug info.
  77. </p>
  78. <ul>
  79. <li> <code>bfd_archive</code>
  80. </li></ul>
  81. <p>The BFD contains other BFDs and an optional index.
  82. </p>
  83. <ul>
  84. <li> <code>bfd_core</code>
  85. </li></ul>
  86. <p>The BFD contains the result of an executable core dump.
  87. </p>
  88. <a name="File-format-functions"></a>
  89. <h4 class="subsection">2.9.1 File format functions</h4>
  90. <a name="index-bfd_005fcheck_005fformat"></a>
  91. <a name="bfd_005fcheck_005fformat"></a>
  92. <h4 class="subsubsection">2.9.1.1 <code>bfd_check_format</code></h4>
  93. <p><strong>Synopsis</strong>
  94. </p><div class="example">
  95. <pre class="example">bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
  96. </pre></div>
  97. <p><strong>Description</strong><br>
  98. Verify if the file attached to the BFD <var>abfd</var> is compatible
  99. with the format <var>format</var> (i.e., one of <code>bfd_object</code>,
  100. <code>bfd_archive</code> or <code>bfd_core</code>).
  101. </p>
  102. <p>If the BFD has been set to a specific target before the
  103. call, only the named target and format combination is
  104. checked. If the target has not been set, or has been set to
  105. <code>default</code>, then all the known target backends is
  106. interrogated to determine a match. If the default target
  107. matches, it is used. If not, exactly one target must recognize
  108. the file, or an error results.
  109. </p>
  110. <p>The function returns <code>TRUE</code> on success, otherwise <code>FALSE</code>
  111. with one of the following error codes:
  112. </p>
  113. <ul>
  114. <li> <code>bfd_error_invalid_operation</code> -
  115. if <code>format</code> is not one of <code>bfd_object</code>, <code>bfd_archive</code> or
  116. <code>bfd_core</code>.
  117. </li><li> <code>bfd_error_system_call</code> -
  118. if an error occured during a read - even some file mismatches
  119. can cause bfd_error_system_calls.
  120. </li><li> <code>file_not_recognised</code> -
  121. none of the backends recognised the file format.
  122. </li><li> <code>bfd_error_file_ambiguously_recognized</code> -
  123. more than one backend recognised the file format.
  124. </li></ul>
  125. <a name="index-bfd_005fcheck_005fformat_005fmatches"></a>
  126. <a name="bfd_005fcheck_005fformat_005fmatches"></a>
  127. <h4 class="subsubsection">2.9.1.2 <code>bfd_check_format_matches</code></h4>
  128. <p><strong>Synopsis</strong>
  129. </p><div class="example">
  130. <pre class="example">bfd_boolean bfd_check_format_matches
  131. (bfd *abfd, bfd_format format, char ***matching);
  132. </pre></div>
  133. <p><strong>Description</strong><br>
  134. Like <code>bfd_check_format</code>, except when it returns FALSE with
  135. <code>bfd_errno</code> set to <code>bfd_error_file_ambiguously_recognized</code>. In that
  136. case, if <var>matching</var> is not NULL, it will be filled in with
  137. a NULL-terminated list of the names of the formats that matched,
  138. allocated with <code>malloc</code>.
  139. Then the user may choose a format and try again.
  140. </p>
  141. <p>When done with the list that <var>matching</var> points to, the caller
  142. should free it.
  143. </p>
  144. <a name="index-bfd_005fset_005fformat"></a>
  145. <a name="bfd_005fset_005fformat"></a>
  146. <h4 class="subsubsection">2.9.1.3 <code>bfd_set_format</code></h4>
  147. <p><strong>Synopsis</strong>
  148. </p><div class="example">
  149. <pre class="example">bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
  150. </pre></div>
  151. <p><strong>Description</strong><br>
  152. This function sets the file format of the BFD <var>abfd</var> to the
  153. format <var>format</var>. If the target set in the BFD does not
  154. support the format requested, the format is invalid, or the BFD
  155. is not open for writing, then an error occurs.
  156. </p>
  157. <a name="index-bfd_005fformat_005fstring"></a>
  158. <a name="bfd_005fformat_005fstring"></a>
  159. <h4 class="subsubsection">2.9.1.4 <code>bfd_format_string</code></h4>
  160. <p><strong>Synopsis</strong>
  161. </p><div class="example">
  162. <pre class="example">const char *bfd_format_string (bfd_format format);
  163. </pre></div>
  164. <p><strong>Description</strong><br>
  165. Return a pointer to a const string
  166. <code>invalid</code>, <code>object</code>, <code>archive</code>, <code>core</code>, or <code>unknown</code>,
  167. depending upon the value of <var>format</var>.
  168. </p>
  169. <hr>
  170. <div class="header">
  171. <p>
  172. Next: <a href="Relocations.html#Relocations" accesskey="n" rel="next">Relocations</a>, Previous: <a href="Archives.html#Archives" accesskey="p" rel="prev">Archives</a>, Up: <a href="BFD-front-end.html#BFD-front-end" accesskey="u" rel="up">BFD front end</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="BFD-Index.html#BFD-Index" title="Index" rel="index">Index</a>]</p>
  173. </div>
  174. </body>
  175. </html>