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.

173 lines
8.1KB

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