bfd_005ftarget.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  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-2017 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 5.2, http://www.gnu.org/software/texinfo/ -->
  19. <head>
  20. <title>Untitled Document: bfd_target</title>
  21. <meta name="description" content="Untitled Document: bfd_target">
  22. <meta name="keywords" content="Untitled Document: bfd_target">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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="Targets.html#Targets" rel="up" title="Targets">
  31. <link href="Architectures.html#Architectures" rel="next" title="Architectures">
  32. <link href="Targets.html#Targets" rel="prev" title="Targets">
  33. <style type="text/css">
  34. <!--
  35. a.summary-letter {text-decoration: none}
  36. blockquote.smallquotation {font-size: smaller}
  37. div.display {margin-left: 3.2em}
  38. div.example {margin-left: 3.2em}
  39. div.indentedblock {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  55. span.nolinebreak {white-space:nowrap}
  56. span.roman {font-family:serif; font-weight:normal}
  57. span.sansserif {font-family:sans-serif; font-weight:normal}
  58. ul.no-bullet {list-style: none}
  59. -->
  60. </style>
  61. </head>
  62. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  63. <a name="bfd_005ftarget"></a>
  64. <div class="header">
  65. <p>
  66. Previous: <a href="Targets.html#Targets" accesskey="p" rel="prev">Targets</a>, Up: <a href="Targets.html#Targets" accesskey="u" rel="up">Targets</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>
  67. </div>
  68. <hr>
  69. <a name="bfd_005ftarget-1"></a>
  70. <h4 class="subsection">2.12.1 bfd_target</h4>
  71. <p><strong>Description</strong><br>
  72. This structure contains everything that BFD knows about a
  73. target. It includes things like its byte order, name, and which
  74. routines to call to do various operations.
  75. </p>
  76. <p>Every BFD points to a target structure with its <code>xvec</code>
  77. member.
  78. </p>
  79. <p>The macros below are used to dispatch to functions through the
  80. <code>bfd_target</code> vector. They are used in a number of macros further
  81. down in <samp>bfd.h</samp>, and are also used when calling various
  82. routines by hand inside the BFD implementation. The <var>arglist</var>
  83. argument must be parenthesized; it contains all the arguments
  84. to the called function.
  85. </p>
  86. <p>They make the documentation (more) unpleasant to read, so if
  87. someone wants to fix this and not break the above, please do.
  88. </p><div class="example">
  89. <pre class="example">#define BFD_SEND(bfd, message, arglist) \
  90. ((*((bfd)-&gt;xvec-&gt;message)) arglist)
  91. #ifdef DEBUG_BFD_SEND
  92. #undef BFD_SEND
  93. #define BFD_SEND(bfd, message, arglist) \
  94. (((bfd) &amp;&amp; (bfd)-&gt;xvec &amp;&amp; (bfd)-&gt;xvec-&gt;message) ? \
  95. ((*((bfd)-&gt;xvec-&gt;message)) arglist) : \
  96. (bfd_assert (__FILE__,__LINE__), NULL))
  97. #endif
  98. </pre></div>
  99. <p>For operations which index on the BFD format:
  100. </p><div class="example">
  101. <pre class="example">#define BFD_SEND_FMT(bfd, message, arglist) \
  102. (((bfd)-&gt;xvec-&gt;message[(int) ((bfd)-&gt;format)]) arglist)
  103. #ifdef DEBUG_BFD_SEND
  104. #undef BFD_SEND_FMT
  105. #define BFD_SEND_FMT(bfd, message, arglist) \
  106. (((bfd) &amp;&amp; (bfd)-&gt;xvec &amp;&amp; (bfd)-&gt;xvec-&gt;message) ? \
  107. (((bfd)-&gt;xvec-&gt;message[(int) ((bfd)-&gt;format)]) arglist) : \
  108. (bfd_assert (__FILE__,__LINE__), NULL))
  109. #endif
  110. </pre></div>
  111. <p>This is the structure which defines the type of BFD this is. The
  112. <code>xvec</code> member of the struct <code>bfd</code> itself points here. Each
  113. module that implements access to a different target under BFD,
  114. defines one of these.
  115. </p>
  116. <p>FIXME, these names should be rationalised with the names of
  117. the entry points which call them. Too bad we can&rsquo;t have one
  118. macro to define them both!
  119. </p><div class="example">
  120. <pre class="example">enum bfd_flavour
  121. {
  122. /* N.B. Update bfd_flavour_name if you change this. */
  123. bfd_target_unknown_flavour,
  124. bfd_target_aout_flavour,
  125. bfd_target_coff_flavour,
  126. bfd_target_ecoff_flavour,
  127. bfd_target_xcoff_flavour,
  128. bfd_target_elf_flavour,
  129. bfd_target_ieee_flavour,
  130. bfd_target_nlm_flavour,
  131. bfd_target_oasys_flavour,
  132. bfd_target_tekhex_flavour,
  133. bfd_target_srec_flavour,
  134. bfd_target_verilog_flavour,
  135. bfd_target_ihex_flavour,
  136. bfd_target_som_flavour,
  137. bfd_target_os9k_flavour,
  138. bfd_target_versados_flavour,
  139. bfd_target_msdos_flavour,
  140. bfd_target_ovax_flavour,
  141. bfd_target_evax_flavour,
  142. bfd_target_mmo_flavour,
  143. bfd_target_mach_o_flavour,
  144. bfd_target_pef_flavour,
  145. bfd_target_pef_xlib_flavour,
  146. bfd_target_sym_flavour
  147. };
  148. enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
  149. /* Forward declaration. */
  150. typedef struct bfd_link_info _bfd_link_info;
  151. /* Forward declaration. */
  152. typedef struct flag_info flag_info;
  153. typedef struct bfd_target
  154. {
  155. /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */
  156. char *name;
  157. /* The &quot;flavour&quot; of a back end is a general indication about
  158. the contents of a file. */
  159. enum bfd_flavour flavour;
  160. /* The order of bytes within the data area of a file. */
  161. enum bfd_endian byteorder;
  162. /* The order of bytes within the header parts of a file. */
  163. enum bfd_endian header_byteorder;
  164. /* A mask of all the flags which an executable may have set -
  165. from the set <code>BFD_NO_FLAGS</code>, <code>HAS_RELOC</code>, ...<code>D_PAGED</code>. */
  166. flagword object_flags;
  167. /* A mask of all the flags which a section may have set - from
  168. the set <code>SEC_NO_FLAGS</code>, <code>SEC_ALLOC</code>, ...<code>SET_NEVER_LOAD</code>. */
  169. flagword section_flags;
  170. /* The character normally found at the front of a symbol.
  171. (if any), perhaps `_'. */
  172. char symbol_leading_char;
  173. /* The pad character for file names within an archive header. */
  174. char ar_pad_char;
  175. /* The maximum number of characters in an archive header. */
  176. unsigned char ar_max_namelen;
  177. /* How well this target matches, used to select between various
  178. possible targets when more than one target matches. */
  179. unsigned char match_priority;
  180. /* Entries for byte swapping for data. These are different from the
  181. other entry points, since they don't take a BFD as the first argument.
  182. Certain other handlers could do the same. */
  183. bfd_uint64_t (*bfd_getx64) (const void *);
  184. bfd_int64_t (*bfd_getx_signed_64) (const void *);
  185. void (*bfd_putx64) (bfd_uint64_t, void *);
  186. bfd_vma (*bfd_getx32) (const void *);
  187. bfd_signed_vma (*bfd_getx_signed_32) (const void *);
  188. void (*bfd_putx32) (bfd_vma, void *);
  189. bfd_vma (*bfd_getx16) (const void *);
  190. bfd_signed_vma (*bfd_getx_signed_16) (const void *);
  191. void (*bfd_putx16) (bfd_vma, void *);
  192. /* Byte swapping for the headers. */
  193. bfd_uint64_t (*bfd_h_getx64) (const void *);
  194. bfd_int64_t (*bfd_h_getx_signed_64) (const void *);
  195. void (*bfd_h_putx64) (bfd_uint64_t, void *);
  196. bfd_vma (*bfd_h_getx32) (const void *);
  197. bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);
  198. void (*bfd_h_putx32) (bfd_vma, void *);
  199. bfd_vma (*bfd_h_getx16) (const void *);
  200. bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);
  201. void (*bfd_h_putx16) (bfd_vma, void *);
  202. /* Format dependent routines: these are vectors of entry points
  203. within the target vector structure, one for each format to check. */
  204. /* Check the format of a file being read. Return a <code>bfd_target *</code> or zero. */
  205. const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
  206. /* Set the format of a file being written. */
  207. bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
  208. /* Write cached information into a file being written, at <code>bfd_close</code>. */
  209. bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
  210. </pre></div>
  211. <p>The general target vector. These vectors are initialized using the
  212. BFD_JUMP_TABLE macros.
  213. </p><div class="example">
  214. <pre class="example">
  215. /* Generic entry points. */
  216. #define BFD_JUMP_TABLE_GENERIC(NAME) \
  217. NAME##_close_and_cleanup, \
  218. NAME##_bfd_free_cached_info, \
  219. NAME##_new_section_hook, \
  220. NAME##_get_section_contents, \
  221. NAME##_get_section_contents_in_window
  222. /* Called when the BFD is being closed to do any necessary cleanup. */
  223. bfd_boolean (*_close_and_cleanup) (bfd *);
  224. /* Ask the BFD to free all cached information. */
  225. bfd_boolean (*_bfd_free_cached_info) (bfd *);
  226. /* Called when a new section is created. */
  227. bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
  228. /* Read the contents of a section. */
  229. bfd_boolean (*_bfd_get_section_contents)
  230. (bfd *, sec_ptr, void *, file_ptr, bfd_size_type);
  231. bfd_boolean (*_bfd_get_section_contents_in_window)
  232. (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type);
  233. /* Entry points to copy private data. */
  234. #define BFD_JUMP_TABLE_COPY(NAME) \
  235. NAME##_bfd_copy_private_bfd_data, \
  236. NAME##_bfd_merge_private_bfd_data, \
  237. _bfd_generic_init_private_section_data, \
  238. NAME##_bfd_copy_private_section_data, \
  239. NAME##_bfd_copy_private_symbol_data, \
  240. NAME##_bfd_copy_private_header_data, \
  241. NAME##_bfd_set_private_flags, \
  242. NAME##_bfd_print_private_bfd_data
  243. /* Called to copy BFD general private data from one object file
  244. to another. */
  245. bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *);
  246. /* Called to merge BFD general private data from one object file
  247. to a common output file when linking. */
  248. bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, struct bfd_link_info *);
  249. /* Called to initialize BFD private section data from one object file
  250. to another. */
  251. #define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
  252. BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info))
  253. bfd_boolean (*_bfd_init_private_section_data)
  254. (bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *);
  255. /* Called to copy BFD private section data from one object file
  256. to another. */
  257. bfd_boolean (*_bfd_copy_private_section_data)
  258. (bfd *, sec_ptr, bfd *, sec_ptr);
  259. /* Called to copy BFD private symbol data from one symbol
  260. to another. */
  261. bfd_boolean (*_bfd_copy_private_symbol_data)
  262. (bfd *, asymbol *, bfd *, asymbol *);
  263. /* Called to copy BFD private header data from one object file
  264. to another. */
  265. bfd_boolean (*_bfd_copy_private_header_data)
  266. (bfd *, bfd *);
  267. /* Called to set private backend flags. */
  268. bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
  269. /* Called to print private BFD data. */
  270. bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
  271. /* Core file entry points. */
  272. #define BFD_JUMP_TABLE_CORE(NAME) \
  273. NAME##_core_file_failing_command, \
  274. NAME##_core_file_failing_signal, \
  275. NAME##_core_file_matches_executable_p, \
  276. NAME##_core_file_pid
  277. char * (*_core_file_failing_command) (bfd *);
  278. int (*_core_file_failing_signal) (bfd *);
  279. bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *);
  280. int (*_core_file_pid) (bfd *);
  281. /* Archive entry points. */
  282. #define BFD_JUMP_TABLE_ARCHIVE(NAME) \
  283. NAME##_slurp_armap, \
  284. NAME##_slurp_extended_name_table, \
  285. NAME##_construct_extended_name_table, \
  286. NAME##_truncate_arname, \
  287. NAME##_write_armap, \
  288. NAME##_read_ar_hdr, \
  289. NAME##_write_ar_hdr, \
  290. NAME##_openr_next_archived_file, \
  291. NAME##_get_elt_at_index, \
  292. NAME##_generic_stat_arch_elt, \
  293. NAME##_update_armap_timestamp
  294. bfd_boolean (*_bfd_slurp_armap) (bfd *);
  295. bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *);
  296. bfd_boolean (*_bfd_construct_extended_name_table)
  297. (bfd *, char **, bfd_size_type *, const char **);
  298. void (*_bfd_truncate_arname) (bfd *, const char *, char *);
  299. bfd_boolean (*write_armap)
  300. (bfd *, unsigned int, struct orl *, unsigned int, int);
  301. void * (*_bfd_read_ar_hdr_fn) (bfd *);
  302. bfd_boolean (*_bfd_write_ar_hdr_fn) (bfd *, bfd *);
  303. bfd * (*openr_next_archived_file) (bfd *, bfd *);
  304. #define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i))
  305. bfd * (*_bfd_get_elt_at_index) (bfd *, symindex);
  306. int (*_bfd_stat_arch_elt) (bfd *, struct stat *);
  307. bfd_boolean (*_bfd_update_armap_timestamp) (bfd *);
  308. /* Entry points used for symbols. */
  309. #define BFD_JUMP_TABLE_SYMBOLS(NAME) \
  310. NAME##_get_symtab_upper_bound, \
  311. NAME##_canonicalize_symtab, \
  312. NAME##_make_empty_symbol, \
  313. NAME##_print_symbol, \
  314. NAME##_get_symbol_info, \
  315. NAME##_get_symbol_version_string, \
  316. NAME##_bfd_is_local_label_name, \
  317. NAME##_bfd_is_target_special_symbol, \
  318. NAME##_get_lineno, \
  319. NAME##_find_nearest_line, \
  320. NAME##_find_line, \
  321. NAME##_find_inliner_info, \
  322. NAME##_bfd_make_debug_symbol, \
  323. NAME##_read_minisymbols, \
  324. NAME##_minisymbol_to_symbol
  325. long (*_bfd_get_symtab_upper_bound) (bfd *);
  326. long (*_bfd_canonicalize_symtab)
  327. (bfd *, struct bfd_symbol **);
  328. struct bfd_symbol *
  329. (*_bfd_make_empty_symbol) (bfd *);
  330. void (*_bfd_print_symbol)
  331. (bfd *, void *, struct bfd_symbol *, bfd_print_symbol_type);
  332. #define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e))
  333. void (*_bfd_get_symbol_info)
  334. (bfd *, struct bfd_symbol *, symbol_info *);
  335. #define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
  336. const char *(*_bfd_get_symbol_version_string)
  337. (bfd *, struct bfd_symbol *, bfd_boolean *);
  338. #define bfd_get_symbol_version_string(b,s,h) BFD_SEND (b, _bfd_get_symbol_version_string, (b,s,h))
  339. bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
  340. bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
  341. alent * (*_get_lineno) (bfd *, struct bfd_symbol *);
  342. bfd_boolean (*_bfd_find_nearest_line)
  343. (bfd *, struct bfd_symbol **, struct bfd_section *, bfd_vma,
  344. const char **, const char **, unsigned int *, unsigned int *);
  345. bfd_boolean (*_bfd_find_line)
  346. (bfd *, struct bfd_symbol **, struct bfd_symbol *,
  347. const char **, unsigned int *);
  348. bfd_boolean (*_bfd_find_inliner_info)
  349. (bfd *, const char **, const char **, unsigned int *);
  350. /* Back-door to allow format-aware applications to create debug symbols
  351. while using BFD for everything else. Currently used by the assembler
  352. when creating COFF files. */
  353. asymbol * (*_bfd_make_debug_symbol)
  354. (bfd *, void *, unsigned long size);
  355. #define bfd_read_minisymbols(b, d, m, s) \
  356. BFD_SEND (b, _read_minisymbols, (b, d, m, s))
  357. long (*_read_minisymbols)
  358. (bfd *, bfd_boolean, void **, unsigned int *);
  359. #define bfd_minisymbol_to_symbol(b, d, m, f) \
  360. BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
  361. asymbol * (*_minisymbol_to_symbol)
  362. (bfd *, bfd_boolean, const void *, asymbol *);
  363. /* Routines for relocs. */
  364. #define BFD_JUMP_TABLE_RELOCS(NAME) \
  365. NAME##_get_reloc_upper_bound, \
  366. NAME##_canonicalize_reloc, \
  367. NAME##_bfd_reloc_type_lookup, \
  368. NAME##_bfd_reloc_name_lookup
  369. long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
  370. long (*_bfd_canonicalize_reloc)
  371. (bfd *, sec_ptr, arelent **, struct bfd_symbol **);
  372. /* See documentation on reloc types. */
  373. reloc_howto_type *
  374. (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
  375. reloc_howto_type *
  376. (*reloc_name_lookup) (bfd *, const char *);
  377. /* Routines used when writing an object file. */
  378. #define BFD_JUMP_TABLE_WRITE(NAME) \
  379. NAME##_set_arch_mach, \
  380. NAME##_set_section_contents
  381. bfd_boolean (*_bfd_set_arch_mach)
  382. (bfd *, enum bfd_architecture, unsigned long);
  383. bfd_boolean (*_bfd_set_section_contents)
  384. (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
  385. /* Routines used by the linker. */
  386. #define BFD_JUMP_TABLE_LINK(NAME) \
  387. NAME##_sizeof_headers, \
  388. NAME##_bfd_get_relocated_section_contents, \
  389. NAME##_bfd_relax_section, \
  390. NAME##_bfd_link_hash_table_create, \
  391. NAME##_bfd_link_add_symbols, \
  392. NAME##_bfd_link_just_syms, \
  393. NAME##_bfd_copy_link_hash_symbol_type, \
  394. NAME##_bfd_final_link, \
  395. NAME##_bfd_link_split_section, \
  396. NAME##_bfd_link_check_relocs, \
  397. NAME##_bfd_gc_sections, \
  398. NAME##_bfd_lookup_section_flags, \
  399. NAME##_bfd_merge_sections, \
  400. NAME##_bfd_is_group_section, \
  401. NAME##_bfd_discard_group, \
  402. NAME##_section_already_linked, \
  403. NAME##_bfd_define_common_symbol
  404. int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
  405. bfd_byte * (*_bfd_get_relocated_section_contents)
  406. (bfd *, struct bfd_link_info *, struct bfd_link_order *,
  407. bfd_byte *, bfd_boolean, struct bfd_symbol **);
  408. bfd_boolean (*_bfd_relax_section)
  409. (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
  410. /* Create a hash table for the linker. Different backends store
  411. different information in this table. */
  412. struct bfd_link_hash_table *
  413. (*_bfd_link_hash_table_create) (bfd *);
  414. /* Add symbols from this object file into the hash table. */
  415. bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *);
  416. /* Indicate that we are only retrieving symbol values from this section. */
  417. void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
  418. /* Copy the symbol type and other attributes for a linker script
  419. assignment of one symbol to another. */
  420. #define bfd_copy_link_hash_symbol_type(b, t, f) \
  421. BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f))
  422. void (*_bfd_copy_link_hash_symbol_type)
  423. (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *);
  424. /* Do a link based on the link_order structures attached to each
  425. section of the BFD. */
  426. bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
  427. /* Should this section be split up into smaller pieces during linking. */
  428. bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
  429. /* Check the relocations in the bfd for validity. */
  430. bfd_boolean (* _bfd_link_check_relocs)(bfd *, struct bfd_link_info *);
  431. /* Remove sections that are not referenced from the output. */
  432. bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
  433. /* Sets the bitmask of allowed and disallowed section flags. */
  434. bfd_boolean (*_bfd_lookup_section_flags) (struct bfd_link_info *,
  435. struct flag_info *,
  436. asection *);
  437. /* Attempt to merge SEC_MERGE sections. */
  438. bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
  439. /* Is this section a member of a group? */
  440. bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
  441. /* Discard members of a group. */
  442. bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
  443. /* Check if SEC has been already linked during a reloceatable or
  444. final link. */
  445. bfd_boolean (*_section_already_linked) (bfd *, asection *,
  446. struct bfd_link_info *);
  447. /* Define a common symbol. */
  448. bfd_boolean (*_bfd_define_common_symbol) (bfd *, struct bfd_link_info *,
  449. struct bfd_link_hash_entry *);
  450. /* Routines to handle dynamic symbols and relocs. */
  451. #define BFD_JUMP_TABLE_DYNAMIC(NAME) \
  452. NAME##_get_dynamic_symtab_upper_bound, \
  453. NAME##_canonicalize_dynamic_symtab, \
  454. NAME##_get_synthetic_symtab, \
  455. NAME##_get_dynamic_reloc_upper_bound, \
  456. NAME##_canonicalize_dynamic_reloc
  457. /* Get the amount of memory required to hold the dynamic symbols. */
  458. long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
  459. /* Read in the dynamic symbols. */
  460. long (*_bfd_canonicalize_dynamic_symtab)
  461. (bfd *, struct bfd_symbol **);
  462. /* Create synthetized symbols. */
  463. long (*_bfd_get_synthetic_symtab)
  464. (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **,
  465. struct bfd_symbol **);
  466. /* Get the amount of memory required to hold the dynamic relocs. */
  467. long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
  468. /* Read in the dynamic relocs. */
  469. long (*_bfd_canonicalize_dynamic_reloc)
  470. (bfd *, arelent **, struct bfd_symbol **);
  471. </pre></div>
  472. <p>A pointer to an alternative bfd_target in case the current one is not
  473. satisfactory. This can happen when the target cpu supports both big
  474. and little endian code, and target chosen by the linker has the wrong
  475. endianness. The function open_output() in ld/ldlang.c uses this field
  476. to find an alternative output format that is suitable.
  477. </p><div class="example">
  478. <pre class="example"> /* Opposite endian version of this target. */
  479. const struct bfd_target * alternative_target;
  480. /* Data for use by back-end routines, which isn't
  481. generic enough to belong in this structure. */
  482. const void *backend_data;
  483. } bfd_target;
  484. </pre></div>
  485. <a name="index-bfd_005fset_005fdefault_005ftarget"></a>
  486. <a name="bfd_005fset_005fdefault_005ftarget"></a>
  487. <h4 class="subsubsection">2.12.1.1 <code>bfd_set_default_target</code></h4>
  488. <p><strong>Synopsis</strong>
  489. </p><div class="example">
  490. <pre class="example">bfd_boolean bfd_set_default_target (const char *name);
  491. </pre></div>
  492. <p><strong>Description</strong><br>
  493. Set the default target vector to use when recognizing a BFD.
  494. This takes the name of the target, which may be a BFD target
  495. name or a configuration triplet.
  496. </p>
  497. <a name="index-bfd_005ffind_005ftarget"></a>
  498. <a name="bfd_005ffind_005ftarget"></a>
  499. <h4 class="subsubsection">2.12.1.2 <code>bfd_find_target</code></h4>
  500. <p><strong>Synopsis</strong>
  501. </p><div class="example">
  502. <pre class="example">const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
  503. </pre></div>
  504. <p><strong>Description</strong><br>
  505. Return a pointer to the transfer vector for the object target
  506. named <var>target_name</var>. If <var>target_name</var> is <code>NULL</code>,
  507. choose the one in the environment variable <code>GNUTARGET</code>; if
  508. that is null or not defined, then choose the first entry in the
  509. target list. Passing in the string &quot;default&quot; or setting the
  510. environment variable to &quot;default&quot; will cause the first entry in
  511. the target list to be returned, and &quot;target_defaulted&quot; will be
  512. set in the BFD if <var>abfd</var> isn&rsquo;t <code>NULL</code>. This causes
  513. <code>bfd_check_format</code> to loop over all the targets to find the
  514. one that matches the file being read.
  515. </p>
  516. <a name="index-bfd_005fget_005ftarget_005finfo"></a>
  517. <a name="bfd_005fget_005ftarget_005finfo"></a>
  518. <h4 class="subsubsection">2.12.1.3 <code>bfd_get_target_info</code></h4>
  519. <p><strong>Synopsis</strong>
  520. </p><div class="example">
  521. <pre class="example">const bfd_target *bfd_get_target_info (const char *target_name,
  522. bfd *abfd,
  523. bfd_boolean *is_bigendian,
  524. int *underscoring,
  525. const char **def_target_arch);
  526. </pre></div>
  527. <p><strong>Description</strong><br>
  528. Return a pointer to the transfer vector for the object target
  529. named <var>target_name</var>. If <var>target_name</var> is <code>NULL</code>,
  530. choose the one in the environment variable <code>GNUTARGET</code>; if
  531. that is null or not defined, then choose the first entry in the
  532. target list. Passing in the string &quot;default&quot; or setting the
  533. environment variable to &quot;default&quot; will cause the first entry in
  534. the target list to be returned, and &quot;target_defaulted&quot; will be
  535. set in the BFD if <var>abfd</var> isn&rsquo;t <code>NULL</code>. This causes
  536. <code>bfd_check_format</code> to loop over all the targets to find the
  537. one that matches the file being read.
  538. If <var>is_bigendian</var> is not <code>NULL</code>, then set this value to target&rsquo;s
  539. endian mode. True for big-endian, FALSE for little-endian or for
  540. invalid target.
  541. If <var>underscoring</var> is not <code>NULL</code>, then set this value to target&rsquo;s
  542. underscoring mode. Zero for none-underscoring, -1 for invalid target,
  543. else the value of target vector&rsquo;s symbol underscoring.
  544. If <var>def_target_arch</var> is not <code>NULL</code>, then set it to the architecture
  545. string specified by the target_name.
  546. </p>
  547. <a name="index-bfd_005ftarget_005flist"></a>
  548. <a name="bfd_005ftarget_005flist"></a>
  549. <h4 class="subsubsection">2.12.1.4 <code>bfd_target_list</code></h4>
  550. <p><strong>Synopsis</strong>
  551. </p><div class="example">
  552. <pre class="example">const char ** bfd_target_list (void);
  553. </pre></div>
  554. <p><strong>Description</strong><br>
  555. Return a freshly malloced NULL-terminated
  556. vector of the names of all the valid BFD targets. Do not
  557. modify the names.
  558. </p>
  559. <a name="index-bfd_005fiterate_005fover_005ftargets"></a>
  560. <a name="bfd_005fiterate_005fover_005ftargets"></a>
  561. <h4 class="subsubsection">2.12.1.5 <code>bfd_iterate_over_targets</code></h4>
  562. <p><strong>Synopsis</strong>
  563. </p><div class="example">
  564. <pre class="example">const bfd_target *bfd_iterate_over_targets
  565. (int (*func) (const bfd_target *, void *),
  566. void *data);
  567. </pre></div>
  568. <p><strong>Description</strong><br>
  569. Call <var>func</var> for each target in the list of BFD target
  570. vectors, passing <var>data</var> to <var>func</var>. Stop iterating if
  571. <var>func</var> returns a non-zero result, and return that target
  572. vector. Return NULL if <var>func</var> always returns zero.
  573. </p>
  574. <a name="index-bfd_005fflavour_005fname"></a>
  575. <a name="bfd_005fflavour_005fname"></a>
  576. <h4 class="subsubsection">2.12.1.6 <code>bfd_flavour_name</code></h4>
  577. <p><strong>Synopsis</strong>
  578. </p><div class="example">
  579. <pre class="example">const char *bfd_flavour_name (enum bfd_flavour flavour);
  580. </pre></div>
  581. <p><strong>Description</strong><br>
  582. Return the string form of <var>flavour</var>.
  583. </p>
  584. <hr>
  585. <div class="header">
  586. <p>
  587. Previous: <a href="Targets.html#Targets" accesskey="p" rel="prev">Targets</a>, Up: <a href="Targets.html#Targets" accesskey="u" rel="up">Targets</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>
  588. </div>
  589. </body>
  590. </html>