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.

117 lines
5.4KB

  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>Differing file formats (Untitled Document)</title>
  22. <meta name="description" content="Differing file formats (Untitled Document)">
  23. <meta name="keywords" content="Differing file formats (Untitled Document)">
  24. <meta name="resource-type" content="document">
  25. <meta name="distribution" content="global">
  26. <meta name="Generator" content="makeinfo">
  27. <link href="index.html#Top" rel="start" title="Top">
  28. <link href="BFD-Index.html#BFD-Index" rel="index" title="BFD Index">
  29. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  30. <link href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" rel="up" title="Adding Symbols to the Hash Table">
  31. <link href="Adding-symbols-from-an-object-file.html#Adding-symbols-from-an-object-file" rel="next" title="Adding symbols from an object file">
  32. <link href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" rel="prev" title="Adding Symbols to the Hash Table">
  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="Differing-file-formats"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Adding-symbols-from-an-object-file.html#Adding-symbols-from-an-object-file" accesskey="n" rel="next">Adding symbols from an object file</a>, Previous: <a href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" accesskey="p" rel="prev">Adding Symbols to the Hash Table</a>, Up: <a href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" accesskey="u" rel="up">Adding Symbols to the Hash Table</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="Differing-file-formats-1"></a>
  69. <h4 class="subsubsection">2.17.2.1 Differing file formats</h4>
  70. <p>Normally all the files involved in a link will be of the same
  71. format, but it is also possible to link together different
  72. format object files, and the back end must support that. The
  73. <code>_bfd_link_add_symbols</code> entry point is called via the target
  74. vector of the file to be added. This has an important
  75. consequence: the function may not assume that the hash table
  76. is the type created by the corresponding
  77. <code>_bfd_link_hash_table_create</code> vector. All the
  78. <code>_bfd_link_add_symbols</code> function can assume about the hash
  79. table is that it is derived from <code>struct
  80. bfd_link_hash_table</code>.
  81. </p>
  82. <p>Sometimes the <code>_bfd_link_add_symbols</code> function must store
  83. some information in the hash table entry to be used by the
  84. <code>_bfd_final_link</code> function. In such a case the output bfd
  85. xvec must be checked to make sure that the hash table was
  86. created by an object file of the same format.
  87. </p>
  88. <p>The <code>_bfd_final_link</code> routine must be prepared to handle a
  89. hash entry without any extra information added by the
  90. <code>_bfd_link_add_symbols</code> function. A hash entry without
  91. extra information will also occur when the linker script
  92. directs the linker to create a symbol. Note that, regardless
  93. of how a hash table entry is added, all the fields will be
  94. initialized to some sort of null value by the hash table entry
  95. initialization function.
  96. </p>
  97. <p>See <code>ecoff_link_add_externals</code> for an example of how to
  98. check the output bfd before saving information (in this
  99. case, the ECOFF external symbol debugging information) in a
  100. hash table entry.
  101. </p>
  102. </body>
  103. </html>