toolchain/share/doc/stabs/Common-Blocks.html

71 lines
3.5 KiB
HTML

<html lang="en">
<head>
<title>Common Blocks - 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="Variables.html#Variables" title="Variables">
<link rel="prev" href="Register-Variables.html#Register-Variables" title="Register Variables">
<link rel="next" href="Statics.html#Statics" title="Statics">
<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="Common-Blocks"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Statics.html#Statics">Statics</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Register-Variables.html#Register-Variables">Register Variables</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Variables.html#Variables">Variables</a>
<hr>
</div>
<h3 class="section">4.4 Common Blocks</h3>
<p>A common block is a statically allocated section of memory which can be
referred to by several source files. It may contain several variables.
I believe Fortran is the only language with this feature.
<p><a name="index-N_005fBCOMM-31"></a><a name="index-N_005fECOMM-32"></a><a name="index-C_005fBCOMM-33"></a><a name="index-C_005fECOMM-34"></a>A <code>N_BCOMM</code> stab begins a common block and an <code>N_ECOMM</code> stab
ends it. The only field that is significant in these two stabs is the
string, which names a normal (non-debugging) symbol that gives the
address of the common block. According to IBM documentation, only the
<code>N_BCOMM</code> has the name of the common block (even though their
compiler actually puts it both places).
<p><a name="index-N_005fECOML-35"></a><a name="index-C_005fECOML-36"></a>The stabs for the members of the common block are between the
<code>N_BCOMM</code> and the <code>N_ECOMM</code>; the value of each stab is the
offset within the common block of that variable. IBM uses the
<code>C_ECOML</code> stab type, and there is a corresponding <code>N_ECOML</code>
stab type, but Sun's Fortran compiler uses <code>N_GSYM</code> instead. The
variables within a common block use the &lsquo;<samp><span class="samp">V</span></samp>&rsquo; symbol descriptor (I
believe this is true of all Fortran variables). Other stabs (at least
type declarations using <code>C_DECL</code>) can also be between the
<code>N_BCOMM</code> and the <code>N_ECOMM</code>.
</body></html>