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.

132 lines
6.6KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1992-2020 Free Software Foundation, Inc.
  4. Contributed by Cygnus Support. Written by Julia Menapace, Jim Kingdon,
  5. and David MacKenzie.
  6. Permission is granted to copy, distribute and/or modify this document
  7. under the terms of the GNU Free Documentation License, Version 1.3 or
  8. any later version published by the Free Software Foundation; with no
  9. Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  10. Texts. A copy of the license is included in the section entitled "GNU
  11. Free Documentation License". -->
  12. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title>Include Files (STABS)</title>
  16. <meta name="description" content="Include Files (STABS)">
  17. <meta name="keywords" content="Include Files (STABS)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="Symbol-Types-Index.html#Symbol-Types-Index" rel="index" title="Symbol Types Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="Program-Structure.html#Program-Structure" rel="up" title="Program Structure">
  25. <link href="Line-Numbers.html#Line-Numbers" rel="next" title="Line Numbers">
  26. <link href="Source-Files.html#Source-Files" rel="prev" title="Source Files">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.indentedblock {margin-right: 0em}
  31. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  32. blockquote.smallquotation {font-size: smaller}
  33. div.display {margin-left: 3.2em}
  34. div.example {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style: oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nolinebreak {white-space: nowrap}
  49. span.roman {font-family: initial; font-weight: normal}
  50. span.sansserif {font-family: sans-serif; font-weight: normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en">
  56. <a name="Include-Files"></a>
  57. <div class="header">
  58. <p>
  59. Next: <a href="Line-Numbers.html#Line-Numbers" accesskey="n" rel="next">Line Numbers</a>, Previous: <a href="Source-Files.html#Source-Files" accesskey="p" rel="prev">Source Files</a>, Up: <a href="Program-Structure.html#Program-Structure" accesskey="u" rel="up">Program Structure</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Symbol-Types-Index.html#Symbol-Types-Index" title="Index" rel="index">Index</a>]</p>
  60. </div>
  61. <hr>
  62. <a name="Names-of-Include-Files"></a>
  63. <h3 class="section">2.3 Names of Include Files</h3>
  64. <p>There are several schemes for dealing with include files: the
  65. traditional <code>N_SOL</code> approach, Sun&rsquo;s <code>N_BINCL</code> approach, and the
  66. XCOFF <code>C_BINCL</code> approach (which despite the similar name has little in
  67. common with <code>N_BINCL</code>).
  68. </p>
  69. <a name="index-N_005fSOL"></a>
  70. <p>An <code>N_SOL</code> symbol specifies which include file subsequent symbols
  71. refer to. The string field is the name of the file and the value is the
  72. text address corresponding to the end of the previous include file and
  73. the start of this one. To specify the main source file again, use an
  74. <code>N_SOL</code> symbol with the name of the main source file.
  75. </p>
  76. <a name="index-N_005fBINCL"></a>
  77. <a name="index-N_005fEINCL"></a>
  78. <a name="index-N_005fEXCL"></a>
  79. <p>The <code>N_BINCL</code> approach works as follows. An <code>N_BINCL</code> symbol
  80. specifies the start of an include file. In an object file, only the
  81. string is significant; the linker puts data into some of the other
  82. fields. The end of the include file is marked by an <code>N_EINCL</code>
  83. symbol (which has no string field). In an object file, there is no
  84. significant data in the <code>N_EINCL</code> symbol. <code>N_BINCL</code> and
  85. <code>N_EINCL</code> can be nested.
  86. </p>
  87. <p>If the linker detects that two source files have identical stabs between
  88. an <code>N_BINCL</code> and <code>N_EINCL</code> pair (as will generally be the case
  89. for a header file), then it only puts out the stabs once. Each
  90. additional occurrence is replaced by an <code>N_EXCL</code> symbol. I believe
  91. the GNU linker and the Sun (both SunOS4 and Solaris) linker are the only
  92. ones which supports this feature.
  93. </p>
  94. <p>A linker which supports this feature will set the value of a
  95. <code>N_BINCL</code> symbol to the total of all the characters in the stabs
  96. strings included in the header file, omitting any file numbers. The
  97. value of an <code>N_EXCL</code> symbol is the same as the value of the
  98. <code>N_BINCL</code> symbol it replaces. This information can be used to
  99. match up <code>N_EXCL</code> and <code>N_BINCL</code> symbols which have the same
  100. filename. The <code>N_EINCL</code> value, and the values of the other and
  101. description fields for all three, appear to always be zero.
  102. </p>
  103. <a name="index-C_005fBINCL"></a>
  104. <a name="index-C_005fEINCL"></a>
  105. <p>For the start of an include file in XCOFF, use the <samp>.bi</samp> assembler
  106. directive, which generates a <code>C_BINCL</code> symbol. A <samp>.ei</samp>
  107. directive, which generates a <code>C_EINCL</code> symbol, denotes the end of
  108. the include file. Both directives are followed by the name of the
  109. source file in quotes, which becomes the string for the symbol.
  110. The value of each symbol, produced automatically by the assembler
  111. and linker, is the offset into the executable of the beginning
  112. (inclusive, as you&rsquo;d expect) or end (inclusive, as you would not expect)
  113. of the portion of the COFF line table that corresponds to this include
  114. file. <code>C_BINCL</code> and <code>C_EINCL</code> do not nest.
  115. </p>
  116. <hr>
  117. <div class="header">
  118. <p>
  119. Next: <a href="Line-Numbers.html#Line-Numbers" accesskey="n" rel="next">Line Numbers</a>, Previous: <a href="Source-Files.html#Source-Files" accesskey="p" rel="prev">Source Files</a>, Up: <a href="Program-Structure.html#Program-Structure" accesskey="u" rel="up">Program Structure</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Symbol-Types-Index.html#Symbol-Types-Index" title="Index" rel="index">Index</a>]</p>
  120. </div>
  121. </body>
  122. </html>