Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

291 linhas
11KB

  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>Internal (Untitled Document)</title>
  22. <meta name="description" content="Internal (Untitled Document)">
  23. <meta name="keywords" content="Internal (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="File-Caching.html#File-Caching" rel="next" title="File Caching">
  32. <link href="Opening-and-Closing.html#Opening-and-Closing" rel="prev" title="Opening and Closing">
  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="Internal"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="File-Caching.html#File-Caching" accesskey="n" rel="next">File Caching</a>, Previous: <a href="Opening-and-Closing.html#Opening-and-Closing" accesskey="p" rel="prev">Opening and Closing</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="Implementation-details"></a>
  69. <h3 class="section">2.15 Implementation details</h3>
  70. <a name="Internal-functions"></a>
  71. <h4 class="subsection">2.15.1 Internal functions</h4>
  72. <p><strong>Description</strong><br>
  73. These routines are used within BFD.
  74. They are not intended for export, but are documented here for
  75. completeness.
  76. </p>
  77. <a name="index-bfd_005fwrite_005fbigendian_005f4byte_005fint"></a>
  78. <a name="bfd_005fwrite_005fbigendian_005f4byte_005fint"></a>
  79. <h4 class="subsubsection">2.15.1.1 <code>bfd_write_bigendian_4byte_int</code></h4>
  80. <p><strong>Synopsis</strong>
  81. </p><div class="example">
  82. <pre class="example">bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
  83. </pre></div>
  84. <p><strong>Description</strong><br>
  85. Write a 4 byte integer <var>i</var> to the output BFD <var>abfd</var>, in big
  86. endian order regardless of what else is going on. This is useful in
  87. archives.
  88. </p>
  89. <a name="index-bfd_005fput_005fsize"></a>
  90. <a name="bfd_005fput_005fsize"></a>
  91. <h4 class="subsubsection">2.15.1.2 <code>bfd_put_size</code></h4>
  92. <a name="index-bfd_005fget_005fsize-1"></a>
  93. <a name="bfd_005fget_005fsize-1"></a>
  94. <h4 class="subsubsection">2.15.1.3 <code>bfd_get_size</code></h4>
  95. <p><strong>Description</strong><br>
  96. These macros as used for reading and writing raw data in
  97. sections; each access (except for bytes) is vectored through
  98. the target format of the BFD and mangled accordingly. The
  99. mangling performs any necessary endian translations and
  100. removes alignment restrictions. Note that types accepted and
  101. returned by these macros are identical so they can be swapped
  102. around in macros&mdash;for example, <samp>libaout.h</samp> defines <code>GET_WORD</code>
  103. to either <code>bfd_get_32</code> or <code>bfd_get_64</code>.
  104. </p>
  105. <p>In the put routines, <var>val</var> must be a <code>bfd_vma</code>. If we are on a
  106. system without prototypes, the caller is responsible for making
  107. sure that is true, with a cast if necessary. We don&rsquo;t cast
  108. them in the macro definitions because that would prevent <code>lint</code>
  109. or <code>gcc -Wall</code> from detecting sins such as passing a pointer.
  110. To detect calling these with less than a <code>bfd_vma</code>, use
  111. <code>gcc -Wconversion</code> on a host with 64 bit <code>bfd_vma</code>&rsquo;s.
  112. </p><div class="example">
  113. <pre class="example">
  114. /* Byte swapping macros for user section data. */
  115. #define bfd_put_8(abfd, val, ptr) \
  116. ((void) (*((unsigned char *) (ptr)) = (val) &amp; 0xff))
  117. #define bfd_put_signed_8 \
  118. bfd_put_8
  119. #define bfd_get_8(abfd, ptr) \
  120. ((bfd_vma) *(const unsigned char *) (ptr) &amp; 0xff)
  121. #define bfd_get_signed_8(abfd, ptr) \
  122. ((((bfd_signed_vma) *(const unsigned char *) (ptr) &amp; 0xff) ^ 0x80) - 0x80)
  123. #define bfd_put_16(abfd, val, ptr) \
  124. BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
  125. #define bfd_put_signed_16 \
  126. bfd_put_16
  127. #define bfd_get_16(abfd, ptr) \
  128. BFD_SEND (abfd, bfd_getx16, (ptr))
  129. #define bfd_get_signed_16(abfd, ptr) \
  130. BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
  131. #define bfd_put_24(abfd, val, ptr) \
  132. do \
  133. if (bfd_big_endian (abfd)) \
  134. bfd_putb24 ((val), (ptr)); \
  135. else \
  136. bfd_putl24 ((val), (ptr)); \
  137. while (0)
  138. bfd_vma bfd_getb24 (const void *p);
  139. bfd_vma bfd_getl24 (const void *p);
  140. #define bfd_get_24(abfd, ptr) \
  141. (bfd_big_endian (abfd) ? bfd_getb24 (ptr) : bfd_getl24 (ptr))
  142. #define bfd_put_32(abfd, val, ptr) \
  143. BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
  144. #define bfd_put_signed_32 \
  145. bfd_put_32
  146. #define bfd_get_32(abfd, ptr) \
  147. BFD_SEND (abfd, bfd_getx32, (ptr))
  148. #define bfd_get_signed_32(abfd, ptr) \
  149. BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
  150. #define bfd_put_64(abfd, val, ptr) \
  151. BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
  152. #define bfd_put_signed_64 \
  153. bfd_put_64
  154. #define bfd_get_64(abfd, ptr) \
  155. BFD_SEND (abfd, bfd_getx64, (ptr))
  156. #define bfd_get_signed_64(abfd, ptr) \
  157. BFD_SEND (abfd, bfd_getx_signed_64, (ptr))
  158. #define bfd_get(bits, abfd, ptr) \
  159. ((bits) == 8 ? bfd_get_8 (abfd, ptr) \
  160. : (bits) == 16 ? bfd_get_16 (abfd, ptr) \
  161. : (bits) == 32 ? bfd_get_32 (abfd, ptr) \
  162. : (bits) == 64 ? bfd_get_64 (abfd, ptr) \
  163. : (abort (), (bfd_vma) - 1))
  164. #define bfd_put(bits, abfd, val, ptr) \
  165. ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
  166. : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
  167. : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
  168. : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
  169. : (abort (), (void) 0))
  170. </pre></div>
  171. <a name="index-bfd_005fh_005fput_005fsize"></a>
  172. <a name="bfd_005fh_005fput_005fsize"></a>
  173. <h4 class="subsubsection">2.15.1.4 <code>bfd_h_put_size</code></h4>
  174. <p><strong>Description</strong><br>
  175. These macros have the same function as their <code>bfd_get_x</code>
  176. brethren, except that they are used for removing information
  177. for the header records of object files. Believe it or not,
  178. some object files keep their header records in big endian
  179. order and their data in little endian order.
  180. </p><div class="example">
  181. <pre class="example">
  182. /* Byte swapping macros for file header data. */
  183. #define bfd_h_put_8(abfd, val, ptr) \
  184. bfd_put_8 (abfd, val, ptr)
  185. #define bfd_h_put_signed_8(abfd, val, ptr) \
  186. bfd_put_8 (abfd, val, ptr)
  187. #define bfd_h_get_8(abfd, ptr) \
  188. bfd_get_8 (abfd, ptr)
  189. #define bfd_h_get_signed_8(abfd, ptr) \
  190. bfd_get_signed_8 (abfd, ptr)
  191. #define bfd_h_put_16(abfd, val, ptr) \
  192. BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
  193. #define bfd_h_put_signed_16 \
  194. bfd_h_put_16
  195. #define bfd_h_get_16(abfd, ptr) \
  196. BFD_SEND (abfd, bfd_h_getx16, (ptr))
  197. #define bfd_h_get_signed_16(abfd, ptr) \
  198. BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
  199. #define bfd_h_put_32(abfd, val, ptr) \
  200. BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
  201. #define bfd_h_put_signed_32 \
  202. bfd_h_put_32
  203. #define bfd_h_get_32(abfd, ptr) \
  204. BFD_SEND (abfd, bfd_h_getx32, (ptr))
  205. #define bfd_h_get_signed_32(abfd, ptr) \
  206. BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
  207. #define bfd_h_put_64(abfd, val, ptr) \
  208. BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
  209. #define bfd_h_put_signed_64 \
  210. bfd_h_put_64
  211. #define bfd_h_get_64(abfd, ptr) \
  212. BFD_SEND (abfd, bfd_h_getx64, (ptr))
  213. #define bfd_h_get_signed_64(abfd, ptr) \
  214. BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
  215. /* Aliases for the above, which should eventually go away. */
  216. #define H_PUT_64 bfd_h_put_64
  217. #define H_PUT_32 bfd_h_put_32
  218. #define H_PUT_16 bfd_h_put_16
  219. #define H_PUT_8 bfd_h_put_8
  220. #define H_PUT_S64 bfd_h_put_signed_64
  221. #define H_PUT_S32 bfd_h_put_signed_32
  222. #define H_PUT_S16 bfd_h_put_signed_16
  223. #define H_PUT_S8 bfd_h_put_signed_8
  224. #define H_GET_64 bfd_h_get_64
  225. #define H_GET_32 bfd_h_get_32
  226. #define H_GET_16 bfd_h_get_16
  227. #define H_GET_8 bfd_h_get_8
  228. #define H_GET_S64 bfd_h_get_signed_64
  229. #define H_GET_S32 bfd_h_get_signed_32
  230. #define H_GET_S16 bfd_h_get_signed_16
  231. #define H_GET_S8 bfd_h_get_signed_8
  232. </pre></div>
  233. <a name="index-bfd_005flog2"></a>
  234. <a name="bfd_005flog2"></a>
  235. <h4 class="subsubsection">2.15.1.5 <code>bfd_log2</code></h4>
  236. <p><strong>Synopsis</strong>
  237. </p><div class="example">
  238. <pre class="example">unsigned int bfd_log2 (bfd_vma x);
  239. </pre></div>
  240. <p><strong>Description</strong><br>
  241. Return the log base 2 of the value supplied, rounded up. E.g., an
  242. <var>x</var> of 1025 returns 11. A <var>x</var> of 0 returns 0.
  243. </p>
  244. <hr>
  245. <div class="header">
  246. <p>
  247. Next: <a href="File-Caching.html#File-Caching" accesskey="n" rel="next">File Caching</a>, Previous: <a href="Opening-and-Closing.html#Opening-and-Closing" accesskey="p" rel="prev">Opening and Closing</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>
  248. </div>
  249. </body>
  250. </html>