No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

153 líneas
6.3KB

  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 GNU Assembler "as".
  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
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title>Ld Sections (Using as)</title>
  16. <meta name="description" content="Ld Sections (Using as)">
  17. <meta name="keywords" content="Ld Sections (Using as)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="Sections.html#Sections" rel="up" title="Sections">
  25. <link href="As-Sections.html#As-Sections" rel="next" title="As Sections">
  26. <link href="Secs-Background.html#Secs-Background" rel="prev" title="Secs Background">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.indentedblock {margin-right: 0em}
  31. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  32. blockquote.smallquotation {font-size: smaller}
  33. div.display {margin-left: 3.2em}
  34. div.example {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style: oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nolinebreak {white-space: nowrap}
  49. span.roman {font-family: initial; font-weight: normal}
  50. span.sansserif {font-family: sans-serif; font-weight: normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en">
  56. <a name="Ld-Sections"></a>
  57. <div class="header">
  58. <p>
  59. Next: <a href="As-Sections.html#As-Sections" accesskey="n" rel="next">As Sections</a>, Previous: <a href="Secs-Background.html#Secs-Background" accesskey="p" rel="prev">Secs Background</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="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  60. </div>
  61. <hr>
  62. <a name="Linker-Sections"></a>
  63. <h3 class="section">4.2 Linker Sections</h3>
  64. <p><code>ld</code> deals with just four kinds of sections, summarized below.
  65. </p>
  66. <dl compact="compact">
  67. <dd>
  68. <a name="index-named-sections"></a>
  69. <a name="index-sections_002c-named"></a>
  70. </dd>
  71. <dt><strong>named sections</strong></dt>
  72. <dd><a name="index-text-section"></a>
  73. <a name="index-data-section"></a>
  74. </dd>
  75. <dt><strong>text section</strong></dt>
  76. <dt><strong>data section</strong></dt>
  77. <dd><p>These sections hold your program. <code>as</code> and <code>ld</code> treat them as
  78. separate but equal sections. Anything you can say of one section is
  79. true of another.
  80. When the program is running, however, it is
  81. customary for the text section to be unalterable. The
  82. text section is often shared among processes: it contains
  83. instructions, constants and the like. The data section of a running
  84. program is usually alterable: for example, C variables would be stored
  85. in the data section.
  86. </p>
  87. <a name="index-bss-section"></a>
  88. </dd>
  89. <dt><strong>bss section</strong></dt>
  90. <dd><p>This section contains zeroed bytes when your program begins running. It
  91. is used to hold uninitialized variables or common storage. The length of
  92. each partial program&rsquo;s bss section is important, but because it starts
  93. out containing zeroed bytes there is no need to store explicit zero
  94. bytes in the object file. The bss section was invented to eliminate
  95. those explicit zeros from object files.
  96. </p>
  97. <a name="index-absolute-section"></a>
  98. </dd>
  99. <dt><strong>absolute section</strong></dt>
  100. <dd><p>Address 0 of this section is always &ldquo;relocated&rdquo; to runtime address 0.
  101. This is useful if you want to refer to an address that <code>ld</code> must
  102. not change when relocating. In this sense we speak of absolute
  103. addresses being &ldquo;unrelocatable&rdquo;: they do not change during relocation.
  104. </p>
  105. <a name="index-undefined-section"></a>
  106. </dd>
  107. <dt><strong>undefined section</strong></dt>
  108. <dd><p>This &ldquo;section&rdquo; is a catch-all for address references to objects not in
  109. the preceding sections.
  110. </p></dd>
  111. </dl>
  112. <a name="index-relocation-example"></a>
  113. <p>An idealized example of three relocatable sections follows.
  114. The example uses the traditional section names &lsquo;<samp>.text</samp>&rsquo; and &lsquo;<samp>.data</samp>&rsquo;.
  115. Memory addresses are on the horizontal axis.
  116. </p>
  117. <div class="smallexample">
  118. <pre class="smallexample"> +-----+----+--+
  119. partial program # 1: |ttttt|dddd|00|
  120. +-----+----+--+
  121. text data bss
  122. seg. seg. seg.
  123. +---+---+---+
  124. partial program # 2: |TTT|DDD|000|
  125. +---+---+---+
  126. +--+---+-----+--+----+---+-----+~~
  127. linked program: | |TTT|ttttt| |dddd|DDD|00000|
  128. +--+---+-----+--+----+---+-----+~~
  129. addresses: 0 &hellip;
  130. </pre></div>
  131. <hr>
  132. <div class="header">
  133. <p>
  134. Next: <a href="As-Sections.html#As-Sections" accesskey="n" rel="next">As Sections</a>, Previous: <a href="Secs-Background.html#Secs-Background" accesskey="p" rel="prev">Secs Background</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="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  135. </div>
  136. </body>
  137. </html>