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.

762 lines
30KB

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