mmo-section-mapping.html 7.6 KB

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