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.

164 lines
7.6KB

  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 linker LD
  4. (GNU Arm Embedded Toolchain 10-2020-q4-major)
  5. version 2.35.1.
  6. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  7. Permission is granted to copy, distribute and/or modify this document
  8. under the terms of the GNU Free Documentation License, Version 1.3
  9. or any later version published by the Free Software Foundation;
  10. with no Invariant Sections, with no Front-Cover Texts, and with no
  11. Back-Cover Texts. A copy of the license is included in the
  12. section entitled "GNU Free Documentation License". -->
  13. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>Canonical format (LD)</title>
  17. <meta name="description" content="Canonical format (LD)">
  18. <meta name="keywords" content="Canonical format (LD)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="LD-Index.html#LD-Index" rel="index" title="LD Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="BFD-outline.html#BFD-outline" rel="up" title="BFD outline">
  26. <link href="Reporting-Bugs.html#Reporting-Bugs" rel="next" title="Reporting Bugs">
  27. <link href="BFD-information-loss.html#BFD-information-loss" rel="prev" title="BFD information loss">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style: oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="Canonical-format"></a>
  58. <div class="header">
  59. <p>
  60. Previous: <a href="BFD-information-loss.html#BFD-information-loss" accesskey="p" rel="prev">BFD information loss</a>, Up: <a href="BFD-outline.html#BFD-outline" accesskey="u" rel="up">BFD outline</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="LD-Index.html#LD-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="The-BFD-canonical-object_002dfile-format"></a>
  64. <h4 class="subsection">5.1.2 The BFD canonical object-file format</h4>
  65. <p>The greatest potential for loss of information occurs when there is the least
  66. overlap between the information provided by the source format, that
  67. stored by the canonical format, and that needed by the
  68. destination format. A brief description of the canonical form may help
  69. you understand which kinds of data you can count on preserving across
  70. conversions.
  71. <a name="index-BFD-canonical-format"></a>
  72. <a name="index-internal-object_002dfile-format"></a>
  73. </p>
  74. <dl compact="compact">
  75. <dt><em>files</em></dt>
  76. <dd><p>Information stored on a per-file basis includes target machine
  77. architecture, particular implementation format type, a demand pageable
  78. bit, and a write protected bit. Information like Unix magic numbers is
  79. not stored here&mdash;only the magic numbers&rsquo; meaning, so a <code>ZMAGIC</code>
  80. file would have both the demand pageable bit and the write protected
  81. text bit set. The byte order of the target is stored on a per-file
  82. basis, so that big- and little-endian object files may be used with one
  83. another.
  84. </p>
  85. </dd>
  86. <dt><em>sections</em></dt>
  87. <dd><p>Each section in the input file contains the name of the section, the
  88. section&rsquo;s original address in the object file, size and alignment
  89. information, various flags, and pointers into other BFD data
  90. structures.
  91. </p>
  92. </dd>
  93. <dt><em>symbols</em></dt>
  94. <dd><p>Each symbol contains a pointer to the information for the object file
  95. which originally defined it, its name, its value, and various flag
  96. bits. When a BFD back end reads in a symbol table, it relocates all
  97. symbols to make them relative to the base of the section where they were
  98. defined. Doing this ensures that each symbol points to its containing
  99. section. Each symbol also has a varying amount of hidden private data
  100. for the BFD back end. Since the symbol points to the original file, the
  101. private data format for that symbol is accessible. <code>ld</code> can
  102. operate on a collection of symbols of wildly different formats without
  103. problems.
  104. </p>
  105. <p>Normal global and simple local symbols are maintained on output, so an
  106. output file (no matter its format) will retain symbols pointing to
  107. functions and to global, static, and common variables. Some symbol
  108. information is not worth retaining; in <code>a.out</code>, type information is
  109. stored in the symbol table as long symbol names. This information would
  110. be useless to most COFF debuggers; the linker has command-line switches
  111. to allow users to throw it away.
  112. </p>
  113. <p>There is one word of type information within the symbol, so if the
  114. format supports symbol type information within symbols (for example, COFF,
  115. Oasys) and the type is simple enough to fit within one word
  116. (nearly everything but aggregates), the information will be preserved.
  117. </p>
  118. </dd>
  119. <dt><em>relocation level</em></dt>
  120. <dd><p>Each canonical BFD relocation record contains a pointer to the symbol to
  121. relocate to, the offset of the data to relocate, the section the data
  122. is in, and a pointer to a relocation type descriptor. Relocation is
  123. performed by passing messages through the relocation type
  124. descriptor and the symbol pointer. Therefore, relocations can be performed
  125. on output data using a relocation method that is only available in one of the
  126. input formats. For instance, Oasys provides a byte relocation format.
  127. A relocation record requesting this relocation type would point
  128. indirectly to a routine to perform this, so the relocation may be
  129. performed on a byte being written to a 68k COFF file, even though 68k COFF
  130. has no such relocation type.
  131. </p>
  132. </dd>
  133. <dt><em>line numbers</em></dt>
  134. <dd><p>Object formats can contain, for debugging purposes, some form of mapping
  135. between symbols, source line numbers, and addresses in the output file.
  136. These addresses have to be relocated along with the symbol information.
  137. Each symbol with an associated list of line number records points to the
  138. first record of the list. The head of a line number list consists of a
  139. pointer to the symbol, which allows finding out the address of the
  140. function whose line number is being described. The rest of the list is
  141. made up of pairs: offsets into the section and line numbers. Any format
  142. which can simply derive this information can pass it successfully
  143. between formats.
  144. </p></dd>
  145. </dl>
  146. <hr>
  147. <div class="header">
  148. <p>
  149. Previous: <a href="BFD-information-loss.html#BFD-information-loss" accesskey="p" rel="prev">BFD information loss</a>, Up: <a href="BFD-outline.html#BFD-outline" accesskey="u" rel="up">BFD outline</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="LD-Index.html#LD-Index" title="Index" rel="index">Index</a>]</p>
  150. </div>
  151. </body>
  152. </html>