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