blob: d01f70d1342a4f0a637eff0ac9d8e7b6d70f178d [file] [log] [blame]
<html lang="en">
<head>
<title>Symbol Table Format - STABS</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="STABS">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Symbol-Tables.html#Symbol-Tables" title="Symbol Tables">
<link rel="next" href="Transformations-On-Symbol-Tables.html#Transformations-On-Symbol-Tables" title="Transformations On Symbol Tables">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1992-2019 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by Julia Menapace, Jim Kingdon,
and David MacKenzie.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the section entitled ``GNU
Free Documentation License''.-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Symbol-Table-Format"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Transformations-On-Symbol-Tables.html#Transformations-On-Symbol-Tables">Transformations On Symbol Tables</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Symbol-Tables.html#Symbol-Tables">Symbol Tables</a>
<hr>
</div>
<h3 class="section">7.1 Symbol Table Format</h3>
<p>Each time the assembler encounters a stab directive, it puts
each field of the stab into a corresponding field in a symbol table
entry of its output file. If the stab contains a string field, the
symbol table entry for that stab points to a string table entry
containing the string data from the stab. Assembler labels become
relocatable addresses. Symbol table entries in a.out have the format:
<!-- FIXME: should refer to external, not internal. -->
<pre class="example"> struct internal_nlist {
unsigned long n_strx; /* index into string table of name */
unsigned char n_type; /* type of symbol */
unsigned char n_other; /* misc info (usually empty) */
unsigned short n_desc; /* description field */
bfd_vma n_value; /* value of symbol */
};
</pre>
<p>If the stab has a string, the <code>n_strx</code> field holds the offset in
bytes of the string within the string table. The string is terminated
by a NUL character. If the stab lacks a string (for example, it was
produced by a <code>.stabn</code> or <code>.stabd</code> directive), the
<code>n_strx</code> field is zero.
<p>Symbol table entries with <code>n_type</code> field values greater than 0x1f
originated as stabs generated by the compiler (with one random
exception). The other entries were placed in the symbol table of the
executable by the assembler or the linker.
</body></html>