Canonical-format.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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: Canonical format</title>
  21. <meta name="description" content="Untitled Document: Canonical format">
  22. <meta name="keywords" content="Untitled Document: Canonical format">
  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="What-BFD-Version-2-Can-Do.html#What-BFD-Version-2-Can-Do" rel="up" title="What BFD Version 2 Can Do">
  31. <link href="BFD-front-end.html#BFD-front-end" rel="next" title="BFD front end">
  32. <link href="BFD-information-loss.html#BFD-information-loss" rel="prev" title="BFD information loss">
  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="Canonical-format"></a>
  64. <div class="header">
  65. <p>
  66. Previous: <a href="BFD-information-loss.html#BFD-information-loss" accesskey="p" rel="prev">BFD information loss</a>, Up: <a href="What-BFD-Version-2-Can-Do.html#What-BFD-Version-2-Can-Do" accesskey="u" rel="up">What BFD Version 2 Can Do</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="The-BFD-canonical-object_002dfile-format"></a>
  70. <h4 class="subsection">1.3.2 The BFD canonical object-file format</h4>
  71. <p>The greatest potential for loss of information occurs when there is the least
  72. overlap between the information provided by the source format, that
  73. stored by the canonical format, and that needed by the
  74. destination format. A brief description of the canonical form may help
  75. you understand which kinds of data you can count on preserving across
  76. conversions.
  77. <a name="index-BFD-canonical-format"></a>
  78. <a name="index-internal-object_002dfile-format"></a>
  79. </p>
  80. <dl compact="compact">
  81. <dt><em>files</em></dt>
  82. <dd><p>Information stored on a per-file basis includes target machine
  83. architecture, particular implementation format type, a demand pageable
  84. bit, and a write protected bit. Information like Unix magic numbers is
  85. not stored here&mdash;only the magic numbers&rsquo; meaning, so a <code>ZMAGIC</code>
  86. file would have both the demand pageable bit and the write protected
  87. text bit set. The byte order of the target is stored on a per-file
  88. basis, so that big- and little-endian object files may be used with one
  89. another.
  90. </p>
  91. </dd>
  92. <dt><em>sections</em></dt>
  93. <dd><p>Each section in the input file contains the name of the section, the
  94. section&rsquo;s original address in the object file, size and alignment
  95. information, various flags, and pointers into other BFD data
  96. structures.
  97. </p>
  98. </dd>
  99. <dt><em>symbols</em></dt>
  100. <dd><p>Each symbol contains a pointer to the information for the object file
  101. which originally defined it, its name, its value, and various flag
  102. bits. When a BFD back end reads in a symbol table, it relocates all
  103. symbols to make them relative to the base of the section where they were
  104. defined. Doing this ensures that each symbol points to its containing
  105. section. Each symbol also has a varying amount of hidden private data
  106. for the BFD back end. Since the symbol points to the original file, the
  107. private data format for that symbol is accessible. <code>ld</code> can
  108. operate on a collection of symbols of wildly different formats without
  109. problems.
  110. </p>
  111. <p>Normal global and simple local symbols are maintained on output, so an
  112. output file (no matter its format) will retain symbols pointing to
  113. functions and to global, static, and common variables. Some symbol
  114. information is not worth retaining; in <code>a.out</code>, type information is
  115. stored in the symbol table as long symbol names. This information would
  116. be useless to most COFF debuggers; the linker has command line switches
  117. to allow users to throw it away.
  118. </p>
  119. <p>There is one word of type information within the symbol, so if the
  120. format supports symbol type information within symbols (for example, COFF,
  121. IEEE, Oasys) and the type is simple enough to fit within one word
  122. (nearly everything but aggregates), the information will be preserved.
  123. </p>
  124. </dd>
  125. <dt><em>relocation level</em></dt>
  126. <dd><p>Each canonical BFD relocation record contains a pointer to the symbol to
  127. relocate to, the offset of the data to relocate, the section the data
  128. is in, and a pointer to a relocation type descriptor. Relocation is
  129. performed by passing messages through the relocation type
  130. descriptor and the symbol pointer. Therefore, relocations can be performed
  131. on output data using a relocation method that is only available in one of the
  132. input formats. For instance, Oasys provides a byte relocation format.
  133. A relocation record requesting this relocation type would point
  134. indirectly to a routine to perform this, so the relocation may be
  135. performed on a byte being written to a 68k COFF file, even though 68k COFF
  136. has no such relocation type.
  137. </p>
  138. </dd>
  139. <dt><em>line numbers</em></dt>
  140. <dd><p>Object formats can contain, for debugging purposes, some form of mapping
  141. between symbols, source line numbers, and addresses in the output file.
  142. These addresses have to be relocated along with the symbol information.
  143. Each symbol with an associated list of line number records points to the
  144. first record of the list. The head of a line number list consists of a
  145. pointer to the symbol, which allows finding out the address of the
  146. function whose line number is being described. The rest of the list is
  147. made up of pairs: offsets into the section and line numbers. Any format
  148. which can simply derive this information can pass it successfully
  149. between formats (COFF, IEEE and Oasys).
  150. </p></dd>
  151. </dl>
  152. <hr>
  153. <div class="header">
  154. <p>
  155. Previous: <a href="BFD-information-loss.html#BFD-information-loss" accesskey="p" rel="prev">BFD information loss</a>, Up: <a href="What-BFD-Version-2-Can-Do.html#What-BFD-Version-2-Can-Do" accesskey="u" rel="up">What BFD Version 2 Can Do</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>
  156. </div>
  157. </body>
  158. </html>