Write-Other-Derived-Routines.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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: Write Other Derived Routines</title>
  21. <meta name="description" content="Untitled Document: Write Other Derived Routines">
  22. <meta name="keywords" content="Untitled Document: Write Other Derived Routines">
  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="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type" rel="up" title="Deriving a New Hash Table Type">
  31. <link href="BFD-back-ends.html#BFD-back-ends" rel="next" title="BFD back ends">
  32. <link href="Write-the-Derived-Creation-Routine.html#Write-the-Derived-Creation-Routine" rel="prev" title="Write the Derived Creation Routine">
  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="Write-Other-Derived-Routines"></a>
  64. <div class="header">
  65. <p>
  66. Previous: <a href="Write-the-Derived-Creation-Routine.html#Write-the-Derived-Creation-Routine" accesskey="p" rel="prev">Write the Derived Creation Routine</a>, Up: <a href="Deriving-a-New-Hash-Table-Type.html#Deriving-a-New-Hash-Table-Type" accesskey="u" rel="up">Deriving a New Hash Table Type</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="Write-other-derived-routines"></a>
  70. <h4 class="subsubsection">2.18.4.3 Write other derived routines</h4>
  71. <p>You will want to write other routines for your new hash table,
  72. as well.
  73. </p>
  74. <p>You will want an initialization routine which calls the
  75. initialization routine of the hash table you are deriving from
  76. and initializes any other local fields. For the linker hash
  77. table, this is <code>_bfd_link_hash_table_init</code> in <code>linker.c</code>.
  78. </p>
  79. <p>You will want a lookup routine which calls the lookup routine
  80. of the hash table you are deriving from and casts the result.
  81. The linker hash table uses <code>bfd_link_hash_lookup</code> in
  82. <code>linker.c</code> (this actually takes an additional argument which
  83. it uses to decide how to return the looked up value).
  84. </p>
  85. <p>You may want a traversal routine. This should just call the
  86. traversal routine of the hash table you are deriving from with
  87. appropriate casts. The linker hash table uses
  88. <code>bfd_link_hash_traverse</code> in <code>linker.c</code>.
  89. </p>
  90. <p>These routines may simply be defined as macros. For example,
  91. the a.out backend linker hash table, which is derived from the
  92. linker hash table, uses macros for the lookup and traversal
  93. routines. These are <code>aout_link_hash_lookup</code> and
  94. <code>aout_link_hash_traverse</code> in aoutx.h.
  95. </p>
  96. </body>
  97. </html>