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.

Creating-a-Linker-Hash-Table.html 6.0KB

3 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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>Creating a Linker Hash Table (Untitled Document)</title>
  22. <meta name="description" content="Creating a Linker Hash Table (Untitled Document)">
  23. <meta name="keywords" content="Creating a Linker Hash Table (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="Linker-Functions.html#Linker-Functions" rel="up" title="Linker Functions">
  31. <link href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" rel="next" title="Adding Symbols to the Hash Table">
  32. <link href="Linker-Functions.html#Linker-Functions" rel="prev" title="Linker Functions">
  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="Creating-a-Linker-Hash-Table"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" accesskey="n" rel="next">Adding Symbols to the Hash Table</a>, Previous: <a href="Linker-Functions.html#Linker-Functions" accesskey="p" rel="prev">Linker Functions</a>, Up: <a href="Linker-Functions.html#Linker-Functions" accesskey="u" rel="up">Linker Functions</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="Creating-a-linker-hash-table"></a>
  69. <h4 class="subsection">2.17.1 Creating a linker hash table</h4>
  70. <a name="index-_005fbfd_005flink_005fhash_005ftable_005fcreate-in-target-vector"></a>
  71. <a name="index-target-vector-_0028_005fbfd_005flink_005fhash_005ftable_005fcreate_0029"></a>
  72. <p>The linker routines must create a hash table, which must be
  73. derived from <code>struct bfd_link_hash_table</code> described in
  74. <code>bfdlink.c</code>. See <a href="Hash-Tables.html#Hash-Tables">Hash Tables</a>, for information on how to
  75. create a derived hash table. This entry point is called using
  76. the target vector of the linker output file.
  77. </p>
  78. <p>The <code>_bfd_link_hash_table_create</code> entry point must allocate
  79. and initialize an instance of the desired hash table. If the
  80. back end does not require any additional information to be
  81. stored with the entries in the hash table, the entry point may
  82. simply create a <code>struct bfd_link_hash_table</code>. Most likely,
  83. however, some additional information will be needed.
  84. </p>
  85. <p>For example, with each entry in the hash table the a.out
  86. linker keeps the index the symbol has in the final output file
  87. (this index number is used so that when doing a relocatable
  88. link the symbol index used in the output file can be quickly
  89. filled in when copying over a reloc). The a.out linker code
  90. defines the required structures and functions for a hash table
  91. derived from <code>struct bfd_link_hash_table</code>. The a.out linker
  92. hash table is created by the function
  93. <code>NAME(aout,link_hash_table_create)</code>; it simply allocates
  94. space for the hash table, initializes it, and returns a
  95. pointer to it.
  96. </p>
  97. <p>When writing the linker routines for a new back end, you will
  98. generally not know exactly which fields will be required until
  99. you have finished. You should simply create a new hash table
  100. which defines no additional fields, and then simply add fields
  101. as they become necessary.
  102. </p>
  103. <hr>
  104. <div class="header">
  105. <p>
  106. Next: <a href="Adding-Symbols-to-the-Hash-Table.html#Adding-Symbols-to-the-Hash-Table" accesskey="n" rel="next">Adding Symbols to the Hash Table</a>, Previous: <a href="Linker-Functions.html#Linker-Functions" accesskey="p" rel="prev">Linker Functions</a>, Up: <a href="Linker-Functions.html#Linker-Functions" accesskey="u" rel="up">Linker Functions</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>
  107. </div>
  108. </body>
  109. </html>