Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

118 lines
5.6KB

  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>Relocating the section contents (Untitled Document)</title>
  22. <meta name="description" content="Relocating the section contents (Untitled Document)">
  23. <meta name="keywords" content="Relocating the section contents (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="Performing-the-Final-Link.html#Performing-the-Final-Link" rel="up" title="Performing the Final Link">
  31. <link href="Writing-the-symbol-table.html#Writing-the-symbol-table" rel="next" title="Writing the symbol table">
  32. <link href="Information-provided-by-the-linker.html#Information-provided-by-the-linker" rel="prev" title="Information provided by the linker">
  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="Relocating-the-section-contents"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Writing-the-symbol-table.html#Writing-the-symbol-table" accesskey="n" rel="next">Writing the symbol table</a>, Previous: <a href="Information-provided-by-the-linker.html#Information-provided-by-the-linker" accesskey="p" rel="prev">Information provided by the linker</a>, Up: <a href="Performing-the-Final-Link.html#Performing-the-Final-Link" accesskey="u" rel="up">Performing the Final Link</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="Relocating-the-section-contents-1"></a>
  69. <h4 class="subsubsection">2.17.3.2 Relocating the section contents</h4>
  70. <p>The <code>_bfd_final_link</code> function should look through the
  71. <code>link_order</code> structures attached to each section of the
  72. output file. Each <code>link_order</code> structure should either be
  73. handled specially, or it should be passed to the function
  74. <code>_bfd_default_link_order</code> which will do the right thing
  75. (<code>_bfd_default_link_order</code> is defined in <code>linker.c</code>).
  76. </p>
  77. <p>For efficiency, a <code>link_order</code> of type
  78. <code>bfd_indirect_link_order</code> whose associated section belongs
  79. to a BFD of the same format as the output BFD must be handled
  80. specially. This type of <code>link_order</code> describes part of an
  81. output section in terms of a section belonging to one of the
  82. input files. The <code>_bfd_final_link</code> function should read the
  83. contents of the section and any associated relocs, apply the
  84. relocs to the section contents, and write out the modified
  85. section contents. If performing a relocatable link, the
  86. relocs themselves must also be modified and written out.
  87. </p>
  88. <a name="index-_005fbfd_005frelocate_005fcontents"></a>
  89. <a name="index-_005fbfd_005ffinal_005flink_005frelocate"></a>
  90. <p>The functions <code>_bfd_relocate_contents</code> and
  91. <code>_bfd_final_link_relocate</code> provide some general support for
  92. performing the actual relocations, notably overflow checking.
  93. Their arguments include information about the symbol the
  94. relocation is against and a <code>reloc_howto_type</code> argument
  95. which describes the relocation to perform. These functions
  96. are defined in <code>reloc.c</code>.
  97. </p>
  98. <p>The a.out function which handles reading, relocating, and
  99. writing section contents is <code>aout_link_input_section</code>. The
  100. actual relocation is done in <code>aout_link_input_section_std</code>
  101. and <code>aout_link_input_section_ext</code>.
  102. </p>
  103. </body>
  104. </html>