Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

146 lines
6.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>Section Output (Untitled Document)</title>
  22. <meta name="description" content="Section Output (Untitled Document)">
  23. <meta name="keywords" content="Section Output (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="Sections.html#Sections" rel="up" title="Sections">
  31. <link href="typedef-asection.html#typedef-asection" rel="next" title="typedef asection">
  32. <link href="Section-Input.html#Section-Input" rel="prev" title="Section Input">
  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="Section-Output"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="typedef-asection.html#typedef-asection" accesskey="n" rel="next">typedef asection</a>, Previous: <a href="Section-Input.html#Section-Input" accesskey="p" rel="prev">Section Input</a>, Up: <a href="Sections.html#Sections" accesskey="u" rel="up">Sections</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="Section-output"></a>
  69. <h4 class="subsection">2.6.2 Section output</h4>
  70. <p>To write a new object style BFD, the various sections to be
  71. written have to be created. They are attached to the BFD in
  72. the same way as input sections; data is written to the
  73. sections using <code>bfd_set_section_contents</code>.
  74. </p>
  75. <p>Any program that creates or combines sections (e.g., the assembler
  76. and linker) must use the <code>asection</code> fields <code>output_section</code> and
  77. <code>output_offset</code> to indicate the file sections to which each
  78. section must be written. (If the section is being created from
  79. scratch, <code>output_section</code> should probably point to the section
  80. itself and <code>output_offset</code> should probably be zero.)
  81. </p>
  82. <p>The data to be written comes from input sections attached
  83. (via <code>output_section</code> pointers) to
  84. the output sections. The output section structure can be
  85. considered a filter for the input section: the output section
  86. determines the vma of the output data and the name, but the
  87. input section determines the offset into the output section of
  88. the data to be written.
  89. </p>
  90. <p>E.g., to create a section &quot;O&quot;, starting at 0x100, 0x123 long,
  91. containing two subsections, &quot;A&quot; at offset 0x0 (i.e., at vma
  92. 0x100) and &quot;B&quot; at offset 0x20 (i.e., at vma 0x120) the <code>asection</code>
  93. structures would look like:
  94. </p>
  95. <div class="example">
  96. <pre class="example"> section name &quot;A&quot;
  97. output_offset 0x00
  98. size 0x20
  99. output_section -----------&gt; section name &quot;O&quot;
  100. | vma 0x100
  101. section name &quot;B&quot; | size 0x123
  102. output_offset 0x20 |
  103. size 0x103 |
  104. output_section --------|
  105. </pre></div>
  106. <a name="Link-orders"></a>
  107. <h4 class="subsection">2.6.3 Link orders</h4>
  108. <p>The data within a section is stored in a <em>link_order</em>.
  109. These are much like the fixups in <code>gas</code>. The link_order
  110. abstraction allows a section to grow and shrink within itself.
  111. </p>
  112. <p>A link_order knows how big it is, and which is the next
  113. link_order and where the raw data for it is; it also points to
  114. a list of relocations which apply to it.
  115. </p>
  116. <p>The link_order is used by the linker to perform relaxing on
  117. final code. The compiler creates code which is as big as
  118. necessary to make it work without relaxing, and the user can
  119. select whether to relax. Sometimes relaxing takes a lot of
  120. time. The linker runs around the relocations to see if any
  121. are attached to data which can be shrunk, if so it does it on
  122. a link_order by link_order basis.
  123. </p>
  124. <hr>
  125. <div class="header">
  126. <p>
  127. Next: <a href="typedef-asection.html#typedef-asection" accesskey="n" rel="next">typedef asection</a>, Previous: <a href="Section-Input.html#Section-Input" accesskey="p" rel="prev">Section Input</a>, Up: <a href="Sections.html#Sections" accesskey="u" rel="up">Sections</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>
  128. </div>
  129. </body>
  130. </html>