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.

183 lines
7.5KB

  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>mmo section mapping (Untitled Document)</title>
  22. <meta name="description" content="mmo section mapping (Untitled Document)">
  23. <meta name="keywords" content="mmo section mapping (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="mmo.html#mmo" rel="up" title="mmo">
  31. <link href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License" rel="next" title="GNU Free Documentation License">
  32. <link href="Symbol_002dtable.html#Symbol_002dtable" rel="prev" title="Symbol-table">
  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="mmo-section-mapping"></a>
  63. <div class="header">
  64. <p>
  65. Previous: <a href="Symbol_002dtable.html#Symbol_002dtable" accesskey="p" rel="prev">Symbol-table</a>, Up: <a href="mmo.html#mmo" accesskey="u" rel="up">mmo</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="mmo-section-mapping-1"></a>
  69. <h4 class="subsection">3.5.3 mmo section mapping</h4>
  70. <p>The implementation in BFD uses special data type 80 (decimal) to
  71. encapsulate and describe named sections, containing e.g. debug
  72. information. If needed, any datum in the encapsulation will be
  73. quoted using lop_quote. First comes a 32-bit word holding the
  74. number of 32-bit words containing the zero-terminated zero-padded
  75. segment name. After the name there&rsquo;s a 32-bit word holding flags
  76. describing the section type. Then comes a 64-bit big-endian word
  77. with the section length (in bytes), then another with the section
  78. start address. Depending on the type of section, the contents
  79. might follow, zero-padded to 32-bit boundary. For a loadable
  80. section (such as data or code), the contents might follow at some
  81. later point, not necessarily immediately, as a lop_loc with the
  82. same start address as in the section description, followed by the
  83. contents. This in effect forms a descriptor that must be emitted
  84. before the actual contents. Sections described this way must not
  85. overlap.
  86. </p>
  87. <p>For areas that don&rsquo;t have such descriptors, synthetic sections are
  88. formed by BFD. Consecutive contents in the two memory areas
  89. &lsquo;<samp>0x0000&hellip;00</samp>&rsquo; to &lsquo;<samp>0x01ff&hellip;ff</samp>&rsquo; and
  90. &lsquo;<samp>0x2000&hellip;00</samp>&rsquo; to &lsquo;<samp>0x20ff&hellip;ff</samp>&rsquo; are entered in
  91. sections named <code>.text</code> and <code>.data</code> respectively. If an area
  92. is not otherwise described, but would together with a neighboring
  93. lower area be less than &lsquo;<samp>0x40000000</samp>&rsquo; bytes long, it is joined
  94. with the lower area and the gap is zero-filled. For other cases,
  95. a new section is formed, named <code>.MMIX.sec.<var>n</var></code>. Here,
  96. <var>n</var> is a number, a running count through the mmo file,
  97. starting at 0.
  98. </p>
  99. <p>A loadable section specified as:
  100. </p>
  101. <div class="example">
  102. <pre class="example"> .section secname,&quot;ax&quot;
  103. TETRA 1,2,3,4,-1,-2009
  104. BYTE 80
  105. </pre></div>
  106. <p>and linked to address &lsquo;<samp>0x4</samp>&rsquo;, is represented by the sequence:
  107. </p>
  108. <div class="example">
  109. <pre class="example"> 0x98080050 - lop_spec 80
  110. 0x00000002 - two 32-bit words for the section name
  111. 0x7365636e - &quot;secn&quot;
  112. 0x616d6500 - &quot;ame\0&quot;
  113. 0x00000033 - flags CODE, READONLY, LOAD, ALLOC
  114. 0x00000000 - high 32 bits of section length
  115. 0x0000001c - section length is 28 bytes; 6 * 4 + 1 + alignment to 32 bits
  116. 0x00000000 - high 32 bits of section address
  117. 0x00000004 - section address is 4
  118. 0x98010002 - 64 bits with address of following data
  119. 0x00000000 - high 32 bits of address
  120. 0x00000004 - low 32 bits: data starts at address 4
  121. 0x00000001 - 1
  122. 0x00000002 - 2
  123. 0x00000003 - 3
  124. 0x00000004 - 4
  125. 0xffffffff - -1
  126. 0xfffff827 - -2009
  127. 0x50000000 - 80 as a byte, padded with zeros.
  128. </pre></div>
  129. <p>Note that the lop_spec wrapping does not include the section
  130. contents. Compare this to a non-loaded section specified as:
  131. </p>
  132. <div class="example">
  133. <pre class="example"> .section thirdsec
  134. TETRA 200001,100002
  135. BYTE 38,40
  136. </pre></div>
  137. <p>This, when linked to address &lsquo;<samp>0x200000000000001c</samp>&rsquo;, is
  138. represented by:
  139. </p>
  140. <div class="example">
  141. <pre class="example"> 0x98080050 - lop_spec 80
  142. 0x00000002 - two 32-bit words for the section name
  143. 0x7365636e - &quot;thir&quot;
  144. 0x616d6500 - &quot;dsec&quot;
  145. 0x00000010 - flag READONLY
  146. 0x00000000 - high 32 bits of section length
  147. 0x0000000c - section length is 12 bytes; 2 * 4 + 2 + alignment to 32 bits
  148. 0x20000000 - high 32 bits of address
  149. 0x0000001c - low 32 bits of address 0x200000000000001c
  150. 0x00030d41 - 200001
  151. 0x000186a2 - 100002
  152. 0x26280000 - 38, 40 as bytes, padded with zeros
  153. </pre></div>
  154. <p>For the latter example, the section contents must not be
  155. loaded in memory, and is therefore specified as part of the
  156. special data. The address is usually unimportant but might
  157. provide information for e.g. the DWARF 2 debugging format.
  158. </p>
  159. <hr>
  160. <div class="header">
  161. <p>
  162. Previous: <a href="Symbol_002dtable.html#Symbol_002dtable" accesskey="p" rel="prev">Symbol-table</a>, Up: <a href="mmo.html#mmo" accesskey="u" rel="up">mmo</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>
  163. </div>
  164. </body>
  165. </html>