Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

696 lines
29KB

  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>Miscellaneous (Untitled Document)</title>
  22. <meta name="description" content="Miscellaneous (Untitled Document)">
  23. <meta name="keywords" content="Miscellaneous (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="Memory-Usage.html#Memory-Usage" rel="next" title="Memory Usage">
  32. <link href="Error-reporting.html#Error-reporting" rel="prev" title="Error reporting">
  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="Miscellaneous"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Memory-Usage.html#Memory-Usage" accesskey="n" rel="next">Memory Usage</a>, Previous: <a href="Error-reporting.html#Error-reporting" accesskey="p" rel="prev">Error reporting</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="Miscellaneous-1"></a>
  69. <h3 class="section">2.3 Miscellaneous</h3>
  70. <a name="Miscellaneous-functions"></a>
  71. <h4 class="subsection">2.3.1 Miscellaneous functions</h4>
  72. <a name="index-bfd_005fget_005freloc_005fupper_005fbound"></a>
  73. <a name="bfd_005fget_005freloc_005fupper_005fbound"></a>
  74. <h4 class="subsubsection">2.3.1.1 <code>bfd_get_reloc_upper_bound</code></h4>
  75. <p><strong>Synopsis</strong>
  76. </p><div class="example">
  77. <pre class="example">long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
  78. </pre></div>
  79. <p><strong>Description</strong><br>
  80. Return the number of bytes required to store the
  81. relocation information associated with section <var>sect</var>
  82. attached to bfd <var>abfd</var>. If an error occurs, return -1.
  83. </p>
  84. <a name="index-bfd_005fcanonicalize_005freloc"></a>
  85. <a name="bfd_005fcanonicalize_005freloc"></a>
  86. <h4 class="subsubsection">2.3.1.2 <code>bfd_canonicalize_reloc</code></h4>
  87. <p><strong>Synopsis</strong>
  88. </p><div class="example">
  89. <pre class="example">long bfd_canonicalize_reloc
  90. (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
  91. </pre></div>
  92. <p><strong>Description</strong><br>
  93. Call the back end associated with the open BFD
  94. <var>abfd</var> and translate the external form of the relocation
  95. information attached to <var>sec</var> into the internal canonical
  96. form. Place the table into memory at <var>loc</var>, which has
  97. been preallocated, usually by a call to
  98. <code>bfd_get_reloc_upper_bound</code>. Returns the number of relocs, or
  99. -1 on error.
  100. </p>
  101. <p>The <var>syms</var> table is also needed for horrible internal magic
  102. reasons.
  103. </p>
  104. <a name="index-bfd_005fset_005freloc"></a>
  105. <a name="bfd_005fset_005freloc"></a>
  106. <h4 class="subsubsection">2.3.1.3 <code>bfd_set_reloc</code></h4>
  107. <p><strong>Synopsis</strong>
  108. </p><div class="example">
  109. <pre class="example">void bfd_set_reloc
  110. (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
  111. </pre></div>
  112. <p><strong>Description</strong><br>
  113. Set the relocation pointer and count within
  114. section <var>sec</var> to the values <var>rel</var> and <var>count</var>.
  115. The argument <var>abfd</var> is ignored.
  116. </p><div class="example">
  117. <pre class="example">#define bfd_set_reloc(abfd, asect, location, count) \
  118. BFD_SEND (abfd, _bfd_set_reloc, (abfd, asect, location, count))
  119. </pre></div>
  120. <a name="index-bfd_005fset_005ffile_005fflags"></a>
  121. <a name="bfd_005fset_005ffile_005fflags"></a>
  122. <h4 class="subsubsection">2.3.1.4 <code>bfd_set_file_flags</code></h4>
  123. <p><strong>Synopsis</strong>
  124. </p><div class="example">
  125. <pre class="example">bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
  126. </pre></div>
  127. <p><strong>Description</strong><br>
  128. Set the flag word in the BFD <var>abfd</var> to the value <var>flags</var>.
  129. </p>
  130. <p>Possible errors are:
  131. </p><ul>
  132. <li> <code>bfd_error_wrong_format</code> - The target bfd was not of object format.
  133. </li><li> <code>bfd_error_invalid_operation</code> - The target bfd was open for reading.
  134. </li><li> <code>bfd_error_invalid_operation</code> -
  135. The flag word contained a bit which was not applicable to the
  136. type of file. E.g., an attempt was made to set the <code>D_PAGED</code> bit
  137. on a BFD format which does not support demand paging.
  138. </li></ul>
  139. <a name="index-bfd_005fget_005farch_005fsize"></a>
  140. <a name="bfd_005fget_005farch_005fsize"></a>
  141. <h4 class="subsubsection">2.3.1.5 <code>bfd_get_arch_size</code></h4>
  142. <p><strong>Synopsis</strong>
  143. </p><div class="example">
  144. <pre class="example">int bfd_get_arch_size (bfd *abfd);
  145. </pre></div>
  146. <p><strong>Description</strong><br>
  147. Returns the normalized architecture address size, in bits, as
  148. determined by the object file&rsquo;s format. By normalized, we mean
  149. either 32 or 64. For ELF, this information is included in the
  150. header. Use bfd_arch_bits_per_address for number of bits in
  151. the architecture address.
  152. </p>
  153. <p><strong>Returns</strong><br>
  154. Returns the arch size in bits if known, <code>-1</code> otherwise.
  155. </p>
  156. <a name="index-bfd_005fget_005fsign_005fextend_005fvma"></a>
  157. <a name="bfd_005fget_005fsign_005fextend_005fvma"></a>
  158. <h4 class="subsubsection">2.3.1.6 <code>bfd_get_sign_extend_vma</code></h4>
  159. <p><strong>Synopsis</strong>
  160. </p><div class="example">
  161. <pre class="example">int bfd_get_sign_extend_vma (bfd *abfd);
  162. </pre></div>
  163. <p><strong>Description</strong><br>
  164. Indicates if the target architecture &quot;naturally&quot; sign extends
  165. an address. Some architectures implicitly sign extend address
  166. values when they are converted to types larger than the size
  167. of an address. For instance, bfd_get_start_address() will
  168. return an address sign extended to fill a bfd_vma when this is
  169. the case.
  170. </p>
  171. <p><strong>Returns</strong><br>
  172. Returns <code>1</code> if the target architecture is known to sign
  173. extend addresses, <code>0</code> if the target architecture is known to
  174. not sign extend addresses, and <code>-1</code> otherwise.
  175. </p>
  176. <a name="index-bfd_005fset_005fstart_005faddress"></a>
  177. <a name="bfd_005fset_005fstart_005faddress"></a>
  178. <h4 class="subsubsection">2.3.1.7 <code>bfd_set_start_address</code></h4>
  179. <p><strong>Synopsis</strong>
  180. </p><div class="example">
  181. <pre class="example">bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
  182. </pre></div>
  183. <p><strong>Description</strong><br>
  184. Make <var>vma</var> the entry point of output BFD <var>abfd</var>.
  185. </p>
  186. <p><strong>Returns</strong><br>
  187. Returns <code>TRUE</code> on success, <code>FALSE</code> otherwise.
  188. </p>
  189. <a name="index-bfd_005fget_005fgp_005fsize"></a>
  190. <a name="bfd_005fget_005fgp_005fsize"></a>
  191. <h4 class="subsubsection">2.3.1.8 <code>bfd_get_gp_size</code></h4>
  192. <p><strong>Synopsis</strong>
  193. </p><div class="example">
  194. <pre class="example">unsigned int bfd_get_gp_size (bfd *abfd);
  195. </pre></div>
  196. <p><strong>Description</strong><br>
  197. Return the maximum size of objects to be optimized using the GP
  198. register under MIPS ECOFF. This is typically set by the <code>-G</code>
  199. argument to the compiler, assembler or linker.
  200. </p>
  201. <a name="index-bfd_005fset_005fgp_005fsize"></a>
  202. <a name="bfd_005fset_005fgp_005fsize"></a>
  203. <h4 class="subsubsection">2.3.1.9 <code>bfd_set_gp_size</code></h4>
  204. <p><strong>Synopsis</strong>
  205. </p><div class="example">
  206. <pre class="example">void bfd_set_gp_size (bfd *abfd, unsigned int i);
  207. </pre></div>
  208. <p><strong>Description</strong><br>
  209. Set the maximum size of objects to be optimized using the GP
  210. register under ECOFF or MIPS ELF. This is typically set by
  211. the <code>-G</code> argument to the compiler, assembler or linker.
  212. </p>
  213. <a name="index-bfd_005fscan_005fvma"></a>
  214. <a name="bfd_005fscan_005fvma"></a>
  215. <h4 class="subsubsection">2.3.1.10 <code>bfd_scan_vma</code></h4>
  216. <p><strong>Synopsis</strong>
  217. </p><div class="example">
  218. <pre class="example">bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
  219. </pre></div>
  220. <p><strong>Description</strong><br>
  221. Convert, like <code>strtoul</code>, a numerical expression
  222. <var>string</var> into a <code>bfd_vma</code> integer, and return that integer.
  223. (Though without as many bells and whistles as <code>strtoul</code>.)
  224. The expression is assumed to be unsigned (i.e., positive).
  225. If given a <var>base</var>, it is used as the base for conversion.
  226. A base of 0 causes the function to interpret the string
  227. in hex if a leading &quot;0x&quot; or &quot;0X&quot; is found, otherwise
  228. in octal if a leading zero is found, otherwise in decimal.
  229. </p>
  230. <p>If the value would overflow, the maximum <code>bfd_vma</code> value is
  231. returned.
  232. </p>
  233. <a name="index-bfd_005fcopy_005fprivate_005fheader_005fdata"></a>
  234. <a name="bfd_005fcopy_005fprivate_005fheader_005fdata"></a>
  235. <h4 class="subsubsection">2.3.1.11 <code>bfd_copy_private_header_data</code></h4>
  236. <p><strong>Synopsis</strong>
  237. </p><div class="example">
  238. <pre class="example">bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
  239. </pre></div>
  240. <p><strong>Description</strong><br>
  241. Copy private BFD header information from the BFD <var>ibfd</var> to the
  242. the BFD <var>obfd</var>. This copies information that may require
  243. sections to exist, but does not require symbol tables. Return
  244. <code>true</code> on success, <code>false</code> on error.
  245. Possible error returns are:
  246. </p>
  247. <ul>
  248. <li> <code>bfd_error_no_memory</code> -
  249. Not enough memory exists to create private data for <var>obfd</var>.
  250. </li></ul>
  251. <div class="example">
  252. <pre class="example">#define bfd_copy_private_header_data(ibfd, obfd) \
  253. BFD_SEND (obfd, _bfd_copy_private_header_data, \
  254. (ibfd, obfd))
  255. </pre></div>
  256. <a name="index-bfd_005fcopy_005fprivate_005fbfd_005fdata"></a>
  257. <a name="bfd_005fcopy_005fprivate_005fbfd_005fdata"></a>
  258. <h4 class="subsubsection">2.3.1.12 <code>bfd_copy_private_bfd_data</code></h4>
  259. <p><strong>Synopsis</strong>
  260. </p><div class="example">
  261. <pre class="example">bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
  262. </pre></div>
  263. <p><strong>Description</strong><br>
  264. Copy private BFD information from the BFD <var>ibfd</var> to the
  265. the BFD <var>obfd</var>. Return <code>TRUE</code> on success, <code>FALSE</code> on error.
  266. Possible error returns are:
  267. </p>
  268. <ul>
  269. <li> <code>bfd_error_no_memory</code> -
  270. Not enough memory exists to create private data for <var>obfd</var>.
  271. </li></ul>
  272. <div class="example">
  273. <pre class="example">#define bfd_copy_private_bfd_data(ibfd, obfd) \
  274. BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
  275. (ibfd, obfd))
  276. </pre></div>
  277. <a name="index-bfd_005fset_005fprivate_005fflags"></a>
  278. <a name="bfd_005fset_005fprivate_005fflags"></a>
  279. <h4 class="subsubsection">2.3.1.13 <code>bfd_set_private_flags</code></h4>
  280. <p><strong>Synopsis</strong>
  281. </p><div class="example">
  282. <pre class="example">bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
  283. </pre></div>
  284. <p><strong>Description</strong><br>
  285. Set private BFD flag information in the BFD <var>abfd</var>.
  286. Return <code>TRUE</code> on success, <code>FALSE</code> on error. Possible error
  287. returns are:
  288. </p>
  289. <ul>
  290. <li> <code>bfd_error_no_memory</code> -
  291. Not enough memory exists to create private data for <var>obfd</var>.
  292. </li></ul>
  293. <div class="example">
  294. <pre class="example">#define bfd_set_private_flags(abfd, flags) \
  295. BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
  296. </pre></div>
  297. <a name="index-Other-functions"></a>
  298. <a name="Other-functions"></a>
  299. <h4 class="subsubsection">2.3.1.14 <code>Other functions</code></h4>
  300. <p><strong>Description</strong><br>
  301. The following functions exist but have not yet been documented.
  302. </p><div class="example">
  303. <pre class="example">#define bfd_sizeof_headers(abfd, info) \
  304. BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info))
  305. #define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
  306. BFD_SEND (abfd, _bfd_find_nearest_line, \
  307. (abfd, syms, sec, off, file, func, line, NULL))
  308. #define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \
  309. line, disc) \
  310. BFD_SEND (abfd, _bfd_find_nearest_line, \
  311. (abfd, syms, sec, off, file, func, line, disc))
  312. #define bfd_find_line(abfd, syms, sym, file, line) \
  313. BFD_SEND (abfd, _bfd_find_line, \
  314. (abfd, syms, sym, file, line))
  315. #define bfd_find_inliner_info(abfd, file, func, line) \
  316. BFD_SEND (abfd, _bfd_find_inliner_info, \
  317. (abfd, file, func, line))
  318. #define bfd_debug_info_start(abfd) \
  319. BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
  320. #define bfd_debug_info_end(abfd) \
  321. BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
  322. #define bfd_debug_info_accumulate(abfd, section) \
  323. BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
  324. #define bfd_stat_arch_elt(abfd, stat) \
  325. BFD_SEND (abfd-&gt;my_archive ? abfd-&gt;my_archive : abfd, \
  326. _bfd_stat_arch_elt, (abfd, stat))
  327. #define bfd_update_armap_timestamp(abfd) \
  328. BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
  329. #define bfd_set_arch_mach(abfd, arch, mach)\
  330. BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
  331. #define bfd_relax_section(abfd, section, link_info, again) \
  332. BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
  333. #define bfd_gc_sections(abfd, link_info) \
  334. BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
  335. #define bfd_lookup_section_flags(link_info, flag_info, section) \
  336. BFD_SEND (abfd, _bfd_lookup_section_flags, (link_info, flag_info, section))
  337. #define bfd_merge_sections(abfd, link_info) \
  338. BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
  339. #define bfd_is_group_section(abfd, sec) \
  340. BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec))
  341. #define bfd_group_name(abfd, sec) \
  342. BFD_SEND (abfd, _bfd_group_name, (abfd, sec))
  343. #define bfd_discard_group(abfd, sec) \
  344. BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
  345. #define bfd_link_hash_table_create(abfd) \
  346. BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
  347. #define bfd_link_add_symbols(abfd, info) \
  348. BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
  349. #define bfd_link_just_syms(abfd, sec, info) \
  350. BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
  351. #define bfd_final_link(abfd, info) \
  352. BFD_SEND (abfd, _bfd_final_link, (abfd, info))
  353. #define bfd_free_cached_info(abfd) \
  354. BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
  355. #define bfd_get_dynamic_symtab_upper_bound(abfd) \
  356. BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
  357. #define bfd_print_private_bfd_data(abfd, file)\
  358. BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
  359. #define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
  360. BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
  361. #define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \
  362. BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \
  363. dyncount, dynsyms, ret))
  364. #define bfd_get_dynamic_reloc_upper_bound(abfd) \
  365. BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
  366. #define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
  367. BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
  368. extern bfd_byte *bfd_get_relocated_section_contents
  369. (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
  370. bfd_boolean, asymbol **);
  371. </pre></div>
  372. <a name="index-bfd_005falt_005fmach_005fcode"></a>
  373. <a name="bfd_005falt_005fmach_005fcode"></a>
  374. <h4 class="subsubsection">2.3.1.15 <code>bfd_alt_mach_code</code></h4>
  375. <p><strong>Synopsis</strong>
  376. </p><div class="example">
  377. <pre class="example">bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
  378. </pre></div>
  379. <p><strong>Description</strong><br>
  380. When more than one machine code number is available for the
  381. same machine type, this function can be used to switch between
  382. the preferred one (alternative == 0) and any others. Currently,
  383. only ELF supports this feature, with up to two alternate
  384. machine codes.
  385. </p>
  386. <a name="index-bfd_005femul_005fget_005fmaxpagesize"></a>
  387. <a name="bfd_005femul_005fget_005fmaxpagesize"></a>
  388. <h4 class="subsubsection">2.3.1.16 <code>bfd_emul_get_maxpagesize</code></h4>
  389. <p><strong>Synopsis</strong>
  390. </p><div class="example">
  391. <pre class="example">bfd_vma bfd_emul_get_maxpagesize (const char *);
  392. </pre></div>
  393. <p><strong>Description</strong><br>
  394. Returns the maximum page size, in bytes, as determined by
  395. emulation.
  396. </p>
  397. <p><strong>Returns</strong><br>
  398. Returns the maximum page size in bytes for ELF, 0 otherwise.
  399. </p>
  400. <a name="index-bfd_005femul_005fset_005fmaxpagesize"></a>
  401. <a name="bfd_005femul_005fset_005fmaxpagesize"></a>
  402. <h4 class="subsubsection">2.3.1.17 <code>bfd_emul_set_maxpagesize</code></h4>
  403. <p><strong>Synopsis</strong>
  404. </p><div class="example">
  405. <pre class="example">void bfd_emul_set_maxpagesize (const char *, bfd_vma);
  406. </pre></div>
  407. <p><strong>Description</strong><br>
  408. For ELF, set the maximum page size for the emulation. It is
  409. a no-op for other formats.
  410. </p>
  411. <a name="index-bfd_005femul_005fget_005fcommonpagesize"></a>
  412. <a name="bfd_005femul_005fget_005fcommonpagesize"></a>
  413. <h4 class="subsubsection">2.3.1.18 <code>bfd_emul_get_commonpagesize</code></h4>
  414. <p><strong>Synopsis</strong>
  415. </p><div class="example">
  416. <pre class="example">bfd_vma bfd_emul_get_commonpagesize (const char *, bfd_boolean);
  417. </pre></div>
  418. <p><strong>Description</strong><br>
  419. Returns the common page size, in bytes, as determined by
  420. emulation.
  421. </p>
  422. <p><strong>Returns</strong><br>
  423. Returns the common page size in bytes for ELF, 0 otherwise.
  424. </p>
  425. <a name="index-bfd_005femul_005fset_005fcommonpagesize"></a>
  426. <a name="bfd_005femul_005fset_005fcommonpagesize"></a>
  427. <h4 class="subsubsection">2.3.1.19 <code>bfd_emul_set_commonpagesize</code></h4>
  428. <p><strong>Synopsis</strong>
  429. </p><div class="example">
  430. <pre class="example">void bfd_emul_set_commonpagesize (const char *, bfd_vma);
  431. </pre></div>
  432. <p><strong>Description</strong><br>
  433. For ELF, set the common page size for the emulation. It is
  434. a no-op for other formats.
  435. </p>
  436. <a name="index-bfd_005fdemangle"></a>
  437. <a name="bfd_005fdemangle"></a>
  438. <h4 class="subsubsection">2.3.1.20 <code>bfd_demangle</code></h4>
  439. <p><strong>Synopsis</strong>
  440. </p><div class="example">
  441. <pre class="example">char *bfd_demangle (bfd *, const char *, int);
  442. </pre></div>
  443. <p><strong>Description</strong><br>
  444. Wrapper around cplus_demangle. Strips leading underscores and
  445. other such chars that would otherwise confuse the demangler.
  446. If passed a g++ v3 ABI mangled name, returns a buffer allocated
  447. with malloc holding the demangled name. Returns NULL otherwise
  448. and on memory alloc failure.
  449. </p>
  450. <a name="index-bfd_005fupdate_005fcompression_005fheader"></a>
  451. <a name="bfd_005fupdate_005fcompression_005fheader"></a>
  452. <h4 class="subsubsection">2.3.1.21 <code>bfd_update_compression_header</code></h4>
  453. <p><strong>Synopsis</strong>
  454. </p><div class="example">
  455. <pre class="example">void bfd_update_compression_header
  456. (bfd *abfd, bfd_byte *contents, asection *sec);
  457. </pre></div>
  458. <p><strong>Description</strong><br>
  459. Set the compression header at CONTENTS of SEC in ABFD and update
  460. elf_section_flags for compression.
  461. </p>
  462. <a name="index-bfd_005fcheck_005fcompression_005fheader"></a>
  463. <a name="bfd_005fcheck_005fcompression_005fheader"></a>
  464. <h4 class="subsubsection">2.3.1.22 <code>bfd_check_compression_header</code></h4>
  465. <p><strong>Synopsis</strong>
  466. </p><div class="example">
  467. <pre class="example">bfd_boolean bfd_check_compression_header
  468. (bfd *abfd, bfd_byte *contents, asection *sec,
  469. bfd_size_type *uncompressed_size,
  470. unsigned int *uncompressed_alignment_power);
  471. </pre></div>
  472. <p><strong>Description</strong><br>
  473. Check the compression header at CONTENTS of SEC in ABFD and
  474. store the uncompressed size in UNCOMPRESSED_SIZE and the
  475. uncompressed data alignment in UNCOMPRESSED_ALIGNMENT_POWER
  476. if the compression header is valid.
  477. </p>
  478. <p><strong>Returns</strong><br>
  479. Return TRUE if the compression header is valid.
  480. </p>
  481. <a name="index-bfd_005fget_005fcompression_005fheader_005fsize"></a>
  482. <a name="bfd_005fget_005fcompression_005fheader_005fsize"></a>
  483. <h4 class="subsubsection">2.3.1.23 <code>bfd_get_compression_header_size</code></h4>
  484. <p><strong>Synopsis</strong>
  485. </p><div class="example">
  486. <pre class="example">int bfd_get_compression_header_size (bfd *abfd, asection *sec);
  487. </pre></div>
  488. <p><strong>Description</strong><br>
  489. Return the size of the compression header of SEC in ABFD.
  490. </p>
  491. <p><strong>Returns</strong><br>
  492. Return the size of the compression header in bytes.
  493. </p>
  494. <a name="index-bfd_005fconvert_005fsection_005fsize"></a>
  495. <a name="bfd_005fconvert_005fsection_005fsize"></a>
  496. <h4 class="subsubsection">2.3.1.24 <code>bfd_convert_section_size</code></h4>
  497. <p><strong>Synopsis</strong>
  498. </p><div class="example">
  499. <pre class="example">bfd_size_type bfd_convert_section_size
  500. (bfd *ibfd, asection *isec, bfd *obfd, bfd_size_type size);
  501. </pre></div>
  502. <p><strong>Description</strong><br>
  503. Convert the size <var>size</var> of the section <var>isec</var> in input
  504. BFD <var>ibfd</var> to the section size in output BFD <var>obfd</var>.
  505. </p>
  506. <a name="index-bfd_005fconvert_005fsection_005fcontents"></a>
  507. <a name="bfd_005fconvert_005fsection_005fcontents"></a>
  508. <h4 class="subsubsection">2.3.1.25 <code>bfd_convert_section_contents</code></h4>
  509. <p><strong>Synopsis</strong>
  510. </p><div class="example">
  511. <pre class="example">bfd_boolean bfd_convert_section_contents
  512. (bfd *ibfd, asection *isec, bfd *obfd,
  513. bfd_byte **ptr, bfd_size_type *ptr_size);
  514. </pre></div>
  515. <p><strong>Description</strong><br>
  516. Convert the contents, stored in <var>*ptr</var>, of the section
  517. <var>isec</var> in input BFD <var>ibfd</var> to output BFD <var>obfd</var>
  518. if needed. The original buffer pointed to by <var>*ptr</var> may
  519. be freed and <var>*ptr</var> is returned with memory malloc&rsquo;d by this
  520. function, and the new size written to <var>ptr_size</var>.
  521. </p>
  522. <a name="index-struct-bfd_005fiovec"></a>
  523. <a name="struct-bfd_005fiovec"></a>
  524. <h4 class="subsubsection">2.3.1.26 <code>struct bfd_iovec</code></h4>
  525. <p><strong>Description</strong><br>
  526. The <code>struct bfd_iovec</code> contains the internal file I/O class.
  527. Each <code>BFD</code> has an instance of this class and all file I/O is
  528. routed through it (it is assumed that the instance implements
  529. all methods listed below).
  530. </p><div class="example">
  531. <pre class="example">struct bfd_iovec
  532. {
  533. /* To avoid problems with macros, a &quot;b&quot; rather than &quot;f&quot;
  534. prefix is prepended to each method name. */
  535. /* Attempt to read/write NBYTES on ABFD's IOSTREAM storing/fetching
  536. bytes starting at PTR. Return the number of bytes actually
  537. transfered (a read past end-of-file returns less than NBYTES),
  538. or -1 (setting <code>bfd_error</code>) if an error occurs. */
  539. file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes);
  540. file_ptr (*bwrite) (struct bfd *abfd, const void *ptr,
  541. file_ptr nbytes);
  542. /* Return the current IOSTREAM file offset, or -1 (setting <code>bfd_error</code>
  543. if an error occurs. */
  544. file_ptr (*btell) (struct bfd *abfd);
  545. /* For the following, on successful completion a value of 0 is returned.
  546. Otherwise, a value of -1 is returned (and <code>bfd_error</code> is set). */
  547. int (*bseek) (struct bfd *abfd, file_ptr offset, int whence);
  548. int (*bclose) (struct bfd *abfd);
  549. int (*bflush) (struct bfd *abfd);
  550. int (*bstat) (struct bfd *abfd, struct stat *sb);
  551. /* Mmap a part of the files. ADDR, LEN, PROT, FLAGS and OFFSET are the usual
  552. mmap parameter, except that LEN and OFFSET do not need to be page
  553. aligned. Returns (void *)-1 on failure, mmapped address on success.
  554. Also write in MAP_ADDR the address of the page aligned buffer and in
  555. MAP_LEN the size mapped (a page multiple). Use unmap with MAP_ADDR and
  556. MAP_LEN to unmap. */
  557. void *(*bmmap) (struct bfd *abfd, void *addr, bfd_size_type len,
  558. int prot, int flags, file_ptr offset,
  559. void **map_addr, bfd_size_type *map_len);
  560. };
  561. extern const struct bfd_iovec _bfd_memory_iovec;
  562. </pre></div>
  563. <a name="index-bfd_005fget_005fmtime"></a>
  564. <a name="bfd_005fget_005fmtime"></a>
  565. <h4 class="subsubsection">2.3.1.27 <code>bfd_get_mtime</code></h4>
  566. <p><strong>Synopsis</strong>
  567. </p><div class="example">
  568. <pre class="example">long bfd_get_mtime (bfd *abfd);
  569. </pre></div>
  570. <p><strong>Description</strong><br>
  571. Return the file modification time (as read from the file system, or
  572. from the archive header for archive members).
  573. </p>
  574. <a name="index-bfd_005fget_005fsize"></a>
  575. <a name="bfd_005fget_005fsize"></a>
  576. <h4 class="subsubsection">2.3.1.28 <code>bfd_get_size</code></h4>
  577. <p><strong>Synopsis</strong>
  578. </p><div class="example">
  579. <pre class="example">ufile_ptr bfd_get_size (bfd *abfd);
  580. </pre></div>
  581. <p><strong>Description</strong><br>
  582. Return the file size (as read from file system) for the file
  583. associated with BFD <var>abfd</var>.
  584. </p>
  585. <p>The initial motivation for, and use of, this routine is not
  586. so we can get the exact size of the object the BFD applies to, since
  587. that might not be generally possible (archive members for example).
  588. It would be ideal if someone could eventually modify
  589. it so that such results were guaranteed.
  590. </p>
  591. <p>Instead, we want to ask questions like &quot;is this NNN byte sized
  592. object I&rsquo;m about to try read from file offset YYY reasonable?&quot;
  593. As as example of where we might do this, some object formats
  594. use string tables for which the first <code>sizeof (long)</code> bytes of the
  595. table contain the size of the table itself, including the size bytes.
  596. If an application tries to read what it thinks is one of these
  597. string tables, without some way to validate the size, and for
  598. some reason the size is wrong (byte swapping error, wrong location
  599. for the string table, etc.), the only clue is likely to be a read
  600. error when it tries to read the table, or a &quot;virtual memory
  601. exhausted&quot; error when it tries to allocate 15 bazillon bytes
  602. of space for the 15 bazillon byte table it is about to read.
  603. This function at least allows us to answer the question, &quot;is the
  604. size reasonable?&quot;.
  605. </p>
  606. <p>A return value of zero indicates the file size is unknown.
  607. </p>
  608. <a name="index-bfd_005fget_005ffile_005fsize"></a>
  609. <a name="bfd_005fget_005ffile_005fsize"></a>
  610. <h4 class="subsubsection">2.3.1.29 <code>bfd_get_file_size</code></h4>
  611. <p><strong>Synopsis</strong>
  612. </p><div class="example">
  613. <pre class="example">ufile_ptr bfd_get_file_size (bfd *abfd);
  614. </pre></div>
  615. <p><strong>Description</strong><br>
  616. Return the file size (as read from file system) for the file
  617. associated with BFD <var>abfd</var>. It supports both normal files
  618. and archive elements.
  619. </p>
  620. <a name="index-bfd_005fmmap"></a>
  621. <a name="bfd_005fmmap"></a>
  622. <h4 class="subsubsection">2.3.1.30 <code>bfd_mmap</code></h4>
  623. <p><strong>Synopsis</strong>
  624. </p><div class="example">
  625. <pre class="example">void *bfd_mmap (bfd *abfd, void *addr, bfd_size_type len,
  626. int prot, int flags, file_ptr offset,
  627. void **map_addr, bfd_size_type *map_len);
  628. </pre></div>
  629. <p><strong>Description</strong><br>
  630. Return mmap()ed region of the file, if possible and implemented.
  631. LEN and OFFSET do not need to be page aligned. The page aligned
  632. address and length are written to MAP_ADDR and MAP_LEN.
  633. </p>
  634. <hr>
  635. <div class="header">
  636. <p>
  637. Next: <a href="Memory-Usage.html#Memory-Usage" accesskey="n" rel="next">Memory Usage</a>, Previous: <a href="Error-reporting.html#Error-reporting" accesskey="p" rel="prev">Error reporting</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>
  638. </div>
  639. </body>
  640. </html>